diff --git a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 index 07bd6f88485c..ba299856b2dc 100644 --- a/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 +++ b/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 @@ -108,8 +108,8 @@ function LoginToAzureDevops([string]$devops_pat) if (!$devops_pat) { return } - $azCmdStr = "'$devops_pat' | az devops login $($ReleaseDevOpsOrgParameters -join ' ')" - Invoke-Expression $azCmdStr + # based on the docs at https://aka.ms/azure-devops-cli-auth the recommendation is to set this env variable to login + $env:AZURE_DEVOPS_EXT_PAT = $devops_pat } function BuildHashKeyNoNull() @@ -234,6 +234,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $outputCommand = $tr $fields += "Custom.PackagePatchVersions" $fields += "Custom.Generated" $fields += "Custom.RoadmapState" + $fields += "Microsoft.VSTS.Common.StateChangeDate" $fieldList = ($fields | ForEach-Object { "[$_]"}) -join ", " $query = "SELECT ${fieldList} FROM WorkItems WHERE [Work Item Type] = 'Package'" @@ -466,7 +467,7 @@ function CreateOrUpdatePackageWorkItem($lang, $pkg, $verMajorMinor, $existingIte if ($pkgName -ne $existingItem.fields["Custom.Package"]) { $changedField = "Custom.Package" } if ($verMajorMinor -ne $existingItem.fields["Custom.PackageVersionMajorMinor"]) { $changedField = "Custom.PackageVersionMajorMinor" } if ($pkgDisplayName -ne $existingItem.fields["Custom.PackageDisplayName"]) { $changedField = "Custom.PackageDisplayName" } - if ($pkgType -ne $existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" } + if ($pkgType -ne [string]$existingItem.fields["Custom.PackageType"]) { $changedField = "Custom.PackageType" } if ($pkgNewLibrary -ne $existingItem.fields["Custom.PackageTypeNewLibrary"]) { $changedField = "Custom.PackageTypeNewLibrary" } if ($pkgRepoPath -ne $existingItem.fields["Custom.PackageRepoPath"]) { $changedField = "Custom.PackageRepoPath" } if ($serviceName -ne $existingItem.fields["Custom.ServiceName"]) { $changedField = "Custom.ServiceName" } @@ -884,6 +885,25 @@ function UpdatePackageVersions($pkgWorkItem, $plannedVersions, $shippedVersions) "value": "$shippedPackages" } "@ + + # If we shipped a version after we set "In Release" state then reset the state to "Next Release Unknown" + if ($pkgWorkItem.fields["System.State"] -eq "In Release") + { + $lastShippedDate = [DateTime]$newShippedVersions[0].Date + $markedInReleaseDate = ([DateTime]$pkgWorkItem.fields["Microsoft.VSTS.Common.StateChangeDate"]) + + # We just shipped so lets set the state to "Next Release Unknown" + if ($markedInReleaseDate -le $lastShippedDate) + { + $fieldUpdates += @' +{ + "op": "replace", + "path": "/fields/State", + "value": "Next Release Unknown" +} +'@ + } + } } # Full merged version set diff --git a/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 b/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 index 34c754006276..cb96691b8356 100644 --- a/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 +++ b/eng/common/scripts/Update-DevOps-Release-WorkItem.ps1 @@ -33,6 +33,10 @@ az extension show -n azure-devops *> $null if (!$?){ Write-Host 'Installing azure-devops extension' az extension add --name azure-devops +} else { + # Force update the extension to the latest version if it was already installed + # this is needed to ensure we have the authentication issue fixed from earlier versions + az extension update -n azure-devops *> $null } . (Join-Path $PSScriptRoot SemVer.ps1) diff --git a/eng/common/testproxy/target_version.txt b/eng/common/testproxy/target_version.txt index 0ea1143fba37..aef19a2487ba 100644 --- a/eng/common/testproxy/target_version.txt +++ b/eng/common/testproxy/target_version.txt @@ -1 +1 @@ -1.0.0-dev.20220810.2 +1.0.0-dev.20220921.2 diff --git a/sdk/keyvault/azcertificates/CHANGELOG.md b/sdk/keyvault/azcertificates/CHANGELOG.md index 1b27dd76fb43..fcd6104e9e51 100644 --- a/sdk/keyvault/azcertificates/CHANGELOG.md +++ b/sdk/keyvault/azcertificates/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.7.1 (Unreleased) +## 0.7.2 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 0.7.1 (2022-09-20) + +### Features Added +* Added `ClientOptions.DisableChallengeResourceVerification`. + See https://aka.ms/azsdk/blog/vault-uri for more information. + ## 0.7.0 (2022-09-12) ### Breaking Changes diff --git a/sdk/keyvault/azcertificates/client_test.go b/sdk/keyvault/azcertificates/client_test.go index 83518415539c..8a60297b1b5e 100644 --- a/sdk/keyvault/azcertificates/client_test.go +++ b/sdk/keyvault/azcertificates/client_test.go @@ -22,7 +22,9 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/internal/mock" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/keyvault/azcertificates" "github.com/stretchr/testify/require" @@ -245,6 +247,56 @@ func TestDeleteRecover(t *testing.T) { cleanUpCert(t, client, certName) } +func TestDisableChallengeResourceVerification(t *testing.T) { + authResource := `"Bearer authorization="https://login.microsoftonline.com/tenant", resource="%s""` + authScope := `"Bearer authorization="https://login.microsoftonline.com/tenant", scope="%s""` + vaultURL := "https://fakevault.vault.azure.net" + for _, test := range []struct { + challenge, resource string + disableVerify, err bool + }{ + // happy path: resource matches requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.net"}, + {challenge: authScope, resource: "https://vault.azure.net/.default"}, + {challenge: authResource, resource: "https://vault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.net/.default", disableVerify: true}, + + // error cases: resource/scope doesn't match the requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.cn", err: true}, + {challenge: authResource, resource: "https://myvault.azure.net", err: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", err: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", err: true}, + + // the policy shouldn't return errors for the above error cases when verification is disabled + {challenge: authResource, resource: "https://vault.azure.cn", disableVerify: true}, + {challenge: authResource, resource: "https://myvault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", disableVerify: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", disableVerify: true}, + } { + t.Run("", func(t *testing.T) { + srv, close := mock.NewServer(mock.WithTransformAllRequestsToTestServerUrl()) + defer close() + srv.AppendResponse(mock.WithStatusCode(401), mock.WithHeader("WWW-Authenticate", fmt.Sprintf(test.challenge, test.resource))) + srv.AppendResponse(mock.WithStatusCode(200), mock.WithBody([]byte(`{"value":[]}`))) + options := &azcertificates.ClientOptions{ + ClientOptions: policy.ClientOptions{ + Transport: srv, + }, + DisableChallengeResourceVerification: test.disableVerify, + } + client := azcertificates.NewClient(vaultURL, &FakeCredential{}, options) + pager := client.NewListCertificatesPager(nil) + _, err := pager.NextPage(context.Background()) + if test.err { + require.Error(t, err) + require.Contains(t, err.Error(), "challenge resource") + } else { + require.NoError(t, err) + } + }) + } +} + func TestID(t *testing.T) { for _, test := range []struct{ ID, name, version string }{ {"https://foo.vault.azure.net/certificates/name/version", "name", "version"}, diff --git a/sdk/keyvault/azcertificates/custom_client.go b/sdk/keyvault/azcertificates/custom_client.go index 6f38a87481b9..9b0ea289b6ce 100644 --- a/sdk/keyvault/azcertificates/custom_client.go +++ b/sdk/keyvault/azcertificates/custom_client.go @@ -18,6 +18,11 @@ import ( // ClientOptions contains optional settings for Client. type ClientOptions struct { azcore.ClientOptions + + // DisableChallengeResourceVerification controls whether the policy requires the + // authentication challenge resource to match the Key Vault or Managed HSM domain. + // See https://aka.ms/azsdk/blog/vault-uri for more information. + DisableChallengeResourceVerification bool } // NewClient creates a client that accesses a Key Vault's certificates. You should validate that @@ -26,7 +31,12 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if options == nil { options = &ClientOptions{} } - authPolicy := internal.NewKeyVaultChallengePolicy(credential) + authPolicy := internal.NewKeyVaultChallengePolicy( + credential, + &internal.KeyVaultChallengePolicyOptions{ + DisableChallengeResourceVerification: options.DisableChallengeResourceVerification, + }, + ) pl := runtime.NewPipeline(moduleName, version, runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}, &options.ClientOptions) return &Client{endpoint: vaultURL, pl: pl} } diff --git a/sdk/keyvault/azcertificates/go.mod b/sdk/keyvault/azcertificates/go.mod index a0a1d9a0b631..c9a854c7269d 100644 --- a/sdk/keyvault/azcertificates/go.mod +++ b/sdk/keyvault/azcertificates/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 + github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 github.com/stretchr/testify v1.7.0 ) diff --git a/sdk/keyvault/azcertificates/go.sum b/sdk/keyvault/azcertificates/go.sum index 259833ca8ff5..1a29c772f8bd 100644 --- a/sdk/keyvault/azcertificates/go.sum +++ b/sdk/keyvault/azcertificates/go.sum @@ -4,8 +4,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4Sath github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 h1:PGNxFuSnSqMKlLUqiTGi1P4cT9BwY7nGk9yWQem9VQI= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 h1:Lg6BW0VPmCwcMlvOviL3ruHFO+H9tZNqscK0AeuFjGM= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/sdk/keyvault/azcertificates/version.go b/sdk/keyvault/azcertificates/version.go index 720811ca888b..1b0ab4dae4d5 100644 --- a/sdk/keyvault/azcertificates/version.go +++ b/sdk/keyvault/azcertificates/version.go @@ -8,5 +8,5 @@ package azcertificates const ( moduleName = "azcertificates" - version = "v0.7.1" + version = "v0.7.2" ) diff --git a/sdk/keyvault/azkeys/CHANGELOG.md b/sdk/keyvault/azkeys/CHANGELOG.md index 1707796fbaad..1a3b8d38c82d 100644 --- a/sdk/keyvault/azkeys/CHANGELOG.md +++ b/sdk/keyvault/azkeys/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.8.1 (Unreleased) +## 0.8.2 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 0.8.1 (2022-09-20) + +### Features Added +* Added `ClientOptions.DisableChallengeResourceVerification`. + See https://aka.ms/azsdk/blog/vault-uri for more information. + ## 0.8.0 (2022-09-12) ### Breaking Changes diff --git a/sdk/keyvault/azkeys/client_test.go b/sdk/keyvault/azkeys/client_test.go index 66a5590c2d9e..26d9d1507983 100644 --- a/sdk/keyvault/azkeys/client_test.go +++ b/sdk/keyvault/azkeys/client_test.go @@ -18,7 +18,9 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/internal/mock" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys" "github.com/stretchr/testify/require" @@ -201,6 +203,56 @@ func TestCRUD(t *testing.T) { } } +func TestDisableChallengeResourceVerification(t *testing.T) { + authResource := `"Bearer authorization="https://login.microsoftonline.com/tenant", resource="%s""` + authScope := `"Bearer authorization="https://login.microsoftonline.com/tenant", scope="%s""` + vaultURL := "https://fakevault.vault.azure.net" + for _, test := range []struct { + challenge, resource string + disableVerify, err bool + }{ + // happy path: resource matches requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.net"}, + {challenge: authScope, resource: "https://vault.azure.net/.default"}, + {challenge: authResource, resource: "https://vault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.net/.default", disableVerify: true}, + + // error cases: resource/scope doesn't match the requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.cn", err: true}, + {challenge: authResource, resource: "https://myvault.azure.net", err: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", err: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", err: true}, + + // the policy shouldn't return errors for the above error cases when verification is disabled + {challenge: authResource, resource: "https://vault.azure.cn", disableVerify: true}, + {challenge: authResource, resource: "https://myvault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", disableVerify: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", disableVerify: true}, + } { + t.Run("", func(t *testing.T) { + srv, close := mock.NewServer(mock.WithTransformAllRequestsToTestServerUrl()) + defer close() + srv.AppendResponse(mock.WithStatusCode(401), mock.WithHeader("WWW-Authenticate", fmt.Sprintf(test.challenge, test.resource))) + srv.AppendResponse(mock.WithStatusCode(200), mock.WithBody([]byte(`{"value":[]}`))) + options := &azkeys.ClientOptions{ + ClientOptions: policy.ClientOptions{ + Transport: srv, + }, + DisableChallengeResourceVerification: test.disableVerify, + } + client := azkeys.NewClient(vaultURL, &FakeCredential{}, options) + pager := client.NewListKeysPager(nil) + _, err := pager.NextPage(context.Background()) + if test.err { + require.Error(t, err) + require.Contains(t, err.Error(), "challenge resource") + } else { + require.NoError(t, err) + } + }) + } +} + func TestEncryptDecrypt(t *testing.T) { for _, mhsm := range []bool{false, true} { name := "KV" diff --git a/sdk/keyvault/azkeys/custom_client.go b/sdk/keyvault/azkeys/custom_client.go index c50d84d4c939..b3c571854e08 100644 --- a/sdk/keyvault/azkeys/custom_client.go +++ b/sdk/keyvault/azkeys/custom_client.go @@ -18,6 +18,11 @@ import ( // ClientOptions contains optional settings for Client. type ClientOptions struct { azcore.ClientOptions + + // DisableChallengeResourceVerification controls whether the policy requires the + // authentication challenge resource to match the Key Vault or Managed HSM domain. + // See https://aka.ms/azsdk/blog/vault-uri for more information. + DisableChallengeResourceVerification bool } // NewClient creates a client that accesses a Key Vault's keys. You should validate that vaultURL @@ -26,7 +31,12 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if options == nil { options = &ClientOptions{} } - authPolicy := internal.NewKeyVaultChallengePolicy(credential) + authPolicy := internal.NewKeyVaultChallengePolicy( + credential, + &internal.KeyVaultChallengePolicyOptions{ + DisableChallengeResourceVerification: options.DisableChallengeResourceVerification, + }, + ) pl := runtime.NewPipeline(moduleName, version, runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}, &options.ClientOptions) return &Client{endpoint: vaultURL, pl: pl} } diff --git a/sdk/keyvault/azkeys/go.mod b/sdk/keyvault/azkeys/go.mod index a2a94cdf53d8..1eb858307964 100644 --- a/sdk/keyvault/azkeys/go.mod +++ b/sdk/keyvault/azkeys/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 + github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 github.com/stretchr/testify v1.7.0 ) diff --git a/sdk/keyvault/azkeys/go.sum b/sdk/keyvault/azkeys/go.sum index 259833ca8ff5..1a29c772f8bd 100644 --- a/sdk/keyvault/azkeys/go.sum +++ b/sdk/keyvault/azkeys/go.sum @@ -4,8 +4,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4Sath github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 h1:PGNxFuSnSqMKlLUqiTGi1P4cT9BwY7nGk9yWQem9VQI= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 h1:Lg6BW0VPmCwcMlvOviL3ruHFO+H9tZNqscK0AeuFjGM= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/sdk/keyvault/azkeys/version.go b/sdk/keyvault/azkeys/version.go index 3bb88de5c84e..71a43deb9326 100644 --- a/sdk/keyvault/azkeys/version.go +++ b/sdk/keyvault/azkeys/version.go @@ -8,5 +8,5 @@ package azkeys const ( moduleName = "azkeys" - version = "v0.8.1" + version = "v0.8.2" ) diff --git a/sdk/keyvault/azsecrets/CHANGELOG.md b/sdk/keyvault/azsecrets/CHANGELOG.md index 6da15d6809cb..242d76780524 100644 --- a/sdk/keyvault/azsecrets/CHANGELOG.md +++ b/sdk/keyvault/azsecrets/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.10.1 (Unreleased) +## 0.10.2 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 0.10.1 (2022-09-20) + +### Features Added +* Added `ClientOptions.DisableChallengeResourceVerification`. + See https://aka.ms/azsdk/blog/vault-uri for more information. + ## 0.10.0 (2022-09-12) ### Breaking Changes diff --git a/sdk/keyvault/azsecrets/client_test.go b/sdk/keyvault/azsecrets/client_test.go index c2378f9a4e48..e99d1c0d1f60 100644 --- a/sdk/keyvault/azsecrets/client_test.go +++ b/sdk/keyvault/azsecrets/client_test.go @@ -16,7 +16,9 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/internal/mock" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets" "github.com/stretchr/testify/require" @@ -171,6 +173,56 @@ func TestCRUD(t *testing.T) { require.NoError(t, err) } +func TestDisableChallengeResourceVerification(t *testing.T) { + authResource := `"Bearer authorization="https://login.microsoftonline.com/tenant", resource="%s""` + authScope := `"Bearer authorization="https://login.microsoftonline.com/tenant", scope="%s""` + vaultURL := "https://fakevault.vault.azure.net" + for _, test := range []struct { + challenge, resource string + disableVerify, err bool + }{ + // happy path: resource matches requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.net"}, + {challenge: authScope, resource: "https://vault.azure.net/.default"}, + {challenge: authResource, resource: "https://vault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.net/.default", disableVerify: true}, + + // error cases: resource/scope doesn't match the requested vault's host (vault.azure.net) + {challenge: authResource, resource: "https://vault.azure.cn", err: true}, + {challenge: authResource, resource: "https://myvault.azure.net", err: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", err: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", err: true}, + + // the policy shouldn't return errors for the above error cases when verification is disabled + {challenge: authResource, resource: "https://vault.azure.cn", disableVerify: true}, + {challenge: authResource, resource: "https://myvault.azure.net", disableVerify: true}, + {challenge: authScope, resource: "https://vault.azure.cn/.default", disableVerify: true}, + {challenge: authScope, resource: "https://myvault.azure.net/.default", disableVerify: true}, + } { + t.Run("", func(t *testing.T) { + srv, close := mock.NewServer(mock.WithTransformAllRequestsToTestServerUrl()) + defer close() + srv.AppendResponse(mock.WithStatusCode(401), mock.WithHeader("WWW-Authenticate", fmt.Sprintf(test.challenge, test.resource))) + srv.AppendResponse(mock.WithStatusCode(200), mock.WithBody([]byte(`{"value":[]}`))) + options := &azsecrets.ClientOptions{ + ClientOptions: policy.ClientOptions{ + Transport: srv, + }, + DisableChallengeResourceVerification: test.disableVerify, + } + client := azsecrets.NewClient(vaultURL, &FakeCredential{}, options) + pager := client.NewListSecretsPager(nil) + _, err := pager.NextPage(context.Background()) + if test.err { + require.Error(t, err) + require.Contains(t, err.Error(), "challenge resource") + } else { + require.NoError(t, err) + } + }) + } +} + func TestID(t *testing.T) { for _, test := range []struct{ ID, name, version string }{ {"https://foo.vault.azure.net/secrets/name/version", "name", "version"}, diff --git a/sdk/keyvault/azsecrets/custom_client.go b/sdk/keyvault/azsecrets/custom_client.go index 79457f4478c8..28cf69925d52 100644 --- a/sdk/keyvault/azsecrets/custom_client.go +++ b/sdk/keyvault/azsecrets/custom_client.go @@ -18,6 +18,11 @@ import ( // ClientOptions contains optional settings for Client. type ClientOptions struct { azcore.ClientOptions + + // DisableChallengeResourceVerification controls whether the policy requires the + // authentication challenge resource to match the Key Vault or Managed HSM domain. + // See https://aka.ms/azsdk/blog/vault-uri for more information. + DisableChallengeResourceVerification bool } // NewClient creates a client that accesses a Key Vault's secrets. You should validate that @@ -26,7 +31,12 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie if options == nil { options = &ClientOptions{} } - authPolicy := internal.NewKeyVaultChallengePolicy(credential) + authPolicy := internal.NewKeyVaultChallengePolicy( + credential, + &internal.KeyVaultChallengePolicyOptions{ + DisableChallengeResourceVerification: options.DisableChallengeResourceVerification, + }, + ) pl := runtime.NewPipeline(moduleName, version, runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}, &options.ClientOptions) return &Client{endpoint: vaultURL, pl: pl} } diff --git a/sdk/keyvault/azsecrets/go.mod b/sdk/keyvault/azsecrets/go.mod index 351753782a4a..d4c896a0bbaa 100644 --- a/sdk/keyvault/azsecrets/go.mod +++ b/sdk/keyvault/azsecrets/go.mod @@ -6,7 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 + github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 github.com/stretchr/testify v1.7.0 ) diff --git a/sdk/keyvault/azsecrets/go.sum b/sdk/keyvault/azsecrets/go.sum index 259833ca8ff5..1a29c772f8bd 100644 --- a/sdk/keyvault/azsecrets/go.sum +++ b/sdk/keyvault/azsecrets/go.sum @@ -4,8 +4,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4Sath github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0 h1:PGNxFuSnSqMKlLUqiTGi1P4cT9BwY7nGk9yWQem9VQI= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.6.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 h1:Lg6BW0VPmCwcMlvOviL3ruHFO+H9tZNqscK0AeuFjGM= +github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/sdk/keyvault/azsecrets/version.go b/sdk/keyvault/azsecrets/version.go index 9d0e5e4a9091..b11449dfcd54 100644 --- a/sdk/keyvault/azsecrets/version.go +++ b/sdk/keyvault/azsecrets/version.go @@ -8,5 +8,5 @@ package azsecrets const ( moduleName = "azsecrets" - version = "v0.10.1" + version = "v0.10.2" ) diff --git a/sdk/keyvault/internal/CHANGELOG.md b/sdk/keyvault/internal/CHANGELOG.md index 75df0b7fac6d..b5802b649fbc 100644 --- a/sdk/keyvault/internal/CHANGELOG.md +++ b/sdk/keyvault/internal/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 0.7.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 0.7.0 (2022-09-20) ### Breaking Changes diff --git a/sdk/keyvault/internal/constants.go b/sdk/keyvault/internal/constants.go index 3221944729d5..cd94eb0d834c 100644 --- a/sdk/keyvault/internal/constants.go +++ b/sdk/keyvault/internal/constants.go @@ -7,5 +7,5 @@ package internal const ( - version = "v0.7.0" //nolint + version = "v0.7.1" //nolint ) diff --git a/sdk/messaging/azeventhubs/CHANGELOG.md b/sdk/messaging/azeventhubs/CHANGELOG.md index 43df2bb9b33e..ed6387c8cbb1 100644 --- a/sdk/messaging/azeventhubs/CHANGELOG.md +++ b/sdk/messaging/azeventhubs/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features Added +- Raw AMQP message support, including full support for encoding Body (Value, Sequence and also multiple byte slices for Data). See ExampleEventDataBatch_AddEventData_rawAMQPMessages for some concrete examples. + ### Breaking Changes - EventDataBatch.NumMessages() renamed to EventDataBatch.NumEvents() diff --git a/sdk/messaging/azeventhubs/README.md b/sdk/messaging/azeventhubs/README.md index 9ffaac0f54ae..d1d64e939847 100644 --- a/sdk/messaging/azeventhubs/README.md +++ b/sdk/messaging/azeventhubs/README.md @@ -67,7 +67,7 @@ Examples for various scenarios can be found on [pkg.go.dev](https://pkg.go.dev/g This module uses the classification-based logging implementation in `azcore`. To enable console logging for all SDK modules, set the environment variable `AZURE_SDK_GO_LOGGING` to `all`. -Use the `azcore/log` package to control log event output or to enable logs for `azservicebus` only. For example: +Use the `azcore/log` package to control log event output or to enable logs for `azeventhubs` only. For example: ```go import ( diff --git a/sdk/messaging/azeventhubs/amqp_message.go b/sdk/messaging/azeventhubs/amqp_message.go new file mode 100644 index 000000000000..2b6ca2db8915 --- /dev/null +++ b/sdk/messaging/azeventhubs/amqp_message.go @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azeventhubs + +import ( + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/go-amqp" +) + +// AMQPAnnotatedMessage represents the AMQP message, as received from Event Hubs. +// For details about these properties, refer to the AMQP specification: +// +// https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format +// +// Some fields in this struct are typed 'any', which means they will accept AMQP primitives, or in some +// cases slices and maps. +// +// AMQP simple types include: +// - int (any size), uint (any size) +// - float (any size) +// - string +// - bool +// - time.Time +type AMQPAnnotatedMessage struct { + // ApplicationProperties corresponds to the "application-properties" section of an AMQP message. + // + // The values of the map are restricted to AMQP simple types, as listed in the comment for AMQPAnnotatedMessage. + ApplicationProperties map[string]any + + // Body represents the body of an AMQP message. + Body AMQPAnnotatedMessageBody + + // DeliveryAnnotations corresponds to the "delivery-annotations" section in an AMQP message. + // + // The values of the map are restricted to AMQP simple types, as listed in the comment for AMQPAnnotatedMessage. + DeliveryAnnotations map[any]any + + // DeliveryTag corresponds to the delivery-tag property of the TRANSFER frame + // for this message. + DeliveryTag []byte + + // Footer is the transport footers for this AMQP message. + // + // The values of the map are restricted to AMQP simple types, as listed in the comment for AMQPAnnotatedMessage. + Footer map[any]any + + // Header is the transport headers for this AMQP message. + Header *AMQPAnnotatedMessageHeader + + // MessageAnnotations corresponds to the message-annotations section of an AMQP message. + // + // The values of the map are restricted to AMQP simple types, as listed in the comment for AMQPAnnotatedMessage. + MessageAnnotations map[any]any + + // Properties corresponds to the properties section of an AMQP message. + Properties *AMQPAnnotatedMessageProperties +} + +// AMQPAnnotatedMessageProperties represents the properties of an AMQP message. +// See here for more details: +// http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties +type AMQPAnnotatedMessageProperties struct { + // AbsoluteExpiryTime corresponds to the 'absolute-expiry-time' property. + AbsoluteExpiryTime *time.Time + + // ContentEncoding corresponds to the 'content-encoding' property. + ContentEncoding *string + + // ContentType corresponds to the 'content-type' property + ContentType *string + + // CorrelationID corresponds to the 'correlation-id' property. + // The type of CorrelationID can be a uint64, UUID, []byte, or a string + CorrelationID any + + // CreationTime corresponds to the 'creation-time' property. + CreationTime *time.Time + + // GroupID corresponds to the 'group-id' property. + GroupID *string + + // GroupSequence corresponds to the 'group-sequence' property. + GroupSequence *uint32 + + // MessageID corresponds to the 'message-id' property. + // The type of MessageID can be a uint64, UUID, []byte, or string + MessageID any + + // ReplyTo corresponds to the 'reply-to' property. + ReplyTo *string + + // ReplyToGroupID corresponds to the 'reply-to-group-id' property. + ReplyToGroupID *string + + // Subject corresponds to the 'subject' property. + Subject *string + + // To corresponds to the 'to' property. + To *string + + // UserID corresponds to the 'user-id' property. + UserID []byte +} + +// AMQPAnnotatedMessageBody represents the body of an AMQP message. +// Only one of these fields can be used a a time. They are mutually exclusive. +type AMQPAnnotatedMessageBody struct { + // Data is encoded/decoded as multiple data sections in the body. + Data [][]byte + + // Sequence is encoded/decoded as one or more amqp-sequence sections in the body. + // + // The values of the slices are are restricted to AMQP simple types, as listed in the comment for AMQPAnnotatedMessage. + Sequence [][]any + + // Value is encoded/decoded as the amqp-value section in the body. + // + // The type of Value can be any of the AMQP simple types, as listed in the comment for AMQPAnnotatedMessage, + // as well as slices or maps of AMQP simple types. + Value any +} + +// AMQPAnnotatedMessageHeader carries standard delivery details about the transfer +// of a message. +// See https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header +// for more details. +type AMQPAnnotatedMessageHeader struct { + // DeliveryCount is the number of unsuccessful previous attempts to deliver this message. + // It corresponds to the 'delivery-count' property. + DeliveryCount uint32 + + // Durable corresponds to the 'durable' property. + Durable bool + + // FirstAcquirer corresponds to the 'first-acquirer' property. + FirstAcquirer bool + + // Priority corresponds to the 'priority' property. + Priority uint8 + + // TTL corresponds to the 'ttl' property. + TTL time.Duration +} + +// toAMQPMessage converts between our (azeventhubs) AMQP message +// to the underlying message used by go-amqp. +func (am *AMQPAnnotatedMessage) toAMQPMessage() *amqp.Message { + var header *amqp.MessageHeader + + if am.Header != nil { + header = &amqp.MessageHeader{ + DeliveryCount: am.Header.DeliveryCount, + Durable: am.Header.Durable, + FirstAcquirer: am.Header.FirstAcquirer, + Priority: am.Header.Priority, + TTL: am.Header.TTL, + } + } + + var properties *amqp.MessageProperties + + if am.Properties != nil { + properties = &amqp.MessageProperties{ + AbsoluteExpiryTime: am.Properties.AbsoluteExpiryTime, + ContentEncoding: am.Properties.ContentEncoding, + ContentType: am.Properties.ContentType, + CorrelationID: am.Properties.CorrelationID, + CreationTime: am.Properties.CreationTime, + GroupID: am.Properties.GroupID, + GroupSequence: am.Properties.GroupSequence, + MessageID: am.Properties.MessageID, + ReplyTo: am.Properties.ReplyTo, + ReplyToGroupID: am.Properties.ReplyToGroupID, + Subject: am.Properties.Subject, + To: am.Properties.To, + UserID: am.Properties.UserID, + } + } else { + properties = &amqp.MessageProperties{} + } + + var footer amqp.Annotations + + if am.Footer != nil { + footer = (amqp.Annotations)(am.Footer) + } + + return &amqp.Message{ + Annotations: copyAnnotations(am.MessageAnnotations), + ApplicationProperties: am.ApplicationProperties, + Data: am.Body.Data, + DeliveryAnnotations: amqp.Annotations(am.DeliveryAnnotations), + DeliveryTag: am.DeliveryTag, + Footer: footer, + Header: header, + Properties: properties, + Sequence: am.Body.Sequence, + Value: am.Body.Value, + } +} + +func copyAnnotations(src map[any]any) amqp.Annotations { + if src == nil { + return amqp.Annotations{} + } + + dest := amqp.Annotations{} + + for k, v := range src { + dest[k] = v + } + + return dest +} + +func newAMQPAnnotatedMessage(goAMQPMessage *amqp.Message) *AMQPAnnotatedMessage { + var header *AMQPAnnotatedMessageHeader + + if goAMQPMessage.Header != nil { + header = &AMQPAnnotatedMessageHeader{ + DeliveryCount: goAMQPMessage.Header.DeliveryCount, + Durable: goAMQPMessage.Header.Durable, + FirstAcquirer: goAMQPMessage.Header.FirstAcquirer, + Priority: goAMQPMessage.Header.Priority, + TTL: goAMQPMessage.Header.TTL, + } + } + + var properties *AMQPAnnotatedMessageProperties + + if goAMQPMessage.Properties != nil { + properties = &AMQPAnnotatedMessageProperties{ + AbsoluteExpiryTime: goAMQPMessage.Properties.AbsoluteExpiryTime, + ContentEncoding: goAMQPMessage.Properties.ContentEncoding, + ContentType: goAMQPMessage.Properties.ContentType, + CorrelationID: goAMQPMessage.Properties.CorrelationID, + CreationTime: goAMQPMessage.Properties.CreationTime, + GroupID: goAMQPMessage.Properties.GroupID, + GroupSequence: goAMQPMessage.Properties.GroupSequence, + MessageID: goAMQPMessage.Properties.MessageID, + ReplyTo: goAMQPMessage.Properties.ReplyTo, + ReplyToGroupID: goAMQPMessage.Properties.ReplyToGroupID, + Subject: goAMQPMessage.Properties.Subject, + To: goAMQPMessage.Properties.To, + UserID: goAMQPMessage.Properties.UserID, + } + } + + var footer map[any]any + + if goAMQPMessage.Footer != nil { + footer = (map[any]any)(goAMQPMessage.Footer) + } + + return &AMQPAnnotatedMessage{ + MessageAnnotations: map[any]any(goAMQPMessage.Annotations), + ApplicationProperties: goAMQPMessage.ApplicationProperties, + Body: AMQPAnnotatedMessageBody{ + Data: goAMQPMessage.Data, + Sequence: goAMQPMessage.Sequence, + Value: goAMQPMessage.Value, + }, + DeliveryAnnotations: map[any]any(goAMQPMessage.DeliveryAnnotations), + DeliveryTag: goAMQPMessage.DeliveryTag, + Footer: footer, + Header: header, + Properties: properties, + } +} diff --git a/sdk/messaging/azeventhubs/amqp_message_test.go b/sdk/messaging/azeventhubs/amqp_message_test.go new file mode 100644 index 000000000000..d7af421f2034 --- /dev/null +++ b/sdk/messaging/azeventhubs/amqp_message_test.go @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azeventhubs + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAMQPAnnotatedMessageUnitTest(t *testing.T) { + t.Run("Default", func(t *testing.T) { + msg := &AMQPAnnotatedMessage{} + amqpMessage := msg.toAMQPMessage() + + // we duplicate/inflate these since we modify them + // in various parts of the API. + require.NotNil(t, amqpMessage.Properties) + require.NotNil(t, amqpMessage.Annotations) + }) +} diff --git a/sdk/messaging/azeventhubs/checkpoint_store.go b/sdk/messaging/azeventhubs/checkpoint_store.go index 02175d506685..8b31e60a78ae 100644 --- a/sdk/messaging/azeventhubs/checkpoint_store.go +++ b/sdk/messaging/azeventhubs/checkpoint_store.go @@ -26,39 +26,25 @@ type CheckpointStore interface { // Ownership tracks which consumer owns a particular partition. type Ownership struct { - CheckpointStoreAddress - OwnershipData -} + ConsumerGroup string + EventHubName string + FullyQualifiedNamespace string + PartitionID string -// OwnershipData is data specific to ownership, like the -// current owner, by ID, and the last time the ownership was -// updated, which is used to calculate if ownership has expired. -type OwnershipData struct { - OwnerID string - LastModifiedTime time.Time - ETag string + OwnerID string // the owner ID of the Processor + LastModifiedTime time.Time // used when calculating if ownership has expired + ETag string // the ETag, used when attempting to claim or update ownership of a partition. } // Checkpoint tracks the last succesfully processed event in a partition. type Checkpoint struct { - CheckpointStoreAddress - CheckpointData -} - -// CheckpointStoreAddress contains the properties needed to uniquely address checkpoints -// or ownership. -type CheckpointStoreAddress struct { ConsumerGroup string EventHubName string FullyQualifiedNamespace string PartitionID string -} -// CheckpointData tracks latest offset and sequence number that have been -// processed by the client. -type CheckpointData struct { - Offset *int64 - SequenceNumber *int64 + Offset *int64 // the last succesfully processed Offset. + SequenceNumber *int64 // the last succesfully processed SequenceNumber. } // ListCheckpointsOptions contains optional parameters for the ListCheckpoints function diff --git a/sdk/messaging/azeventhubs/checkpoints/blob_store.go b/sdk/messaging/azeventhubs/checkpoints/blob_store.go index 3832dc8a7c2c..6a0b7d6baf97 100644 --- a/sdk/messaging/azeventhubs/checkpoints/blob_store.go +++ b/sdk/messaging/azeventhubs/checkpoints/blob_store.go @@ -24,16 +24,16 @@ type BlobStore struct { cc *blob.ContainerClient } -// NewBlobStoreOptions contains optional parameters for the New, NewFromConnectionString and NewWithSharedKey +// BlobStoreOptions contains optional parameters for the New, NewFromConnectionString and NewWithSharedKey // functions -type NewBlobStoreOptions struct { +type BlobStoreOptions struct { azcore.ClientOptions } // NewBlobStore creates a checkpoint store that stores ownership and checkpoints in // Azure Blob storage, using a container URL and a TokenCredential. // NOTE: the container must exist before the checkpoint store can be used. -func NewBlobStore(containerURL string, cred azcore.TokenCredential, options *NewBlobStoreOptions) (*BlobStore, error) { +func NewBlobStore(containerURL string, cred azcore.TokenCredential, options *BlobStoreOptions) (*BlobStore, error) { cc, err := blob.NewContainerClient(containerURL, cred, toContainerClientOptions(options)) if err != nil { @@ -49,7 +49,7 @@ func NewBlobStore(containerURL string, cred azcore.TokenCredential, options *New // ownership and checkpoints in Azure Blob storage, using a storage account // connection string. // NOTE: the container must exist before the checkpoint store can be used. -func NewBlobStoreFromConnectionString(connectionString string, containerName string, options *NewBlobStoreOptions) (azeventhubs.CheckpointStore, error) { +func NewBlobStoreFromConnectionString(connectionString string, containerName string, options *BlobStoreOptions) (azeventhubs.CheckpointStore, error) { cc, err := blob.NewContainerClientFromConnectionString(connectionString, containerName, toContainerClientOptions(options)) if err != nil { @@ -68,7 +68,7 @@ func (b *BlobStore) ClaimOwnership(ctx context.Context, partitionOwnership []aze // TODO: in parallel? for _, po := range partitionOwnership { - blobName, err := nameForOwnershipBlob(po.CheckpointStoreAddress) + blobName, err := nameForOwnershipBlob(po) if err != nil { return nil, err @@ -80,7 +80,7 @@ func (b *BlobStore) ClaimOwnership(ctx context.Context, partitionOwnership []aze expectedETag = &po.ETag } - lastModified, etag, err := b.setMetadata(ctx, blobName, newOwnershipBlobMetadata(po.OwnershipData), expectedETag) + lastModified, etag, err := b.setMetadata(ctx, blobName, newOwnershipBlobMetadata(po), expectedETag) if err != nil { var storageErr *blob.StorageError @@ -95,14 +95,11 @@ func (b *BlobStore) ClaimOwnership(ctx context.Context, partitionOwnership []aze return nil, err } - ownerships = append(ownerships, azeventhubs.Ownership{ - CheckpointStoreAddress: po.CheckpointStoreAddress, - OwnershipData: azeventhubs.OwnershipData{ - ETag: etag, - OwnerID: po.OwnershipData.OwnerID, - LastModifiedTime: *lastModified, - }, - }) + newOwnership := po + newOwnership.ETag = etag + newOwnership.LastModifiedTime = *lastModified + + ownerships = append(ownerships, newOwnership) } return ownerships, nil @@ -110,7 +107,7 @@ func (b *BlobStore) ClaimOwnership(ctx context.Context, partitionOwnership []aze // ListCheckpoints lists all the available checkpoints. func (b *BlobStore) ListCheckpoints(ctx context.Context, fullyQualifiedNamespace string, eventHubName string, consumerGroup string, options *azeventhubs.ListCheckpointsOptions) ([]azeventhubs.Checkpoint, error) { - prefix, err := prefixForCheckpointBlobs(azeventhubs.CheckpointStoreAddress{ + prefix, err := prefixForCheckpointBlobs(azeventhubs.Checkpoint{ FullyQualifiedNamespace: fullyQualifiedNamespace, EventHubName: eventHubName, ConsumerGroup: consumerGroup, @@ -134,21 +131,19 @@ func (b *BlobStore) ListCheckpoints(ctx context.Context, fullyQualifiedNamespace for _, blob := range resp.Segment.BlobItems { partitionID := partitionIDRegexp.FindString(*blob.Name) - cpdata, err := newCheckpointData(blob.Metadata) - if err != nil { + cp := azeventhubs.Checkpoint{ + FullyQualifiedNamespace: fullyQualifiedNamespace, + EventHubName: eventHubName, + ConsumerGroup: consumerGroup, + PartitionID: partitionID, + } + + if err := updateCheckpoint(blob.Metadata, &cp); err != nil { return nil, err } - checkpoints = append(checkpoints, azeventhubs.Checkpoint{ - CheckpointStoreAddress: azeventhubs.CheckpointStoreAddress{ - FullyQualifiedNamespace: fullyQualifiedNamespace, - EventHubName: eventHubName, - ConsumerGroup: consumerGroup, - PartitionID: partitionID, - }, - CheckpointData: cpdata, - }) + checkpoints = append(checkpoints, cp) } } @@ -163,10 +158,11 @@ var partitionIDRegexp = regexp.MustCompile("[^/]+?$") // ListOwnership lists all ownerships. func (b *BlobStore) ListOwnership(ctx context.Context, fullyQualifiedNamespace string, eventHubName string, consumerGroup string, options *azeventhubs.ListOwnershipOptions) ([]azeventhubs.Ownership, error) { - prefix, err := prefixForOwnershipBlobs(azeventhubs.CheckpointStoreAddress{ + prefix, err := prefixForOwnershipBlobs(azeventhubs.Ownership{ FullyQualifiedNamespace: fullyQualifiedNamespace, EventHubName: eventHubName, ConsumerGroup: consumerGroup, + // ignore partition ID as this is wildcarded. }) if err != nil { @@ -187,21 +183,19 @@ func (b *BlobStore) ListOwnership(ctx context.Context, fullyQualifiedNamespace s for _, blob := range resp.Segment.BlobItems { partitionID := partitionIDRegexp.FindString(*blob.Name) - ownershipData, err := newOwnershipData(blob) - if err != nil { + o := azeventhubs.Ownership{ + FullyQualifiedNamespace: fullyQualifiedNamespace, + EventHubName: eventHubName, + ConsumerGroup: consumerGroup, + PartitionID: partitionID, + } + + if err := updateOwnership(blob, &o); err != nil { return nil, err } - ownerships = append(ownerships, azeventhubs.Ownership{ - CheckpointStoreAddress: azeventhubs.CheckpointStoreAddress{ - FullyQualifiedNamespace: fullyQualifiedNamespace, - EventHubName: eventHubName, - ConsumerGroup: consumerGroup, - PartitionID: partitionID, - }, - OwnershipData: ownershipData, - }) + ownerships = append(ownerships, o) } } @@ -214,13 +208,13 @@ func (b *BlobStore) ListOwnership(ctx context.Context, fullyQualifiedNamespace s // UpdateCheckpoint updates a specific checkpoint with a sequence and offset. func (b *BlobStore) UpdateCheckpoint(ctx context.Context, checkpoint azeventhubs.Checkpoint, options *azeventhubs.UpdateCheckpointOptions) error { - blobName, err := nameForCheckpointBlob(checkpoint.CheckpointStoreAddress) + blobName, err := nameForCheckpointBlob(checkpoint) if err != nil { return err } - _, _, err = b.setMetadata(ctx, blobName, newCheckpointBlobMetadata(checkpoint.CheckpointData), nil) + _, _, err = b.setMetadata(ctx, blobName, newCheckpointBlobMetadata(checkpoint), nil) return err } @@ -273,7 +267,7 @@ func (b *BlobStore) setMetadata(ctx context.Context, blobName string, blobMetada } } -func nameForCheckpointBlob(a azeventhubs.CheckpointStoreAddress) (string, error) { +func nameForCheckpointBlob(a azeventhubs.Checkpoint) (string, error) { if a.FullyQualifiedNamespace == "" || a.EventHubName == "" || a.ConsumerGroup == "" || a.PartitionID == "" { return "", errors.New("missing fields for blob name") } @@ -282,7 +276,7 @@ func nameForCheckpointBlob(a azeventhubs.CheckpointStoreAddress) (string, error) return fmt.Sprintf("%s/%s/%s/checkpoint/%s", a.FullyQualifiedNamespace, a.EventHubName, a.ConsumerGroup, a.PartitionID), nil } -func prefixForCheckpointBlobs(a azeventhubs.CheckpointStoreAddress) (string, error) { +func prefixForCheckpointBlobs(a azeventhubs.Checkpoint) (string, error) { if a.FullyQualifiedNamespace == "" || a.EventHubName == "" || a.ConsumerGroup == "" { return "", errors.New("missing fields for blob prefix") } @@ -291,7 +285,7 @@ func prefixForCheckpointBlobs(a azeventhubs.CheckpointStoreAddress) (string, err return fmt.Sprintf("%s/%s/%s/checkpoint/", a.FullyQualifiedNamespace, a.EventHubName, a.ConsumerGroup), nil } -func nameForOwnershipBlob(a azeventhubs.CheckpointStoreAddress) (string, error) { +func nameForOwnershipBlob(a azeventhubs.Ownership) (string, error) { if a.FullyQualifiedNamespace == "" || a.EventHubName == "" || a.ConsumerGroup == "" || a.PartitionID == "" { return "", errors.New("missing fields for blob name") } @@ -300,7 +294,7 @@ func nameForOwnershipBlob(a azeventhubs.CheckpointStoreAddress) (string, error) return fmt.Sprintf("%s/%s/%s/ownership/%s", a.FullyQualifiedNamespace, a.EventHubName, a.ConsumerGroup, a.PartitionID), nil } -func prefixForOwnershipBlobs(a azeventhubs.CheckpointStoreAddress) (string, error) { +func prefixForOwnershipBlobs(a azeventhubs.Ownership) (string, error) { if a.FullyQualifiedNamespace == "" || a.EventHubName == "" || a.ConsumerGroup == "" { return "", errors.New("missing fields for blob prefix") } @@ -309,42 +303,41 @@ func prefixForOwnershipBlobs(a azeventhubs.CheckpointStoreAddress) (string, erro return fmt.Sprintf("%s/%s/%s/ownership/", a.FullyQualifiedNamespace, a.EventHubName, a.ConsumerGroup), nil } -func newCheckpointData(metadata map[string]*string) (azeventhubs.CheckpointData, error) { +func updateCheckpoint(metadata map[string]*string, destCheckpoint *azeventhubs.Checkpoint) error { if metadata == nil { - return azeventhubs.CheckpointData{}, fmt.Errorf("no checkpoint metadata for blob") + return fmt.Errorf("no checkpoint metadata for blob") } sequenceNumberStr, ok := metadata["sequencenumber"] if !ok || sequenceNumberStr == nil { - return azeventhubs.CheckpointData{}, errors.New("sequencenumber is missing from metadata") + return errors.New("sequencenumber is missing from metadata") } sequenceNumber, err := strconv.ParseInt(*sequenceNumberStr, 10, 64) if err != nil { - return azeventhubs.CheckpointData{}, fmt.Errorf("sequencenumber could not be parsed as an int64: %s", err.Error()) + return fmt.Errorf("sequencenumber could not be parsed as an int64: %s", err.Error()) } offsetStr, ok := metadata["offset"] if !ok || offsetStr == nil { - return azeventhubs.CheckpointData{}, errors.New("offset is missing from metadata") + return errors.New("offset is missing from metadata") } offset, err := strconv.ParseInt(*offsetStr, 10, 64) if err != nil { - return azeventhubs.CheckpointData{}, fmt.Errorf("offset could not be parsed as an int64: %s", err.Error()) + return fmt.Errorf("offset could not be parsed as an int64: %s", err.Error()) } - return azeventhubs.CheckpointData{ - Offset: &offset, - SequenceNumber: &sequenceNumber, - }, nil + destCheckpoint.Offset = &offset + destCheckpoint.SequenceNumber = &sequenceNumber + return nil } -func newCheckpointBlobMetadata(cpd azeventhubs.CheckpointData) map[string]string { +func newCheckpointBlobMetadata(cpd azeventhubs.Checkpoint) map[string]string { m := map[string]string{} if cpd.SequenceNumber != nil { @@ -358,31 +351,30 @@ func newCheckpointBlobMetadata(cpd azeventhubs.CheckpointData) map[string]string return m } -func newOwnershipData(b *blob.BlobItemInternal) (azeventhubs.OwnershipData, error) { +func updateOwnership(b *blob.BlobItemInternal, destOwnership *azeventhubs.Ownership) error { if b == nil || b.Metadata == nil || b.Properties == nil { - return azeventhubs.OwnershipData{}, fmt.Errorf("no ownership metadata for blob") + return fmt.Errorf("no ownership metadata for blob") } ownerID, ok := b.Metadata["ownerid"] if !ok || ownerID == nil { - return azeventhubs.OwnershipData{}, errors.New("ownerid is missing from metadata") + return errors.New("ownerid is missing from metadata") } - return azeventhubs.OwnershipData{ - OwnerID: *ownerID, - LastModifiedTime: *b.Properties.LastModified, - ETag: *b.Properties.Etag, - }, nil + destOwnership.OwnerID = *ownerID + destOwnership.LastModifiedTime = *b.Properties.LastModified + destOwnership.ETag = *b.Properties.Etag + return nil } -func newOwnershipBlobMetadata(od azeventhubs.OwnershipData) map[string]string { +func newOwnershipBlobMetadata(od azeventhubs.Ownership) map[string]string { return map[string]string{ "ownerid": od.OwnerID, } } -func toContainerClientOptions(opts *NewBlobStoreOptions) *blob.ClientOptions { +func toContainerClientOptions(opts *BlobStoreOptions) *blob.ClientOptions { if opts == nil { return nil } diff --git a/sdk/messaging/azeventhubs/checkpoints/blob_store_test.go b/sdk/messaging/azeventhubs/checkpoints/blob_store_test.go index ffe9cd1975e9..d5049f8def46 100644 --- a/sdk/messaging/azeventhubs/checkpoints/blob_store_test.go +++ b/sdk/messaging/azeventhubs/checkpoints/blob_store_test.go @@ -29,16 +29,12 @@ func TestBlobStore_Checkpoints(t *testing.T) { require.Empty(t, checkpoints) err = store.UpdateCheckpoint(context.Background(), azeventhubs.Checkpoint{ - CheckpointStoreAddress: azeventhubs.CheckpointStoreAddress{ - ConsumerGroup: "$Default", - EventHubName: "event-hub-name", - FullyQualifiedNamespace: "ns.servicebus.windows.net", - PartitionID: "partition-id", - }, - CheckpointData: azeventhubs.CheckpointData{ - Offset: to.Ptr[int64](101), - SequenceNumber: to.Ptr[int64](202), - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + Offset: to.Ptr[int64](101), + SequenceNumber: to.Ptr[int64](202), }, nil) require.NoError(t, err) @@ -46,16 +42,12 @@ func TestBlobStore_Checkpoints(t *testing.T) { require.NoError(t, err) require.Equal(t, azeventhubs.Checkpoint{ - CheckpointStoreAddress: azeventhubs.CheckpointStoreAddress{ - ConsumerGroup: "$Default", - EventHubName: "event-hub-name", - FullyQualifiedNamespace: "ns.servicebus.windows.net", - PartitionID: "partition-id", - }, - CheckpointData: azeventhubs.CheckpointData{ - Offset: to.Ptr[int64](101), - SequenceNumber: to.Ptr[int64](202), - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + Offset: to.Ptr[int64](101), + SequenceNumber: to.Ptr[int64](202), }, checkpoints[0]) } @@ -78,19 +70,13 @@ func TestBlobStore_Ownership(t *testing.T) { require.NoError(t, err) require.Empty(t, ownerships) - address := azeventhubs.CheckpointStoreAddress{ - ConsumerGroup: "$Default", - EventHubName: "event-hub-name", - FullyQualifiedNamespace: "ns.servicebus.windows.net", - PartitionID: "partition-id", - } - ownerships, err = store.ClaimOwnership(context.Background(), []azeventhubs.Ownership{ { - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "owner-id", - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "owner-id", }, }, nil) require.NoError(t, err) @@ -100,23 +86,25 @@ func TestBlobStore_Ownership(t *testing.T) { require.NotZero(t, ownerships[0].LastModifiedTime) require.Equal(t, azeventhubs.Ownership{ - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "owner-id", - ETag: ownerships[0].ETag, - LastModifiedTime: ownerships[0].LastModifiedTime, - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "owner-id", + ETag: ownerships[0].ETag, + LastModifiedTime: ownerships[0].LastModifiedTime, }, ownerships[0]) // if we attempt to claim it with a non-matching etag it will fail to claim // but not fail the call. ownerships, err = store.ClaimOwnership(context.Background(), []azeventhubs.Ownership{ { - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "owner-id", - ETag: "non-matching-etag", - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "owner-id", + ETag: "non-matching-etag", }, }, nil) require.NoError(t, err) @@ -125,22 +113,24 @@ func TestBlobStore_Ownership(t *testing.T) { // now we'll use the actual etag ownerships, err = store.ClaimOwnership(context.Background(), []azeventhubs.Ownership{ { - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "owner-id", - ETag: etagAfterFirstClaim, - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "owner-id", + ETag: etagAfterFirstClaim, }, }, nil) require.NoError(t, err) require.Equal(t, azeventhubs.Ownership{ - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "owner-id", - ETag: ownerships[0].ETag, - LastModifiedTime: ownerships[0].LastModifiedTime, - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "owner-id", + ETag: ownerships[0].ETag, + LastModifiedTime: ownerships[0].LastModifiedTime, }, ownerships[0]) // etag definitely got updated. @@ -156,31 +146,29 @@ func TestBlobStore_ListAndClaim(t *testing.T) { store, err := checkpoints.NewBlobStoreFromConnectionString(testData.ConnectionString, testData.ContainerName, nil) require.NoError(t, err) - address := azeventhubs.CheckpointStoreAddress{ - ConsumerGroup: "$Default", - EventHubName: "event-hub-name", - FullyQualifiedNamespace: "ns.servicebus.windows.net", - PartitionID: "partition-id", - } - claimedOwnerships, err := store.ClaimOwnership(context.Background(), []azeventhubs.Ownership{ { - CheckpointStoreAddress: address, - OwnershipData: azeventhubs.OwnershipData{ - OwnerID: "first-client", - }, + ConsumerGroup: "$Default", + EventHubName: "event-hub-name", + FullyQualifiedNamespace: "ns.servicebus.windows.net", + PartitionID: "partition-id", + OwnerID: "first-client", }, }, nil) require.NoError(t, err) require.NotEmpty(t, claimedOwnerships) - listedOwnerships, err := store.ListOwnership(context.Background(), address.FullyQualifiedNamespace, address.EventHubName, address.ConsumerGroup, nil) + listedOwnerships, err := store.ListOwnership(context.Background(), "ns.servicebus.windows.net", "event-hub-name", "$Default", nil) require.NoError(t, err) require.Equal(t, "first-client", listedOwnerships[0].OwnerID) require.NotEmpty(t, listedOwnerships[0].ETag) require.NotZero(t, listedOwnerships[0].LastModifiedTime) - require.Equal(t, address, listedOwnerships[0].CheckpointStoreAddress) + + require.Equal(t, "$Default", listedOwnerships[0].ConsumerGroup) + require.Equal(t, "event-hub-name", listedOwnerships[0].EventHubName) + require.Equal(t, "ns.servicebus.windows.net", listedOwnerships[0].FullyQualifiedNamespace) + require.Equal(t, "partition-id", listedOwnerships[0].PartitionID) // update using the etag claimedOwnerships, err = store.ClaimOwnership(context.Background(), listedOwnerships, nil) diff --git a/sdk/messaging/azeventhubs/checkpoints/doc.go b/sdk/messaging/azeventhubs/checkpoints/doc.go index dfa23449032c..347512dc3747 100644 --- a/sdk/messaging/azeventhubs/checkpoints/doc.go +++ b/sdk/messaging/azeventhubs/checkpoints/doc.go @@ -4,7 +4,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Package checkpoints provides a CheckpointStore that uses Azure Blob Storage. -// This checkpoint store can be used with the azeventhubs.Processor type to -// coordinate distributed consumption of events from an event hub. +// Package checkpoints provides a CheckpointStore using Azure Blob Storage. +// +// CheckpointStore's are generally not used on their own and will be created so they +// can be passed to a [Processor] to coordinate distributed consumption of events from an event hub. +// +// See [example_processor_test.go] for an example that uses the [checkpoints.BlobStore] with +// a [Processor]. +// +// [Processor]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs#Processor +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go package checkpoints diff --git a/sdk/messaging/azeventhubs/consumer_client.go b/sdk/messaging/azeventhubs/consumer_client.go index 2d9bfe480b15..eec656106da7 100644 --- a/sdk/messaging/azeventhubs/consumer_client.go +++ b/sdk/messaging/azeventhubs/consumer_client.go @@ -47,22 +47,11 @@ type ConsumerClientOptions struct { // NewWebSocketConn is a function that can create a net.Conn for use with websockets. // For an example, see ExampleNewClient_usingWebsockets() function in example_client_test.go. - NewWebSocketConn func(ctx context.Context, args NewWebSocketConnArgs) (net.Conn, error) + NewWebSocketConn func(ctx context.Context, args WebSocketConnArgs) (net.Conn, error) // RetryOptions controls how often operations are retried from this client and any // Receivers and Senders created from this client. RetryOptions RetryOptions - - // StartPosition is the position we will start receiving events from, - // either an offset (inclusive) with Offset, or receiving events received - // after a specific time using EnqueuedTime. - StartPosition StartPosition - - // OwnerLevel is the priority for this consumer, also known as the 'epoch' level. - // When used, a consumer with a higher OwnerLevel will take ownership of a partition - // from consumers with a lower OwnerLevel. - // Default is off. - OwnerLevel *uint64 } // ConsumerClient can create PartitionClient instances, which can read events from @@ -77,9 +66,13 @@ type ConsumerClient struct { clientID string } -// NewConsumerClient creates a ConsumerClient which uses an azcore.TokenCredential for authentication. +// NewConsumerClient creates a ConsumerClient which uses an azcore.TokenCredential for authentication. You +// MUST call [azeventhubs.ConsumerClient.Close] on this client to avoid leaking resources. +// // The fullyQualifiedNamespace is the Event Hubs namespace name (ex: myeventhub.servicebus.windows.net) -// The credential is one of the credentials in the `github.com/Azure/azure-sdk-for-go/sdk/azidentity` package. +// The credential is one of the credentials in the [azidentity] package. +// +// [azidentity]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azidentity func NewConsumerClient(fullyQualifiedNamespace string, eventHub string, consumerGroup string, credential azcore.TokenCredential, options *ConsumerClientOptions) (*ConsumerClient, error) { return newConsumerClient(consumerClientArgs{ consumerGroup: consumerGroup, @@ -89,15 +82,19 @@ func NewConsumerClient(fullyQualifiedNamespace string, eventHub string, consumer }, options) } -// NewConsumerClientFromConnectionString creates a ConsumerClient from a connection string. +// NewConsumerClientFromConnectionString creates a ConsumerClient from a connection string. You +// MUST call [azeventhubs.ConsumerClient.Close] on this client to avoid leaking resources. +// +// connectionString can be one of two formats - with or without an EntityPath key. +// +// When the connection string does not have an entity path, as shown below, the eventHub parameter cannot +// be empty and should contain the name of your event hub. // -// connectionString can be one of the following formats: +// Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey= // -// Connection string, no EntityPath. In this case eventHub cannot be empty. -// ex: Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey= +// When the connection string DOES have an entity path, as shown below, the eventHub parameter must be empty. // -// Connection string, has EntityPath. In this case eventHub must be empty. -// ex: Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey=;EntityPath= +// Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey=;EntityPath=; func NewConsumerClientFromConnectionString(connectionString string, eventHub string, consumerGroup string, options *ConsumerClientOptions) (*ConsumerClient, error) { parsedConn, err := parseConn(connectionString, eventHub) @@ -112,8 +109,8 @@ func NewConsumerClientFromConnectionString(connectionString string, eventHub str }, options) } -// NewPartitionClientOptions provides options for the Subscribe function. -type NewPartitionClientOptions struct { +// PartitionClientOptions provides options for the NewPartitionClient function. +type PartitionClientOptions struct { // StartPosition is the position we will start receiving events from, // either an offset (inclusive) with Offset, or receiving events received // after a specific time using EnqueuedTime. @@ -126,8 +123,10 @@ type NewPartitionClientOptions struct { OwnerLevel *int64 } -// NewPartitionClient creates a client that can receive events from a partition. -func (cc *ConsumerClient) NewPartitionClient(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) { +// NewPartitionClient creates a client that can receive events from a partition. By default it starts +// at the latest point in the partition. This can be changed using the options parameter. +// You MUST call [azeventhubs.PartitionClient.Close] on the returned client to avoid leaking resources. +func (cc *ConsumerClient) NewPartitionClient(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) { return newPartitionClient(partitionClientArgs{ namespace: cc.namespace, eventHub: cc.eventHub, @@ -148,8 +147,9 @@ func (cc *ConsumerClient) GetEventHubProperties(ctx context.Context, options *Ge return getEventHubProperties(ctx, cc.namespace, rpcLink.Link, cc.eventHub, options) } -// GetPartitionProperties gets properties for a specific partition. This includes data like the last enqueued sequence number, the first sequence -// number and when an event was last enqueued to the partition. +// GetPartitionProperties gets properties for a specific partition. This includes data like the +// last enqueued sequence number, the first sequence number and when an event was last enqueued +// to the partition. func (cc *ConsumerClient) GetPartitionProperties(ctx context.Context, partitionID string, options *GetPartitionPropertiesOptions) (PartitionProperties, error) { rpcLink, err := cc.links.GetManagementLink(ctx) @@ -176,7 +176,7 @@ func (cc *ConsumerClient) getDetails() consumerClientDetails { } } -// Close closes the connection for this client. +// Close releases resources for this client. func (cc *ConsumerClient) Close(ctx context.Context) error { return cc.namespace.Close(ctx, true) } diff --git a/sdk/messaging/azeventhubs/consumer_client_test.go b/sdk/messaging/azeventhubs/consumer_client_test.go index c0baf8d93b85..e5d1b30b6f27 100644 --- a/sdk/messaging/azeventhubs/consumer_client_test.go +++ b/sdk/messaging/azeventhubs/consumer_client_test.go @@ -75,7 +75,7 @@ func TestConsumerClient_DefaultAzureCredential(t *testing.T) { require.NoError(t, err) }() - eventDataBatch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + eventDataBatch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: to.Ptr(firstPartition.PartitionID), }) require.NoError(t, err) @@ -88,7 +88,7 @@ func TestConsumerClient_DefaultAzureCredential(t *testing.T) { err = producerClient.SendEventBatch(context.Background(), eventDataBatch, nil) require.NoError(t, err) - subscription, err := consumerClient.NewPartitionClient(firstPartition.PartitionID, &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumerClient.NewPartitionClient(firstPartition.PartitionID, &azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(firstPartition), }) require.NoError(t, err) @@ -193,7 +193,7 @@ func TestConsumerClient_Concurrent_NoEpoch(t *testing.T) { require.NoError(t, err) }() - partitionClient, err := client.NewPartitionClient(partitions[0].PartitionID, &azeventhubs.NewPartitionClientOptions{ + partitionClient, err := client.NewPartitionClient(partitions[0].PartitionID, &azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partitions[0]), }) require.NoError(t, err) @@ -220,7 +220,7 @@ func TestConsumerClient_SameEpoch_StealsLink(t *testing.T) { ownerLevel := int64(2) - origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.NewPartitionClientOptions{ + origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partitions[0]), OwnerLevel: &ownerLevel, }) @@ -236,7 +236,7 @@ func TestConsumerClient_SameEpoch_StealsLink(t *testing.T) { // link with owner level of 2 is alive, so now we'll steal it. - thiefPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.NewPartitionClientOptions{ + thiefPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partitions[0]), OwnerLevel: &ownerLevel, }) @@ -269,7 +269,7 @@ func TestConsumerClient_LowerEpochsAreRejected(t *testing.T) { highestOwnerLevel := int64(2) - origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.NewPartitionClientOptions{ + origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partitions[0]), OwnerLevel: &highestOwnerLevel, }) @@ -288,7 +288,7 @@ func TestConsumerClient_LowerEpochsAreRejected(t *testing.T) { } for _, ownerLevel := range lowerOwnerLevels { - origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.NewPartitionClientOptions{ + origPartClient, cleanup := newPartitionClientForTest(t, partitions[0].PartitionID, azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partitions[0]), OwnerLevel: ownerLevel, }) @@ -312,7 +312,7 @@ func TestConsumerClient_LowerEpochsAreRejected(t *testing.T) { require.NotEmpty(t, events) } -func newPartitionClientForTest(t *testing.T, partitionID string, subscribeOptions azeventhubs.NewPartitionClientOptions) (*azeventhubs.PartitionClient, func()) { +func newPartitionClientForTest(t *testing.T, partitionID string, subscribeOptions azeventhubs.PartitionClientOptions) (*azeventhubs.PartitionClient, func()) { testParams := test.GetConnectionParamsForTest(t) origClient, err := azeventhubs.NewConsumerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, "$Default", &azeventhubs.ConsumerClientOptions{ @@ -348,7 +348,7 @@ func TestConsumerClient_StartPositions(t *testing.T) { require.NoError(t, err) }() - batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: to.Ptr("0"), }) require.NoError(t, err) @@ -379,7 +379,7 @@ func TestConsumerClient_StartPositions(t *testing.T) { require.NoError(t, err) }() - subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ StartPosition: azeventhubs.StartPosition{ Offset: &origPartProps.LastEnqueuedOffset, }, @@ -408,7 +408,7 @@ func TestConsumerClient_StartPositions(t *testing.T) { require.NoError(t, err) }() - subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ StartPosition: azeventhubs.StartPosition{ EnqueuedTime: &origPartProps.LastEnqueuedOn, }, @@ -432,7 +432,7 @@ func TestConsumerClient_StartPositions(t *testing.T) { require.NoError(t, err) }() - subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ StartPosition: azeventhubs.StartPosition{ Earliest: to.Ptr(true), }, @@ -471,7 +471,7 @@ func TestConsumerClient_StartPosition_Latest(t *testing.T) { latestEventsCh := make(chan []*azeventhubs.ReceivedEventData, 1) go func() { - subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ StartPosition: azeventhubs.StartPosition{ Latest: to.Ptr(true), }, @@ -499,7 +499,7 @@ func TestConsumerClient_StartPosition_Latest(t *testing.T) { require.NoError(t, err) }() - batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: to.Ptr("0"), }) require.NoError(t, err) @@ -558,7 +558,7 @@ func mustSendEventsToAllPartitions(t *testing.T, events []*azeventhubs.EventData partitionsCh <- partProps // send the message to the partition. - batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: &partitionID, }) require.NoError(t, err) diff --git a/sdk/messaging/azeventhubs/doc.go b/sdk/messaging/azeventhubs/doc.go index 63a1746f114b..ede39de548c9 100644 --- a/sdk/messaging/azeventhubs/doc.go +++ b/sdk/messaging/azeventhubs/doc.go @@ -4,6 +4,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Package azeventhubs provides clients for sending events, using the ConsumerClient type or -// the Processor, and receiving using the ProducerClient type. +// Package azeventhubs provides clients for sending events and consuming events. +// +// For sending events, use the [azeventhubs.ProducerClient]. +// +// There are two clients for consuming events: +// - [azeventhubs.Processor], which handles checkpointing and load balancing using durable storage. +// - [azeventhubs.ConsumerClient], which is fully manual, but provides full control. package azeventhubs diff --git a/sdk/messaging/azeventhubs/event_data.go b/sdk/messaging/azeventhubs/event_data.go index 425f9ab0c46d..9300aa51f7c6 100644 --- a/sdk/messaging/azeventhubs/event_data.go +++ b/sdk/messaging/azeventhubs/event_data.go @@ -54,6 +54,12 @@ type ReceivedEventData struct { // Offset is the offset of the event. Offset *int64 + // RawAMQPMessage is the AMQP message, as received by the client. This can be useful to get access + // to properties that are not exposed by ReceivedEventData such as payloads encoded into the + // Value or Sequence section, payloads sent as multiple Data sections, as well as Footer + // and Header fields. + RawAMQPMessage *AMQPAnnotatedMessage + // SequenceNumber is a unique number assigned to a message by Event Hubs. SequenceNumber int64 @@ -100,7 +106,9 @@ func (e *EventData) toAMQPMessage() *amqp.Message { // NOTE: this converter assumes that the Body of this message will be the first // serialized byte array in the Data section of the messsage. func newReceivedEventData(amqpMsg *amqp.Message) (*ReceivedEventData, error) { - re := &ReceivedEventData{} + re := &ReceivedEventData{ + RawAMQPMessage: newAMQPAnnotatedMessage(amqpMsg), + } if len(amqpMsg.Data) == 1 { re.Body = amqpMsg.Data[0] diff --git a/sdk/messaging/azeventhubs/event_data_batch.go b/sdk/messaging/azeventhubs/event_data_batch.go index 27d02ae2b382..048e973e372c 100644 --- a/sdk/messaging/azeventhubs/event_data_batch.go +++ b/sdk/messaging/azeventhubs/event_data_batch.go @@ -14,11 +14,14 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/go-amqp" ) -// ErrEventDataTooLarge is returned when a message cannot fit into a batch when using EventDataBatch.AddEventData() +// ErrEventDataTooLarge is returned when a message cannot fit into a batch when using the [azeventhubs.EventDataBatch.AddEventData] function. var ErrEventDataTooLarge = errors.New("the EventData could not be added because it is too large for the batch") type ( - // EventDataBatch represents a batch of messages to send to Event Hubs in a single message + // EventDataBatch is used to efficiently pack up EventData before sending it to Event Hubs. + // + // EventDataBatch's are not meant to be created directly. Use [azeventhubs.ProducerClient.NewEventDataBatch], + // which will create them with the proper size limit for your Event Hub. EventDataBatch struct { mu sync.RWMutex @@ -42,53 +45,70 @@ type AddEventDataOptions struct { // For future expansion } -// AddEventData adds an EventData to the batch if the message will not exceed the max size of the batch -// Returns: -// - ErrMessageTooLarge if the message cannot fit -// - a non-nil error for other failures -// - nil, otherwise -func (mb *EventDataBatch) AddEventData(ed *EventData, options *AddEventDataOptions) error { - return mb.addAMQPMessage(ed.toAMQPMessage()) +// AddEventData adds an EventData to the batch, failing if the EventData would +// cause the EventDataBatch to be too large to send. +// +// This size limit was set when the EventDataBatch was created, in options to +// [azeventhubs.ProducerClient.NewEventDataBatch], or (by default) from Event +// Hubs itself. +// +// Returns ErrMessageTooLarge if the event cannot fit, or a non-nil error for +// other failures. +func (b *EventDataBatch) AddEventData(ed *EventData, options *AddEventDataOptions) error { + return b.addAMQPMessage(ed.toAMQPMessage()) } -// NumBytes is the number of bytes in the message batch -func (mb *EventDataBatch) NumBytes() uint64 { - mb.mu.RLock() - defer mb.mu.RUnlock() +// AddAMQPAnnotatedMessage adds an AMQPAnnotatedMessage to the batch, failing +// if the AMQPAnnotatedMessage would cause the EventDataBatch to be too large to send. +// +// This size limit was set when the EventDataBatch was created, in options to +// [azeventhubs.ProducerClient.NewEventDataBatch], or (by default) from Event +// Hubs itself. +// +// Returns ErrMessageTooLarge if the message cannot fit, or a non-nil error for +// other failures. +func (b *EventDataBatch) AddAMQPAnnotatedMessage(annotatedMessage *AMQPAnnotatedMessage, options *AddEventDataOptions) error { + return b.addAMQPMessage(annotatedMessage.toAMQPMessage()) +} + +// NumBytes is the number of bytes in the batch. +func (b *EventDataBatch) NumBytes() uint64 { + b.mu.RLock() + defer b.mu.RUnlock() - return mb.currentSize + return b.currentSize } -// NumEvents returns the # of events in the batch. -func (mb *EventDataBatch) NumEvents() int32 { - mb.mu.RLock() - defer mb.mu.RUnlock() +// NumEvents returns the number of events in the batch. +func (b *EventDataBatch) NumEvents() int32 { + b.mu.RLock() + defer b.mu.RUnlock() - return int32(len(mb.marshaledMessages)) + return int32(len(b.marshaledMessages)) } // toAMQPMessage converts this batch into a sendable *amqp.Message // NOTE: not idempotent! -func (mb *EventDataBatch) toAMQPMessage() *amqp.Message { - mb.mu.Lock() - defer mb.mu.Unlock() +func (b *EventDataBatch) toAMQPMessage() *amqp.Message { + b.mu.Lock() + defer b.mu.Unlock() - mb.batchEnvelope.Data = make([][]byte, len(mb.marshaledMessages)) - mb.batchEnvelope.Format = batchMessageFormat + b.batchEnvelope.Data = make([][]byte, len(b.marshaledMessages)) + b.batchEnvelope.Format = batchMessageFormat - if mb.partitionKey != nil { - if mb.batchEnvelope.Annotations == nil { - mb.batchEnvelope.Annotations = make(amqp.Annotations) + if b.partitionKey != nil { + if b.batchEnvelope.Annotations == nil { + b.batchEnvelope.Annotations = make(amqp.Annotations) } - mb.batchEnvelope.Annotations[partitionKeyAnnotation] = *mb.partitionKey + b.batchEnvelope.Annotations[partitionKeyAnnotation] = *b.partitionKey } - copy(mb.batchEnvelope.Data, mb.marshaledMessages) - return mb.batchEnvelope + copy(b.batchEnvelope.Data, b.marshaledMessages) + return b.batchEnvelope } -func (mb *EventDataBatch) addAMQPMessage(msg *amqp.Message) error { +func (b *EventDataBatch) addAMQPMessage(msg *amqp.Message) error { if msg.Properties.MessageID == nil || msg.Properties.MessageID == "" { uid, err := uuid.New() if err != nil { @@ -97,12 +117,12 @@ func (mb *EventDataBatch) addAMQPMessage(msg *amqp.Message) error { msg.Properties.MessageID = uid.String() } - if mb.partitionKey != nil { + if b.partitionKey != nil { if msg.Annotations == nil { msg.Annotations = make(amqp.Annotations) } - msg.Annotations[partitionKeyAnnotation] = *mb.partitionKey + msg.Annotations[partitionKeyAnnotation] = *b.partitionKey } bin, err := msg.MarshalBinary() @@ -110,10 +130,10 @@ func (mb *EventDataBatch) addAMQPMessage(msg *amqp.Message) error { return err } - mb.mu.Lock() - defer mb.mu.Unlock() + b.mu.Lock() + defer b.mu.Unlock() - if len(mb.marshaledMessages) == 0 { + if len(b.marshaledMessages) == 0 { // the first message is special - we use its properties and annotations as the // actual envelope for the batch message. batchEnv, batchEnvLen, err := createBatchEnvelope(msg) @@ -123,24 +143,24 @@ func (mb *EventDataBatch) addAMQPMessage(msg *amqp.Message) error { } // (we'll undo this if it turns out the message was too big) - mb.currentSize = uint64(batchEnvLen) - mb.batchEnvelope = batchEnv + b.currentSize = uint64(batchEnvLen) + b.batchEnvelope = batchEnv } actualPayloadSize := calcActualSizeForPayload(bin) - if mb.currentSize+actualPayloadSize > mb.maxBytes { - if len(mb.marshaledMessages) == 0 { + if b.currentSize+actualPayloadSize > b.maxBytes { + if len(b.marshaledMessages) == 0 { // reset our our properties, this didn't end up being our first message. - mb.currentSize = 0 - mb.batchEnvelope = nil + b.currentSize = 0 + b.batchEnvelope = nil } return ErrEventDataTooLarge } - mb.currentSize += actualPayloadSize - mb.marshaledMessages = append(mb.marshaledMessages, bin) + b.currentSize += actualPayloadSize + b.marshaledMessages = append(b.marshaledMessages, bin) return nil } @@ -177,9 +197,9 @@ func calcActualSizeForPayload(payload []byte) uint64 { return uint64(vbin32Overhead + len(payload)) } -func newEventDataBatch(sender amqpwrap.AMQPSenderCloser, options *NewEventDataBatchOptions) (*EventDataBatch, error) { +func newEventDataBatch(sender amqpwrap.AMQPSenderCloser, options *EventDataBatchOptions) (*EventDataBatch, error) { if options == nil { - options = &NewEventDataBatchOptions{} + options = &EventDataBatchOptions{} } if options.PartitionID != nil && options.PartitionKey != nil { diff --git a/sdk/messaging/azeventhubs/event_data_batch_unit_test.go b/sdk/messaging/azeventhubs/event_data_batch_unit_test.go index dab0a16a026d..13c5ed6b07c8 100644 --- a/sdk/messaging/azeventhubs/event_data_batch_unit_test.go +++ b/sdk/messaging/azeventhubs/event_data_batch_unit_test.go @@ -42,7 +42,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { link := eventBatchLinkForTest{maxMessageSize: 10000} t.Run("default: uses link size", func(t *testing.T) { - batch, err := newEventDataBatch(link, &NewEventDataBatchOptions{}) + batch, err := newEventDataBatch(link, &EventDataBatchOptions{}) require.NoError(t, err) require.NotNil(t, batch) require.Equal(t, link.MaxMessageSize(), batch.maxBytes) @@ -58,7 +58,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("custom size", func(t *testing.T) { - batch, err := newEventDataBatch(link, &NewEventDataBatchOptions{ + batch, err := newEventDataBatch(link, &EventDataBatchOptions{ MaxBytes: 9, }) require.NoError(t, err) @@ -67,13 +67,13 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("requested size is bigger than allowed size", func(t *testing.T) { - batch, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: link.maxMessageSize + 1}) + batch, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: link.maxMessageSize + 1}) require.EqualError(t, err, fmt.Sprintf("maximum message size for batch was set to %d bytes, which is larger than the maximum size allowed by link (%d)", link.maxMessageSize+1, link.MaxMessageSize())) require.Nil(t, batch) }) t.Run("partition key", func(t *testing.T) { - batch, err := newEventDataBatch(link, &NewEventDataBatchOptions{ + batch, err := newEventDataBatch(link, &EventDataBatchOptions{ PartitionKey: to.Ptr("hello-partition-key"), }) require.NoError(t, err) @@ -84,7 +84,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("partition ID", func(t *testing.T) { - batch, err := newEventDataBatch(link, &NewEventDataBatchOptions{ + batch, err := newEventDataBatch(link, &EventDataBatchOptions{ PartitionID: to.Ptr("101"), }) require.NoError(t, err) @@ -97,7 +97,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { as2k := [2048]byte{'A'} t.Run("sizeCalculationsAreCorrectVBin8", func(t *testing.T) { - mb, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: 8000}) + mb, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: 8000}) require.NoError(t, err) err = mb.AddEventData(&EventData{ @@ -118,7 +118,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("sizeCalculationsAreCorrectVBin32", func(t *testing.T) { - mb, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: 8000}) + mb, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: 8000}) require.NoError(t, err) err = mb.AddEventData(&EventData{ @@ -144,7 +144,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { // the first message gets special treatment since it gets used as the actual // batch message's envelope. t.Run("firstMessageTooLarge", func(t *testing.T) { - mb, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: 1}) + mb, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: 1}) require.NoError(t, err) err = mb.AddEventData(&EventData{ @@ -158,7 +158,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("addTooManyMessages", func(t *testing.T) { - mb, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: 200}) + mb, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: 200}) require.NoError(t, err) require.EqualValues(t, 0, mb.currentSize) @@ -181,7 +181,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) { }) t.Run("addConcurrently", func(t *testing.T) { - mb, err := newEventDataBatch(link, &NewEventDataBatchOptions{MaxBytes: 10000}) + mb, err := newEventDataBatch(link, &EventDataBatchOptions{MaxBytes: 10000}) require.NoError(t, err) wg := sync.WaitGroup{} diff --git a/sdk/messaging/azeventhubs/event_data_test.go b/sdk/messaging/azeventhubs/event_data_test.go index 2cf04314f463..bbc25e4cdcdd 100644 --- a/sdk/messaging/azeventhubs/event_data_test.go +++ b/sdk/messaging/azeventhubs/event_data_test.go @@ -86,7 +86,7 @@ func TestEventData_newReceivedEventData(t *testing.T) { "application property 1": "application property value 1", } - require.Equal(t, &ReceivedEventData{ + expectedEventData := &ReceivedEventData{ EventData: EventData{ Body: expectedBody[0], ContentType: to.Ptr("content type"), @@ -101,7 +101,30 @@ func TestEventData_newReceivedEventData(t *testing.T) { }, Offset: to.Ptr[int64](102), PartitionKey: to.Ptr("partition key"), - }, re) + RawAMQPMessage: &AMQPAnnotatedMessage{ + Properties: &AMQPAnnotatedMessageProperties{ + ContentType: to.Ptr("content type"), + MessageID: "message id", + CorrelationID: to.Ptr("correlation id"), + }, + Body: AMQPAnnotatedMessageBody{ + Data: [][]byte{[]byte("hello world")}, + }, + ApplicationProperties: map[string]any{ + "application property 1": "application property value 1", + }, + MessageAnnotations: map[any]any{ + "hello": "world", + 5: "ignored", + "x-opt-partition-key": "partition key", + "x-opt-sequence-number": int64(101), + "x-opt-offset": "102", + "x-opt-enqueued-time": now, + }, + }, + } + + require.Equal(t, expectedEventData, re) require.Equal(t, &amqp.Message{ Properties: &amqp.MessageProperties{ diff --git a/sdk/messaging/azeventhubs/example_consuming_events_test.go b/sdk/messaging/azeventhubs/example_consuming_events_test.go index a8185e4bdf9a..84742b8c726a 100644 --- a/sdk/messaging/azeventhubs/example_consuming_events_test.go +++ b/sdk/messaging/azeventhubs/example_consuming_events_test.go @@ -13,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs" ) -func Example_consuming_events() { +func Example_consumingEventsUsingConsumerClient() { eventHubNamespace := os.Getenv("EVENTHUB_NAMESPACE") // eventHubName := os.Getenv("EVENTHUB_NAME") eventHubPartitionID := os.Getenv("EVENTHUB_PARTITION") @@ -36,20 +36,20 @@ func Example_consuming_events() { defer consumerClient.Close(context.TODO()) - subscription, err := consumerClient.NewPartitionClient(eventHubPartitionID, nil) + partitionClient, err := consumerClient.NewPartitionClient(eventHubPartitionID, nil) if err != nil { panic(err) } - defer subscription.Close(context.TODO()) + defer partitionClient.Close(context.TODO()) for { // ReceiveEvents will wait until it either receives the # of events requested (100, in this call) // or if the context is cancelled, in which case it'll return any messages it has received. ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - events, err := subscription.ReceiveEvents(ctx, 100, nil) + events, err := partitionClient.ReceiveEvents(ctx, 100, nil) cancel() if err != nil { diff --git a/sdk/messaging/azeventhubs/example_processor_test.go b/sdk/messaging/azeventhubs/example_processor_test.go index 382369c90ab6..512b0dd128d1 100644 --- a/sdk/messaging/azeventhubs/example_processor_test.go +++ b/sdk/messaging/azeventhubs/example_processor_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/exported" ) -func Example_consuming_events_using_processor() { +func Example_consumingEventsUsingProcessor() { // The Processor makes it simpler to do distributed consumption of an Event Hub. // It automatically coordinates with other Processor instances to ensure balanced // allocation of partitions and tracks status, durably, in a CheckpointStore. @@ -30,6 +30,7 @@ func Example_consuming_events_using_processor() { containerName := os.Getenv("CHECKPOINTSTORE_STORAGE_CONTAINER_NAME") // Create the checkpoint store + // // NOTE: the Blob container must exist before the checkpoint store can be used. checkpointStore, err := checkpoints.NewBlobStoreFromConnectionString(storageCS, containerName, nil) @@ -37,28 +38,48 @@ func Example_consuming_events_using_processor() { panic(err) } + // Create a ConsumerClient + // + // The Processor (created below) will use this to create any PartitionClient instances, as ownership + // is assigned. consumerClient, err := azeventhubs.NewConsumerClientFromConnectionString(ehCS, eventHubName, azeventhubs.DefaultConsumerGroup, nil) if err != nil { panic(err) } + defer consumerClient.Close(context.TODO()) + + // Create the Processor + // + // The Processor handles load balancing with other Processor instances, running in separate + // processes or even on separate machines. Each one will use the checkpointStore to coordinate + // state and ownership, dynamically. processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, nil) if err != nil { panic(err) } - dispatchProcessors := func() { - // Loop continually - each time we acquire a new partition NextPartitionClient() will - // return it. + // This function will be launched in a goroutine and will loop and launch + // processing of partitions, in parallel. + dispatchPartitionClients := func() { + // Our loop will terminate when: + // - You cancel the passed in context + // - The Processor.Run() call is cancelled or terminates. for { partitionClient := processor.NextPartitionClient(context.TODO()) if partitionClient == nil { + // this happens if Processor.Run terminates or if you cancel + // the passed in context. break } + // Each time you get a ProcessorPartitionClient, you are the + // exclusive owner. The previous owner (if there was one) will get an + // *azeventhubs.Error from their next call to PartitionClient.ReceiveEvents() + // with a Code of CodeOwnershipLost. go func() { if err := processEvents(partitionClient); err != nil { panic(err) @@ -67,44 +88,59 @@ func Example_consuming_events_using_processor() { } } - go dispatchProcessors() + go dispatchPartitionClients() + // This context will control the lifetime of the Processor.Run call. + // When it is cancelled the processor will stop running and also close + // any ProcessorPartitionClient's it opened while running. processorCtx, processorCancel := context.WithCancel(context.TODO()) defer processorCancel() - // Launch the load balancer. The dispatchProcessors() goroutine, launched - // above, will continually receive ProcessorPartitionClients as partitions + // Run the load balancer. The dispatchPartitionClients goroutine, launched + // above, will continually get new ProcessorPartitionClient's as partitions // are allocated. // - // To stop the processor cancel the context that you passed in to Run(). + // Stopping the processor is as simple as canceling the context that you passed + // in to Run. if err := processor.Run(processorCtx); err != nil { panic(err) } } func processEvents(partitionClient *azeventhubs.ProcessorPartitionClient) error { - // initialize any resources needed to process the partition - // This is the equivalent to PartitionOpen + // In other models of the Processor we have broken up the partition + // lifecycle model. + // + // In Go, we model this as a function call with a loop, using this structure: + // + // 1. [BEGIN] Initialize any partition specific resources. + // 2. [CONTINUOUS] Run a loop, calling ReceiveEvents() and UpdateCheckpoint(). + // 3. [END] Close any resources associated with the processor. - defer func() { - // Do cleanup here, like shutting down database connections - // or other resources used for processing this partition. - partitionClient.Close(context.TODO()) - }() + // [END] Do cleanup here, like shutting down database connections + // or other resources used for processing this partition. + defer closePartitionResources(partitionClient) + // [BEGIN] Initialize any resources needed to process the partition + if err := initializePartitionResources(partitionClient.PartitionID()); err != nil { + return err + } + + // [CONTINUOUS] loop until you lose ownership or your own criteria, checkpointing + // as needed using UpdateCheckpoint. for { - // wait for a minute for up to 100 events to arrive. + // Wait for a minute (controlled by the receiveCtx) or for 100 events to arrive. receiveCtx, receiveCtxCancel := context.WithTimeout(context.TODO(), time.Minute) events, err := partitionClient.ReceiveEvents(receiveCtx, 100, nil) receiveCtxCancel() + // Timing out (context.DeadlineExceeded) is fine. We didn't receive our 100 events + // but we might have received _some_ events. if err != nil && !errors.Is(err, context.DeadlineExceeded) { if eventHubError := (*azeventhubs.Error)(nil); errors.As(err, &eventHubError) && eventHubError.Code == exported.CodeOwnershipLost { // This means that the partition was "stolen" - this can happen as partitions are balanced between - // consumers. - - // the 'defer'd function we did above will take of any resource cleanup so we'll just exit the - // function at this point. + // consumers. We'll exit here and just let our "defer closePartitionResources" handle closing + // resources, including the ProcessorPartitionClient. return nil } @@ -118,12 +154,26 @@ func processEvents(partitionClient *azeventhubs.ProcessorPartitionClient) error fmt.Printf("Event received with body %v\n", event.Body) } + // it's possible to get zero events if the partition is empty, or if no new events have arrived + // since your last receive. if len(events) != 0 { - // Update the checkpoint with the last event received. If the processor is restarted - // it will resume from this point in the partition. + // Update the checkpoint with the last event received. If we lose ownership of this partition or + // have to restart the next owner will start from this point. if err := partitionClient.UpdateCheckpoint(context.TODO(), events[len(events)-1]); err != nil { return err } } } } + +func initializePartitionResources(partitionID string) error { + // initialize things that might be partition specific, like a + // database connection. + return nil +} + +func closePartitionResources(partitionClient *azeventhubs.ProcessorPartitionClient) { + // Each PartitionClient holds onto an external resource and should be closed if you're + // not processing them anymore. + defer partitionClient.Close(context.TODO()) +} diff --git a/sdk/messaging/azeventhubs/example_producerclient_test.go b/sdk/messaging/azeventhubs/example_producerclient_test.go index e7301649ddf1..343650fb59c5 100644 --- a/sdk/messaging/azeventhubs/example_producerclient_test.go +++ b/sdk/messaging/azeventhubs/example_producerclient_test.go @@ -98,6 +98,64 @@ func ExampleEventDataBatch_AddEventData() { } } +func ExampleEventDataBatch_AddEventData_rawAMQPMessages() { + batch, err := producerClient.NewEventDataBatch(context.TODO(), nil) + + if err != nil { + panic(err) + } + + // This is functionally equivalent to EventDataBatch.AddEventData(), just with a more + // advanced message format. + // See ExampleEventDataBatch_AddEventData for more details. + + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + Data: [][]byte{ + []byte("hello"), + []byte("world"), + }, + }, + }, nil) + + if err != nil { + panic(err) + } + + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + Sequence: [][]any{ + // let the AMQP stack encode your strings (or other primitives) for you, no need + // to convert them to bytes manually. + {"hello", "world"}, + {"howdy", "world"}, + }, + }, + }, nil) + + if err != nil { + panic(err) + } + + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + // let the AMQP stack encode your string (or other primitives) for you, no need + // to convert them to bytes manually. + Value: "hello world", + }, + }, nil) + + if err != nil { + panic(err) + } + + err = producerClient.SendEventBatch(context.TODO(), batch, nil) + + if err != nil { + panic(err) + } +} + func ExampleProducerClient_GetEventHubProperties() { eventHubProps, err := producerClient.GetEventHubProperties(context.TODO(), nil) diff --git a/sdk/messaging/azeventhubs/example_producing_events_test.go b/sdk/messaging/azeventhubs/example_producing_events_test.go index 35222c723d41..72c2e719fb52 100644 --- a/sdk/messaging/azeventhubs/example_producing_events_test.go +++ b/sdk/messaging/azeventhubs/example_producing_events_test.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs" ) -func Example_producing() { +func Example_producingEventsUsingProducerClient() { eventHubNamespace := os.Getenv("EVENTHUB_NAMESPACE") // eventHubName := os.Getenv("EVENTHUB_NAME") @@ -36,18 +36,20 @@ func Example_producing() { events := createEventsForSample() - // Other examples: + // Other options you might consider: + // + // Targeting a batch to a specific partition // - // sending a batch to a specific partition: // batch, err := producerClient.NewEventDataBatch(context.TODO(), &azeventhubs.NewEventDataBatchOptions{ // PartitionID: to.Ptr("0"), // }) // - // targeting a batch using a partition key + // Targeting a batch using a partition key + // // batch, err := producerClient.NewEventDataBatch(context.TODO(), &azeventhubs.NewEventDataBatchOptions{ // PartitionKey: to.Ptr("partition key"), // }) - newBatchOptions := &azeventhubs.NewEventDataBatchOptions{} + newBatchOptions := &azeventhubs.EventDataBatchOptions{} batch, err := producerClient.NewEventDataBatch(context.TODO(), newBatchOptions) diff --git a/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_processor_stress.go b/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_processor_stress.go index 820262b86e47..623d18038ea6 100644 --- a/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_processor_stress.go +++ b/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_processor_stress.go @@ -73,7 +73,7 @@ func FiniteProcessorTest(ctx context.Context) error { defer producerClient.Close(ctx) - err = initCheckpointStore(ctx, producerClient, azeventhubs.CheckpointStoreAddress{ + err = initCheckpointStore(ctx, producerClient, azeventhubs.Checkpoint{ ConsumerGroup: azeventhubs.DefaultConsumerGroup, FullyQualifiedNamespace: testData.Namespace, EventHubName: testData.HubName, @@ -93,7 +93,7 @@ func FiniteProcessorTest(ctx context.Context) error { return err } - processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.NewProcessorOptions{ + processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.ProcessorOptions{ LoadBalancingStrategy: azeventhubs.ProcessorStrategyGreedy, }) diff --git a/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_send_and_receive.go b/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_send_and_receive.go index 648fe15f84fb..89e98532c691 100644 --- a/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_send_and_receive.go +++ b/sdk/messaging/azeventhubs/internal/eh/stress/tests/finite_send_and_receive.go @@ -104,7 +104,7 @@ func consumeEventsFromPartition(ctx context.Context, consumerClient *azeventhubs // read in 10 second chunks. If we ever end a 10 second chunk with no messages // then we've probably just failed. - partitionClient, err := consumerClient.NewPartitionClient(partitionID, &azeventhubs.NewPartitionClientOptions{ + partitionClient, err := consumerClient.NewPartitionClient(partitionID, &azeventhubs.PartitionClientOptions{ StartPosition: startPosition, }) diff --git a/sdk/messaging/azeventhubs/internal/eh/stress/tests/infinite_processor.go b/sdk/messaging/azeventhubs/internal/eh/stress/tests/infinite_processor.go index 659576a57e6a..5fe86c7a5609 100644 --- a/sdk/messaging/azeventhubs/internal/eh/stress/tests/infinite_processor.go +++ b/sdk/messaging/azeventhubs/internal/eh/stress/tests/infinite_processor.go @@ -104,7 +104,7 @@ func InfiniteProcessorTest(ctx context.Context) error { defer consumerClient.Close(ctx) - processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.NewProcessorOptions{ + processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.ProcessorOptions{ LoadBalancingStrategy: azeventhubs.ProcessorStrategyGreedy, }) @@ -184,7 +184,7 @@ func continuallySendEvents(ctx context.Context, producerClient *azeventhubs.Prod default: } - batch, err := producerClient.NewEventDataBatch(ctx, &azeventhubs.NewEventDataBatchOptions{ + batch, err := producerClient.NewEventDataBatch(ctx, &azeventhubs.EventDataBatchOptions{ PartitionID: &partitionID, }) @@ -261,7 +261,7 @@ func testInitialize(ctx context.Context, testData *stressTestData, containerName defer producerClient.Close(ctx) - err = initCheckpointStore(ctx, producerClient, azeventhubs.CheckpointStoreAddress{ + err = initCheckpointStore(ctx, producerClient, azeventhubs.Checkpoint{ ConsumerGroup: azeventhubs.DefaultConsumerGroup, FullyQualifiedNamespace: testData.Namespace, EventHubName: testData.HubName, diff --git a/sdk/messaging/azeventhubs/internal/eh/stress/tests/shared.go b/sdk/messaging/azeventhubs/internal/eh/stress/tests/shared.go index de431b67d6bd..413c474c4b85 100644 --- a/sdk/messaging/azeventhubs/internal/eh/stress/tests/shared.go +++ b/sdk/messaging/azeventhubs/internal/eh/stress/tests/shared.go @@ -119,7 +119,7 @@ func sendEventsToPartition(ctx context.Context, producerClient *azeventhubs.Prod extraBytes := make([]byte, numExtraBytes) - batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: &partitionID, }) @@ -152,7 +152,7 @@ func sendEventsToPartition(ctx context.Context, producerClient *azeventhubs.Prod return azeventhubs.StartPosition{}, err } - tempBatch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + tempBatch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: &partitionID, }) @@ -197,7 +197,7 @@ func sendEventsToPartition(ctx context.Context, producerClient *azeventhubs.Prod return sp, nil } -func initCheckpointStore(ctx context.Context, client propertiesClient, baseAddress azeventhubs.CheckpointStoreAddress, cps azeventhubs.CheckpointStore) error { +func initCheckpointStore(ctx context.Context, client propertiesClient, baseCheckpoint azeventhubs.Checkpoint, cps azeventhubs.CheckpointStore) error { hubProps, err := client.GetEventHubProperties(ctx, nil) if err != nil { @@ -211,23 +211,18 @@ func initCheckpointStore(ctx context.Context, client propertiesClient, baseAddre return err } - newAddress := baseAddress - newAddress.PartitionID = partitionID - - var checkpointData azeventhubs.CheckpointData + newCheckpoint := baseCheckpoint + newCheckpoint.PartitionID = partitionID if partProps.IsEmpty { - checkpointData.Offset = to.Ptr[int64](-1) - checkpointData.SequenceNumber = to.Ptr[int64](0) + newCheckpoint.Offset = to.Ptr[int64](-1) + newCheckpoint.SequenceNumber = to.Ptr[int64](0) } else { - checkpointData.Offset = &partProps.LastEnqueuedOffset - checkpointData.SequenceNumber = &partProps.LastEnqueuedSequenceNumber + newCheckpoint.Offset = &partProps.LastEnqueuedOffset + newCheckpoint.SequenceNumber = &partProps.LastEnqueuedSequenceNumber } - err = cps.UpdateCheckpoint(ctx, azeventhubs.Checkpoint{ - CheckpointStoreAddress: newAddress, - CheckpointData: checkpointData, - }, nil) + err = cps.UpdateCheckpoint(ctx, newCheckpoint, nil) if err != nil { return err diff --git a/sdk/messaging/azeventhubs/internal/exported/new_websocket_conn_args.go b/sdk/messaging/azeventhubs/internal/exported/new_websocket_conn_args.go index a8735774e19e..8cd269ec5357 100644 --- a/sdk/messaging/azeventhubs/internal/exported/new_websocket_conn_args.go +++ b/sdk/messaging/azeventhubs/internal/exported/new_websocket_conn_args.go @@ -5,9 +5,9 @@ package exported // NOTE: this struct is exported via client.go:NewWebSocketConnArgs -// NewWebSocketConnArgs are the arguments to the NewWebSocketConn function you pass if you want +// WebSocketConnArgs are the arguments to the NewWebSocketConn function you pass if you want // to enable websockets. -type NewWebSocketConnArgs struct { +type WebSocketConnArgs struct { // Host is the the `wss://` to connect to Host string } diff --git a/sdk/messaging/azeventhubs/internal/namespace.go b/sdk/messaging/azeventhubs/internal/namespace.go index 074577ccf30f..940554023a17 100644 --- a/sdk/messaging/azeventhubs/internal/namespace.go +++ b/sdk/messaging/azeventhubs/internal/namespace.go @@ -43,7 +43,7 @@ type ( tlsConfig *tls.Config userAgent string - newWebSocketConn func(ctx context.Context, args exported.NewWebSocketConnArgs) (net.Conn, error) + newWebSocketConn func(ctx context.Context, args exported.WebSocketConnArgs) (net.Conn, error) // NOTE: exported only so it can be checked in a test RetryOptions exported.RetryOptions @@ -117,7 +117,7 @@ func NamespaceWithUserAgent(userAgent string) NamespaceOption { } // NamespaceWithWebSocket configures the namespace and all entities to use wss:// rather than amqps:// -func NamespaceWithWebSocket(newWebSocketConn func(ctx context.Context, args exported.NewWebSocketConnArgs) (net.Conn, error)) NamespaceOption { +func NamespaceWithWebSocket(newWebSocketConn func(ctx context.Context, args exported.WebSocketConnArgs) (net.Conn, error)) NamespaceOption { return func(ns *Namespace) error { ns.newWebSocketConn = newWebSocketConn return nil @@ -175,7 +175,7 @@ func (ns *Namespace) newClientImpl(ctx context.Context) (amqpwrap.AMQPClient, er } if ns.newWebSocketConn != nil { - nConn, err := ns.newWebSocketConn(ctx, exported.NewWebSocketConnArgs{ + nConn, err := ns.newWebSocketConn(ctx, exported.WebSocketConnArgs{ Host: ns.getWSSHostURI() + "$servicebus/websocket", }) diff --git a/sdk/messaging/azeventhubs/internal/test/test_helpers.go b/sdk/messaging/azeventhubs/internal/test/test_helpers.go index 5a7ea4d23eb6..1158cb1328f7 100644 --- a/sdk/messaging/azeventhubs/internal/test/test_helpers.go +++ b/sdk/messaging/azeventhubs/internal/test/test_helpers.go @@ -4,6 +4,7 @@ package test import ( + "context" "crypto/rand" "encoding/hex" "fmt" @@ -138,3 +139,9 @@ func mustGetEnvironmentVars(t *testing.T, names []string) map[string]string { return envVars } + +func RequireClose(t *testing.T, closeable interface { + Close(ctx context.Context) error +}) { + require.NoError(t, closeable.Close(context.Background())) +} diff --git a/sdk/messaging/azeventhubs/partition_client.go b/sdk/messaging/azeventhubs/partition_client.go index 737e6ccd297b..8f5121c9db79 100644 --- a/sdk/messaging/azeventhubs/partition_client.go +++ b/sdk/messaging/azeventhubs/partition_client.go @@ -21,6 +21,8 @@ const DefaultConsumerGroup = "$Default" // StartPosition indicates the position to start receiving events within a partition. // The default position is Latest. +// +// You can set this in the options for ConsumerClient. type StartPosition struct { // Offset will start the consumer after the specified offset. Can be exclusive // or inclusive, based on the Inclusive property. @@ -48,6 +50,8 @@ type StartPosition struct { } // PartitionClient is used to receive events from an Event Hub partition. +// +// This type is instantiated from the [ConsumerClient] type, using [ConsumerClient.NewPartitionClient]. type PartitionClient struct { retryOptions RetryOptions eventHub string @@ -128,7 +132,7 @@ func (cc *PartitionClient) ReceiveEvents(ctx context.Context, count int, options return events, nil } -// Close closes the consumer's link and the underlying AMQP connection. +// Close releases resources for this client. func (cc *PartitionClient) Close(ctx context.Context) error { if cc.links != nil { return cc.links.Close(ctx) @@ -186,9 +190,9 @@ type partitionClientArgs struct { retryOptions RetryOptions } -func newPartitionClient(args partitionClientArgs, options *NewPartitionClientOptions) (*PartitionClient, error) { +func newPartitionClient(args partitionClientArgs, options *PartitionClientOptions) (*PartitionClient, error) { if options == nil { - options = &NewPartitionClientOptions{} + options = &PartitionClientOptions{} } offsetExpr, err := getOffsetExpression(options.StartPosition) diff --git a/sdk/messaging/azeventhubs/processor.go b/sdk/messaging/azeventhubs/processor.go index 05124b4dd2fa..7970cdb0829e 100644 --- a/sdk/messaging/azeventhubs/processor.go +++ b/sdk/messaging/azeventhubs/processor.go @@ -27,9 +27,9 @@ const ( ProcessorStrategyGreedy ProcessorStrategy = "greedy" ) -// NewProcessorOptions are the options for the NewProcessor +// ProcessorOptions are the options for the NewProcessor // function. -type NewProcessorOptions struct { +type ProcessorOptions struct { // LoadBalancingStrategy dictates how concurrent Processor instances distribute // ownership of partitions between them. // The default strategy is ProcessorStrategyBalanced. @@ -69,8 +69,14 @@ type StartPositions struct { Default StartPosition } -// Processor uses a CheckpointStore, combined with a ConsumerClient, to provide -// automatic load balancing betweeen multiple consumers. +// Processor uses a ConsumerClient and CheckpointStore to provide automatic +// load balancing between multiple Processor instances, even in separate +// processes or on separate machines. +// +// See [example_processor_test.go] for an example of typical usage or Run +// for a more detailed description of how load balancing works. +// +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go type Processor struct { ownershipUpdateInterval time.Duration defaultStartPositions StartPositions @@ -90,18 +96,23 @@ type Processor struct { type consumerClientForProcessor interface { GetEventHubProperties(ctx context.Context, options *GetEventHubPropertiesOptions) (EventHubProperties, error) - NewPartitionClient(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) + NewPartitionClient(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) getDetails() consumerClientDetails } // NewProcessor creates a Processor. -func NewProcessor(consumerClient *ConsumerClient, checkpointStore CheckpointStore, options *NewProcessorOptions) (*Processor, error) { +// +// More information can be found in the documentation for the [azeventhubs.Processor] +// type or the [example_processor_test.go] for an example. +// +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go +func NewProcessor(consumerClient *ConsumerClient, checkpointStore CheckpointStore, options *ProcessorOptions) (*Processor, error) { return newProcessorImpl(consumerClient, checkpointStore, options) } -func newProcessorImpl(consumerClient consumerClientForProcessor, checkpointStore CheckpointStore, options *NewProcessorOptions) (*Processor, error) { +func newProcessorImpl(consumerClient consumerClientForProcessor, checkpointStore CheckpointStore, options *ProcessorOptions) (*Processor, error) { if options == nil { - options = &NewProcessorOptions{} + options = &ProcessorOptions{} } updateInterval := 10 * time.Second @@ -153,13 +164,15 @@ func newProcessorImpl(consumerClient consumerClientForProcessor, checkpointStore }, nil } -// NextPartitionClient will get the next available azeventhubs.PartitionProcessorClient if -// a partition is available or will block until a new one arrives or processor.Run() is -// cancelled. +// NextPartitionClient will get the next owned [PartitionProcessorClient] if one is acquired +// or will block until a new one arrives or [processor.Run] is cancelled. You MUST call [azeventhubs.ProcessorPartitionClient.Close] on the returned client to avoid leaking resources. // -// NOTE: this function will not return any values until processor.Run() is executing. If the -// Run() function is cancelled (or if this function is cancelled) the returned -// ProcessorPartitionClient will be nil. +// This function is safe to call before [processor.Run] has been called and will typically +// be executed in a goroutine in a loop. +// +// See [example_processor_test.go] for an example of typical usage. +// +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go func (p *Processor) NextPartitionClient(ctx context.Context) *ProcessorPartitionClient { <-p.runCalled @@ -171,11 +184,16 @@ func (p *Processor) NextPartitionClient(ctx context.Context) *ProcessorPartition } } -// Run runs the load balancing loop. Partitions that are claimed can be read using the -// DistributedPartitionClient returned from processor.Next(). +// Run handles the load balancing loop, blocking until the passed in context is cancelled +// or it encounters an unrecoverable error. On cancellation, it will return a nil error. +// +// As partitions are claimed new [ProcessorPartitionClient] instances will be returned from +// [Processor.NextPartitionClient]. This can happen at any time, based on new Processor instances +// coming online, as well as other Processors exiting. +// +// See [example_processor_test.go] for an example of typical usage. // -// NOTE: If this function is cancelled the load balancing loop is cancelled and a nil error -// is returned. processor.NextPartitionClient() will return nil. +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go func (p *Processor) Run(ctx context.Context) error { err := p.runImpl(ctx) @@ -299,7 +317,7 @@ func (p *Processor) addPartitionClient(ctx context.Context, ownership Ownership, return err } - partClient, err := p.consumerClient.NewPartitionClient(ownership.PartitionID, &NewPartitionClientOptions{ + partClient, err := p.consumerClient.NewPartitionClient(ownership.PartitionID, &PartitionClientOptions{ StartPosition: sp, OwnerLevel: &p.ownerLevel, }) diff --git a/sdk/messaging/azeventhubs/processor_load_balancer.go b/sdk/messaging/azeventhubs/processor_load_balancer.go index 30949256f8d9..f986fb7d1296 100644 --- a/sdk/messaging/azeventhubs/processor_load_balancer.go +++ b/sdk/messaging/azeventhubs/processor_load_balancer.go @@ -139,17 +139,13 @@ func (lb *processorLoadBalancer) getAvailablePartitions(ctx context.Context, par } unownedOrExpired = append(unownedOrExpired, Ownership{ - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: lb.details.FullyQualifiedNamespace, - ConsumerGroup: lb.details.ConsumerGroup, - EventHubName: lb.details.EventHubName, - PartitionID: partID, - }, - OwnershipData: OwnershipData{ - OwnerID: lb.details.ClientID, - // note that we don't have etag info here since nobody has - // ever owned this partition. - }, + FullyQualifiedNamespace: lb.details.FullyQualifiedNamespace, + ConsumerGroup: lb.details.ConsumerGroup, + EventHubName: lb.details.EventHubName, + PartitionID: partID, + OwnerID: lb.details.ClientID, + // note that we don't have etag info here since nobody has + // ever owned this partition. }) } diff --git a/sdk/messaging/azeventhubs/processor_load_balancers_test.go b/sdk/messaging/azeventhubs/processor_load_balancers_test.go index df01ea9d4c3d..ee9b56a86ded 100644 --- a/sdk/messaging/azeventhubs/processor_load_balancers_test.go +++ b/sdk/messaging/azeventhubs/processor_load_balancers_test.go @@ -311,15 +311,11 @@ const testEventHubName = "event-hub" func newTestOwnership(partitionID string, ownerID string) Ownership { return Ownership{ - OwnershipData: OwnershipData{ - OwnerID: ownerID, - }, - CheckpointStoreAddress: CheckpointStoreAddress{ - PartitionID: partitionID, - ConsumerGroup: testConsumerGroup, - EventHubName: testEventHubName, - FullyQualifiedNamespace: testEventHubFQDN, - }, + OwnerID: ownerID, + PartitionID: partitionID, + ConsumerGroup: testConsumerGroup, + EventHubName: testEventHubName, + FullyQualifiedNamespace: testEventHubFQDN, } } diff --git a/sdk/messaging/azeventhubs/processor_partition_client.go b/sdk/messaging/azeventhubs/processor_partition_client.go index 0131774304da..5bd981ca5c83 100644 --- a/sdk/messaging/azeventhubs/processor_partition_client.go +++ b/sdk/messaging/azeventhubs/processor_partition_client.go @@ -7,7 +7,15 @@ import "context" // ProcessorPartitionClient allows you to receive events, similar to a PartitionClient, with // integration into a checkpoint store for tracking progress. -// NOTE: This type is instantiated using the Processor type, which handles dynamic load balancing. +// +// This type is instantiated from the Processor type, which handles dynamic load balancing. +// +// See [example_processor_test.go] for an example of typical usage. +// +// NOTE: If you do NOT want to use dynamic load balancing, and would prefer to track state and ownership +// manually, use the [ConsumerClient] type instead. +// +// [example_processor_test.go]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/example_processor_test.go type ProcessorPartitionClient struct { partitionID string innerClient *PartitionClient // *azeventhubs.PartitionClient @@ -22,30 +30,26 @@ func (c *ProcessorPartitionClient) ReceiveEvents(ctx context.Context, count int, return c.innerClient.ReceiveEvents(ctx, count, options) } -// UpdateCheckpoint updates the checkpoint store. -// The next time a client loads, using the checkpoint store, it will start from the event _after_ the latestEvent. +// UpdateCheckpoint updates the checkpoint store. This ensure that if the Processor is restarted it will +// start from after this point. func (p *ProcessorPartitionClient) UpdateCheckpoint(ctx context.Context, latestEvent *ReceivedEventData) error { return p.checkpointStore.UpdateCheckpoint(ctx, Checkpoint{ - CheckpointStoreAddress: CheckpointStoreAddress{ - ConsumerGroup: p.consumerClientDetails.ConsumerGroup, - EventHubName: p.consumerClientDetails.EventHubName, - FullyQualifiedNamespace: p.consumerClientDetails.FullyQualifiedNamespace, - PartitionID: p.partitionID, - }, - CheckpointData: CheckpointData{ - SequenceNumber: &latestEvent.SequenceNumber, - Offset: latestEvent.Offset, - }, + ConsumerGroup: p.consumerClientDetails.ConsumerGroup, + EventHubName: p.consumerClientDetails.EventHubName, + FullyQualifiedNamespace: p.consumerClientDetails.FullyQualifiedNamespace, + PartitionID: p.partitionID, + SequenceNumber: &latestEvent.SequenceNumber, + Offset: latestEvent.Offset, }, nil) } // PartitionID is the partition ID of the partition we're receiving from. -// This will not change. +// This will not change during the lifetime of this ProcessorPartitionClient. func (p *ProcessorPartitionClient) PartitionID() string { return p.partitionID } -// Close closes the partition client. +// Close releases resources for the partition client. // This does not close the ConsumerClient that the Processor was started with. func (c *ProcessorPartitionClient) Close(ctx context.Context) error { c.cleanupFn() diff --git a/sdk/messaging/azeventhubs/processor_test.go b/sdk/messaging/azeventhubs/processor_test.go index 60f6b14df59d..df651b8c7b74 100644 --- a/sdk/messaging/azeventhubs/processor_test.go +++ b/sdk/messaging/azeventhubs/processor_test.go @@ -95,7 +95,7 @@ func TestProcessor_Contention(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) - processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.NewProcessorOptions{ + processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.ProcessorOptions{ UpdateInterval: 10 * time.Second, }) require.NoError(t, err) @@ -219,7 +219,7 @@ func testPartitionAcquisition(t *testing.T, loadBalancerStrategy azeventhubs.Pro require.NoError(t, err) t.Logf("Processor created") - processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.NewProcessorOptions{ + processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.ProcessorOptions{ UpdateInterval: time.Millisecond, LoadBalancingStrategy: loadBalancerStrategy, }) @@ -288,7 +288,7 @@ func testWithLoadBalancer(t *testing.T, loadBalancerStrategy azeventhubs.Process require.NoError(t, err) t.Logf("Processor created") - processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.NewProcessorOptions{ + processor, err := azeventhubs.NewProcessor(consumerClient, checkpointStore, &azeventhubs.ProcessorOptions{ UpdateInterval: time.Millisecond, LoadBalancingStrategy: loadBalancerStrategy, }) @@ -360,7 +360,7 @@ func processEventsForTest(t *testing.T, producerClient *azeventhubs.ProducerClie for i := 0; i < expectedEventsCount/batchSize; i++ { pid := partitionClient.PartitionID() - batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producerClient.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: &pid, }) require.NoError(t, err) diff --git a/sdk/messaging/azeventhubs/processor_unit_test.go b/sdk/messaging/azeventhubs/processor_unit_test.go index ab49491b077a..a8a0f20065b9 100644 --- a/sdk/messaging/azeventhubs/processor_unit_test.go +++ b/sdk/messaging/azeventhubs/processor_unit_test.go @@ -21,14 +21,13 @@ import ( func TestUnit_Processor_loadBalancing(t *testing.T) { cps := newCheckpointStoreForTest() firstProcessor := newProcessorForTest(t, "first-processor", cps) - newAddressForPartition := func(partitionID string) CheckpointStoreAddress { - return CheckpointStoreAddress{ - ConsumerGroup: "consumer-group", - EventHubName: "event-hub", - FullyQualifiedNamespace: "fqdn", - PartitionID: partitionID, - } + newTestOwnership := func(base Ownership) Ownership { + base.ConsumerGroup = "consumer-group" + base.EventHubName = "event-hub" + base.FullyQualifiedNamespace = "fqdn" + return base } + require.Equal(t, ProcessorStrategyBalanced, firstProcessor.lb.strategy) allPartitionIDs := []string{"1", "100", "1001"} @@ -43,21 +42,18 @@ func TestUnit_Processor_loadBalancing(t *testing.T) { require.Equal(t, 3, lbinfo.maxAllowed, "only 1 possible owner (us), so we're allowed all the available partitions") expectedOwnerships := []Ownership{ - { - CheckpointStoreAddress: newAddressForPartition("1"), - OwnershipData: OwnershipData{ - OwnerID: "first-processor", - }}, - { - CheckpointStoreAddress: newAddressForPartition("100"), - OwnershipData: OwnershipData{ - OwnerID: "first-processor", - }}, - { - CheckpointStoreAddress: newAddressForPartition("1001"), - OwnershipData: OwnershipData{ - OwnerID: "first-processor", - }}, + newTestOwnership(Ownership{ + PartitionID: "1", + OwnerID: "first-processor", + }), + newTestOwnership(Ownership{ + PartitionID: "100", + OwnerID: "first-processor", + }), + newTestOwnership(Ownership{ + PartitionID: "1001", + OwnerID: "first-processor", + }), } require.Equal(t, expectedOwnerships, lbinfo.unownedOrExpired) @@ -73,12 +69,10 @@ func TestUnit_Processor_loadBalancing(t *testing.T) { firstProcessorOwnerships, err := firstProcessor.lb.LoadBalance(context.Background(), allPartitionIDs) require.NoError(t, err) - expectedLoadBalancingOwnership := updateDynamicData(t, firstProcessorOwnerships[0], Ownership{ - CheckpointStoreAddress: newAddressForPartition("1001"), - OwnershipData: OwnershipData{ - OwnerID: "first-processor", - }, - }, allPartitionIDs) + expectedLoadBalancingOwnership := updateDynamicData(t, firstProcessorOwnerships[0], newTestOwnership(Ownership{ + PartitionID: "1001", + OwnerID: "first-processor", + }), allPartitionIDs) require.Equal(t, []Ownership{expectedLoadBalancingOwnership}, firstProcessorOwnerships) // at this point this is our state: @@ -102,12 +96,10 @@ func TestUnit_Processor_loadBalancing(t *testing.T) { newProcessorOwnerships, err := secondProcessor.lb.LoadBalance(context.Background(), allPartitionIDs) require.NoError(t, err) - newExpectedLoadBalancingOwnership := updateDynamicData(t, newProcessorOwnerships[0], Ownership{ - CheckpointStoreAddress: newAddressForPartition("1001"), - OwnershipData: OwnershipData{ - OwnerID: "second-processor", - }, - }, allPartitionIDs) + newExpectedLoadBalancingOwnership := updateDynamicData(t, newProcessorOwnerships[0], newTestOwnership(Ownership{ + PartitionID: "1001", + OwnerID: "second-processor", + }), allPartitionIDs) require.Equal(t, []Ownership{newExpectedLoadBalancingOwnership}, newProcessorOwnerships) require.NotEqual(t, newExpectedLoadBalancingOwnership.PartitionID, expectedLoadBalancingOwnership.PartitionID, "partitions should not be assigned twice") @@ -141,7 +133,7 @@ func TestUnit_Processor_loadBalancing(t *testing.T) { func TestUnit_Processor_Run(t *testing.T) { cps := newCheckpointStoreForTest() - processor, err := newProcessorImpl(simpleFakeConsumerClient(), cps, &NewProcessorOptions{ + processor, err := newProcessorImpl(simpleFakeConsumerClient(), cps, &ProcessorOptions{ PartitionExpirationDuration: time.Hour, }) @@ -182,13 +174,13 @@ func TestUnit_Processor_Run_singleConsumerPerPartition(t *testing.T) { ClientID: "my-client-id", }, getEventHubPropertiesResult: ehProps, - newPartitionClientFn: func(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) { + newPartitionClientFn: func(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) { partitionClientsCreated++ return newFakePartitionClient(partitionID, ""), nil }, } - processor, err := newProcessorImpl(cc, cps, &NewProcessorOptions{ + processor, err := newProcessorImpl(cc, cps, &ProcessorOptions{ PartitionExpirationDuration: time.Hour, }) require.NoError(t, err) @@ -233,28 +225,24 @@ func TestUnit_Processor_Run_startPosition(t *testing.T) { cps := newCheckpointStoreForTest() err := cps.UpdateCheckpoint(context.Background(), Checkpoint{ - CheckpointStoreAddress: CheckpointStoreAddress{ - ConsumerGroup: "consumer-group", - EventHubName: "event-hub", - FullyQualifiedNamespace: "fqdn", - PartitionID: "a", - }, - CheckpointData: CheckpointData{ - SequenceNumber: to.Ptr[int64](202), - }, + ConsumerGroup: "consumer-group", + EventHubName: "event-hub", + FullyQualifiedNamespace: "fqdn", + PartitionID: "a", + SequenceNumber: to.Ptr[int64](202), }, nil) require.NoError(t, err) fakeConsumerClient := simpleFakeConsumerClient() - fakeConsumerClient.newPartitionClientFn = func(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) { + fakeConsumerClient.newPartitionClientFn = func(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) { offsetExpr, err := getOffsetExpression(options.StartPosition) require.NoError(t, err) return newFakePartitionClient(partitionID, offsetExpr), nil } - processor, err := newProcessorImpl(fakeConsumerClient, cps, &NewProcessorOptions{ + processor, err := newProcessorImpl(fakeConsumerClient, cps, &ProcessorOptions{ PartitionExpirationDuration: time.Hour, }) require.NoError(t, err) @@ -310,7 +298,7 @@ func TestUnit_Processor_Run_cancellation(t *testing.T) { FullyQualifiedNamespace: "fqdn", ClientID: "my-client-id", }, - }, cps, &NewProcessorOptions{ + }, cps, &ProcessorOptions{ PartitionExpirationDuration: time.Hour, }) @@ -349,7 +337,7 @@ func newProcessorForTest(t *testing.T, clientID string, cps CheckpointStore) *Pr FullyQualifiedNamespace: "fqdn", ClientID: clientID, }, - }, cps, &NewProcessorOptions{ + }, cps, &ProcessorOptions{ PartitionExpirationDuration: time.Hour, }) require.NoError(t, err) @@ -363,7 +351,7 @@ type fakeConsumerClient struct { getEventHubPropertiesErr error partitionClients map[string]newMockPartitionClientResult - newPartitionClientFn func(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) + newPartitionClientFn func(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) } type newMockPartitionClientResult struct { @@ -375,7 +363,7 @@ func (cc *fakeConsumerClient) GetEventHubProperties(ctx context.Context, options return cc.getEventHubPropertiesResult, cc.getEventHubPropertiesErr } -func (cc *fakeConsumerClient) NewPartitionClient(partitionID string, options *NewPartitionClientOptions) (*PartitionClient, error) { +func (cc *fakeConsumerClient) NewPartitionClient(partitionID string, options *PartitionClientOptions) (*PartitionClient, error) { if cc.newPartitionClientFn != nil { return cc.newPartitionClientFn(partitionID, options) } diff --git a/sdk/messaging/azeventhubs/producer_client.go b/sdk/messaging/azeventhubs/producer_client.go index f7d2b4277752..70646f1d6130 100644 --- a/sdk/messaging/azeventhubs/producer_client.go +++ b/sdk/messaging/azeventhubs/producer_client.go @@ -20,8 +20,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/go-amqp" ) -// NewWebSocketConnArgs are passed to your web socket creation function (ClientOptions.NewWebSocketConn) -type NewWebSocketConnArgs = exported.NewWebSocketConnArgs +// WebSocketConnArgs are passed to your web socket creation function (ClientOptions.NewWebSocketConn) +type WebSocketConnArgs = exported.WebSocketConnArgs // RetryOptions represent the options for retries. type RetryOptions = exported.RetryOptions @@ -37,7 +37,7 @@ type ProducerClientOptions struct { // NewWebSocketConn is a function that can create a net.Conn for use with websockets. // For an example, see ExampleNewClient_usingWebsockets() function in example_client_test.go. - NewWebSocketConn func(ctx context.Context, args NewWebSocketConnArgs) (net.Conn, error) + NewWebSocketConn func(ctx context.Context, args WebSocketConnArgs) (net.Conn, error) // RetryOptions controls how often operations are retried from this client and any // Receivers and Senders created from this client. @@ -58,9 +58,13 @@ type ProducerClient struct { // to get event hub properties or partition properties. const anyPartitionID = "" -// NewProducerClient creates a ProducerClient which uses an azcore.TokenCredential for authentication. +// NewProducerClient creates a ProducerClient which uses an azcore.TokenCredential for authentication. You +// MUST call [azeventhubs.ProducerClient.Close] on this client to avoid leaking resources. +// // The fullyQualifiedNamespace is the Event Hubs namespace name (ex: myeventhub.servicebus.windows.net) -// The credential is one of the credentials in the `github.com/Azure/azure-sdk-for-go/sdk/azidentity` package. +// The credential is one of the credentials in the [azidentity] package. +// +// [azidentity]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azidentity func NewProducerClient(fullyQualifiedNamespace string, eventHub string, credential azcore.TokenCredential, options *ProducerClientOptions) (*ProducerClient, error) { return newProducerClientImpl(producerClientCreds{ fullyQualifiedNamespace: fullyQualifiedNamespace, @@ -69,15 +73,19 @@ func NewProducerClient(fullyQualifiedNamespace string, eventHub string, credenti }, options) } -// NewProducerClientFromConnectionString creates a ProducerClient from a connection string. +// NewProducerClientFromConnectionString creates a ProducerClient from a connection string. You +// MUST call [azeventhubs.ProducerClient.Close] on this client to avoid leaking resources. +// +// connectionString can be one of two formats - with or without an EntityPath key. // -// connectionString can be one of the following formats: +// When the connection string does not have an entity path, as shown below, the eventHub parameter cannot +// be empty and should contain the name of your event hub. // -// Connection string, no EntityPath. In this case eventHub cannot be empty. -// ex: Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey= +// Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey= // -// Connection string, has EntityPath. In this case eventHub must be empty. -// ex: Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey=;EntityPath= +// When the connection string DOES have an entity path, as shown below, the eventHub parameter must be empty. +// +// Endpoint=sb://.servicebus.windows.net/;SharedAccessKeyName=;SharedAccessKey=;EntityPath=; func NewProducerClientFromConnectionString(connectionString string, eventHub string, options *ProducerClientOptions) (*ProducerClient, error) { parsedConn, err := parseConn(connectionString, eventHub) @@ -91,10 +99,10 @@ func NewProducerClientFromConnectionString(connectionString string, eventHub str }, options) } -// NewEventDataBatchOptions contains optional parameters for the NewEventDataBatch function -type NewEventDataBatchOptions struct { +// EventDataBatchOptions contains optional parameters for the NewEventDataBatch function +type EventDataBatchOptions struct { // MaxBytes overrides the max size (in bytes) for a batch. - // By default NewMessageBatch will use the max message size provided by the service. + // By default NewEventDataBatch will use the max message size provided by the service. MaxBytes uint64 // PartitionKey is hashed to calculate the partition assignment. Messages and message @@ -107,9 +115,15 @@ type NewEventDataBatchOptions struct { PartitionID *string } -// NewEventDataBatch can be used to create a batch that contain multiple events. -// If the operation fails it can return an *azeventhubs.Error type if the failure is actionable. -func (pc *ProducerClient) NewEventDataBatch(ctx context.Context, options *NewEventDataBatchOptions) (*EventDataBatch, error) { +// NewEventDataBatch can be used to create an EventDataBatch, which can contain multiple +// events. +// +// EventDataBatch contains logic to make sure that the it doesn't exceed the maximum size +// for the Event Hubs link, using it's [azeventhubs.EventDataBatch.AddEventData] function. +// A lower size limit can also be configured through the options. +// +// If the operation fails it can return an azeventhubs.Error type if the failure is actionable. +func (pc *ProducerClient) NewEventDataBatch(ctx context.Context, options *EventDataBatchOptions) (*EventDataBatch, error) { var batch *EventDataBatch partitionID := anyPartitionID @@ -172,7 +186,7 @@ func (pc *ProducerClient) GetEventHubProperties(ctx context.Context, options *Ge return getEventHubProperties(ctx, pc.namespace, rpcLink.Link, pc.eventHub, options) } -// Close closes the producer's AMQP links and the underlying AMQP connection. +// Close releases resources for this client. func (pc *ProducerClient) Close(ctx context.Context) error { if err := pc.links.Close(ctx); err != nil { azlog.Writef(EventProducer, "Failed when closing links while shutting down producer client: %s", err.Error()) diff --git a/sdk/messaging/azeventhubs/producer_client_test.go b/sdk/messaging/azeventhubs/producer_client_test.go index ad3457846c66..9851d613b4e2 100644 --- a/sdk/messaging/azeventhubs/producer_client_test.go +++ b/sdk/messaging/azeventhubs/producer_client_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestNewProducerClient_GetHubAndPartitionProperties(t *testing.T) { +func TestProducerClient_GetHubAndPartitionProperties(t *testing.T) { testParams := test.GetConnectionParamsForTest(t) producer, err := azeventhubs.NewProducerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, nil) @@ -50,7 +50,7 @@ func TestNewProducerClient_GetHubAndPartitionProperties(t *testing.T) { wg.Wait() } -func TestNewProducerClient_GetEventHubsProperties(t *testing.T) { +func TestProducerClient_GetEventHubsProperties(t *testing.T) { testParams := test.GetConnectionParamsForTest(t) producer, err := azeventhubs.NewProducerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, nil) @@ -76,7 +76,7 @@ func TestNewProducerClient_GetEventHubsProperties(t *testing.T) { } } -func TestNewProducerClient_SendToAny(t *testing.T) { +func TestProducerClient_SendToAny(t *testing.T) { // there are two ways to "send to any" partition // 1. Don't specify a partition ID or a partition key when creating the batch // 2. Specify a partition key. This is useful if you want to send events and have them @@ -95,7 +95,7 @@ func TestNewProducerClient_SendToAny(t *testing.T) { producer, err := azeventhubs.NewProducerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, nil) require.NoError(t, err) - batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionKey: partitionKey, }) require.NoError(t, err) @@ -152,10 +152,147 @@ func TestNewProducerClient_SendToAny(t *testing.T) { } } -func makeByteSlice(index int, total int) []byte { - // ie: %0d, so it'll be zero padded up to the length we want - text := fmt.Sprintf("%0"+fmt.Sprintf("%d", total)+"d", index) - return []byte(text) +func TestProducerClient_AMQPAnnotatedMessages(t *testing.T) { + testParams := test.GetConnectionParamsForTest(t) + + producer, err := azeventhubs.NewProducerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, nil) + require.NoError(t, err) + + defer test.RequireClose(t, producer) + + beforeProps, err := producer.GetPartitionProperties(context.Background(), "0", nil) + require.NoError(t, err) + + numEvents := int64(0) + + // send the events we need, encoding several AMQP body types and exercising all the fields. + { + batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ + PartitionID: to.Ptr("0"), + }) + require.NoError(t, err) + + // AMQP messages + + // sequence body + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + Sequence: [][]any{ + {"hello", "world"}, + {"howdy", "world"}, + }, + }, + ApplicationProperties: map[string]any{ + "appProperty1": "appProperty1Value", + }, + // It doesn't appear that we can't round-trip these attributes: + // Issue: https://github.com/Azure/azure-sdk-for-go/issues/19154 + DeliveryAnnotations: map[any]any{ + "deliveryAnnotation1": "deliveryAnnotation1Value", + }, + Header: &azeventhubs.AMQPAnnotatedMessageHeader{ + DeliveryCount: 100, + }, + Footer: map[any]any{ + "footerField1": "footerValue1", + }, + MessageAnnotations: map[any]any{ + "messageAnnotation1": 101, + }, + Properties: &azeventhubs.AMQPAnnotatedMessageProperties{ + GroupID: to.Ptr("custom-group-id"), + }, + }, nil) + require.NoError(t, err) + + // value body + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + Value: 999, + }, + }, nil) + require.NoError(t, err) + + // data body (multiple arrays, will be 'nil' in a normal ReceivedEventData) + err = batch.AddAMQPAnnotatedMessage(&azeventhubs.AMQPAnnotatedMessage{ + Body: azeventhubs.AMQPAnnotatedMessageBody{ + Data: [][]byte{ + []byte("hello"), + []byte("world"), + }, + }, + }, nil) + require.NoError(t, err) + + err = producer.SendEventBatch(context.Background(), batch, nil) + require.NoError(t, err) + + numEvents = int64(batch.NumEvents()) + } + + afterProps, err := producer.GetPartitionProperties(context.Background(), "0", nil) + require.NoError(t, err) + + require.Equal(t, numEvents, afterProps.LastEnqueuedSequenceNumber-beforeProps.LastEnqueuedSequenceNumber) + + consumerClient, err := azeventhubs.NewConsumerClientFromConnectionString(testParams.ConnectionString, testParams.EventHubName, azeventhubs.DefaultConsumerGroup, nil) + require.NoError(t, err) + + defer test.RequireClose(t, consumerClient) + + partitionClient, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ + StartPosition: getStartPosition(beforeProps), + }) + require.NoError(t, err) + + defer test.RequireClose(t, partitionClient) + + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + receivedEvents, err := partitionClient.ReceiveEvents(ctx, int(numEvents), nil) + require.NoError(t, err) + + // all of these events have Body encodings that can't be represented in EventData, + // so it'll be 'nil'. Users can get it from the inner RawAMQPMessage instead. + for _, e := range receivedEvents { + require.Nil(t, e.Body) + } + + sequenceMessage, valueMessage, multiarrayDataMessage := receivedEvents[0].RawAMQPMessage, receivedEvents[1].RawAMQPMessage, receivedEvents[2].RawAMQPMessage + + require.Equal(t, [][]any{ + {"hello", "world"}, + {"howdy", "world"}, + }, sequenceMessage.Body.Sequence) + + require.Equal(t, map[string]any{ + "appProperty1": "appProperty1Value", + }, sequenceMessage.ApplicationProperties) + + // It doesn't appear that we can round-trip this attribute: + // https://github.com/Azure/azure-sdk-for-go/issues/19154 + // require.Equal(t, uint32(101), sequenceMessage.Header.DeliveryCount) + // require.Equal(t, map[any]any{ + // "deliveryAnnotation1": "deliveryAnnotation1Value", + // }, sequenceMessage.DeliveryAnnotations) + + require.Equal(t, map[any]any{ + "footerField1": "footerValue1", + }, sequenceMessage.Footer) + + require.Equal(t, int64(101), sequenceMessage.MessageAnnotations["messageAnnotation1"]) + require.Equal(t, "custom-group-id", *sequenceMessage.Properties.GroupID) + + require.Equal(t, int64(999), valueMessage.Body.Value) + + // data body (multiple arrays, will be 'nil' in a normal ReceivedEventData) + require.Equal(t, [][]byte{ + []byte("hello"), + []byte("world"), + }, multiarrayDataMessage.Body.Data) + + require.Equal(t, int(numEvents), len(receivedEvents)) } func TestProducerClient_SendBatchExample(t *testing.T) { @@ -169,7 +306,7 @@ func TestProducerClient_SendBatchExample(t *testing.T) { // this is a replicate of the code we use in the example "example_producer_events.go" // just testing to make sure it works the way we expect it to. - newBatchOptions := &azeventhubs.NewEventDataBatchOptions{ + newBatchOptions := &azeventhubs.EventDataBatchOptions{ MaxBytes: 300, PartitionID: to.Ptr("0"), } @@ -255,7 +392,7 @@ func TestProducerClient_SendBatchExample(t *testing.T) { defer consumerClient.Close(context.Background()) - partitionClient, err := consumerClient.NewPartitionClient("0", &azeventhubs.NewPartitionClientOptions{ + partitionClient, err := consumerClient.NewPartitionClient("0", &azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(beforeSend), }) require.NoError(t, err) @@ -274,6 +411,12 @@ func TestProducerClient_SendBatchExample(t *testing.T) { } } +func makeByteSlice(index int, total int) []byte { + // ie: %0d, so it'll be zero padded up to the length we want + text := fmt.Sprintf("%0"+fmt.Sprintf("%d", total)+"d", index) + return []byte(text) +} + // receiveEventFromAnyPartition returns when it receives an event from any partition. Useful for tests where you're // letting the service route the event and you're not sure where it'll end up. func receiveEventFromAnyPartition(ctx context.Context, t *testing.T, consumer *azeventhubs.ConsumerClient, allPartitions []azeventhubs.PartitionProperties) *azeventhubs.ReceivedEventData { @@ -284,7 +427,7 @@ func receiveEventFromAnyPartition(ctx context.Context, t *testing.T, consumer *a for _, partProps := range allPartitions { go func(partProps azeventhubs.PartitionProperties) { - partClient, err := consumer.NewPartitionClient(partProps.PartitionID, &azeventhubs.NewPartitionClientOptions{ + partClient, err := consumer.NewPartitionClient(partProps.PartitionID, &azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partProps), }) require.NoError(t, err) @@ -367,7 +510,7 @@ func sendAndReceiveToPartitionTest(t *testing.T, cs string, eventHubName string, require.NoError(t, err) }() - batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.NewEventDataBatchOptions{ + batch, err := producer.NewEventDataBatch(context.Background(), &azeventhubs.EventDataBatchOptions{ PartitionID: &partitionID, }) require.NoError(t, err) @@ -399,7 +542,7 @@ func sendAndReceiveToPartitionTest(t *testing.T, cs string, eventHubName string, var actualBodies []string - subscription, err := consumer.NewPartitionClient(partitionID, &azeventhubs.NewPartitionClientOptions{ + subscription, err := consumer.NewPartitionClient(partitionID, &azeventhubs.PartitionClientOptions{ StartPosition: getStartPosition(partProps), }) require.NoError(t, err) diff --git a/sdk/messaging/azeventhubs/test_checkpoint_store_test.go b/sdk/messaging/azeventhubs/test_checkpoint_store_test.go index f40c99826387..ed850b9adc24 100644 --- a/sdk/messaging/azeventhubs/test_checkpoint_store_test.go +++ b/sdk/messaging/azeventhubs/test_checkpoint_store_test.go @@ -23,16 +23,12 @@ func Test_InMemoryCheckpointStore_Checkpoints(t *testing.T) { for i := int64(0); i < 5; i++ { err = store.UpdateCheckpoint(context.Background(), Checkpoint{ - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - CheckpointData: CheckpointData{ - Offset: to.Ptr(i), - SequenceNumber: to.Ptr(i + 1), - }, + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + Offset: to.Ptr(i), + SequenceNumber: to.Ptr(i + 1), }, nil) require.NoError(t, err) @@ -41,16 +37,12 @@ func Test_InMemoryCheckpointStore_Checkpoints(t *testing.T) { require.Equal(t, []Checkpoint{ { - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - CheckpointData: CheckpointData{ - Offset: to.Ptr(i), - SequenceNumber: to.Ptr(i + 1), - }, + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + Offset: to.Ptr(i), + SequenceNumber: to.Ptr(i + 1), }, }, checkpoints) } @@ -68,34 +60,26 @@ func Test_InMemoryCheckpointStore_Ownership(t *testing.T) { for i := int64(0); i < 5; i++ { ownerships, err = store.ClaimOwnership(context.Background(), []Ownership{ { - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - OwnershipData: OwnershipData{ - OwnerID: "owner-id", - LastModifiedTime: time.Time{}, - ETag: previousETag, - }, - }}, nil) - require.NoError(t, err) - - expectedOwnership := Ownership{ - CheckpointStoreAddress: CheckpointStoreAddress{ FullyQualifiedNamespace: "ns", EventHubName: "eh", ConsumerGroup: "cg", PartitionID: "100", - }, - OwnershipData: OwnershipData{ - OwnerID: "owner-id", - // these fields are dynamically generated, so we just make sure - // they do get filled out - LastModifiedTime: ownerships[0].LastModifiedTime, - ETag: ownerships[0].ETag, - }, + OwnerID: "owner-id", + LastModifiedTime: time.Time{}, + ETag: previousETag, + }}, nil) + require.NoError(t, err) + + expectedOwnership := Ownership{ + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + OwnerID: "owner-id", + // these fields are dynamically generated, so we just make sure + // they do get filled out + LastModifiedTime: ownerships[0].LastModifiedTime, + ETag: ownerships[0].ETag, } require.NotEqual(t, previousETag, ownerships[0].ETag) @@ -123,16 +107,12 @@ func Test_InMemoryCheckpointStore_OwnershipLoss(t *testing.T) { // If you don't specify an etag (ie, it's blank) then you always win ownership. ownerships, err = store.ClaimOwnership(context.Background(), []Ownership{ { - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - OwnershipData: OwnershipData{ - OwnerID: "owner-id", - LastModifiedTime: time.Time{}, - }, + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + OwnerID: "owner-id", + LastModifiedTime: time.Time{}, }}, nil) require.NoError(t, err) @@ -142,17 +122,13 @@ func Test_InMemoryCheckpointStore_OwnershipLoss(t *testing.T) { // the current one. ownerships, err = store.ClaimOwnership(context.Background(), []Ownership{ { - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - OwnershipData: OwnershipData{ - OwnerID: "new-owner-id", - LastModifiedTime: time.Time{}, - ETag: "non-matching-etag", - }, + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + OwnerID: "new-owner-id", + LastModifiedTime: time.Time{}, + ETag: "non-matching-etag", }}, nil) require.NoError(t, err) require.Empty(t, ownerships, "we weren't able to claim any partitions because our etag didn't match") @@ -168,17 +144,13 @@ func Test_InMemoryCheckpointStore_OwnershipLoss(t *testing.T) { // okay, let's claim the partition properly (with a matching etag) ownerships, err = store.ClaimOwnership(context.Background(), []Ownership{ { - CheckpointStoreAddress: CheckpointStoreAddress{ - FullyQualifiedNamespace: "ns", - EventHubName: "eh", - ConsumerGroup: "cg", - PartitionID: "100", - }, - OwnershipData: OwnershipData{ - OwnerID: "new-owner-id", - LastModifiedTime: time.Time{}, - ETag: previousETag, - }, + FullyQualifiedNamespace: "ns", + EventHubName: "eh", + ConsumerGroup: "cg", + PartitionID: "100", + OwnerID: "new-owner-id", + LastModifiedTime: time.Time{}, + ETag: previousETag, }}, nil) require.NoError(t, err) require.Equal(t, "new-owner-id", ownerships[0].OwnerID) @@ -204,7 +176,7 @@ func newCheckpointStoreForTest() *testCheckpointStore { } func (cps *testCheckpointStore) ExpireOwnership(o Ownership) { - key := strings.Join([]string{o.CheckpointStoreAddress.FullyQualifiedNamespace, o.CheckpointStoreAddress.EventHubName, o.CheckpointStoreAddress.ConsumerGroup, o.CheckpointStoreAddress.PartitionID}, "/") + key := strings.Join([]string{o.FullyQualifiedNamespace, o.EventHubName, o.ConsumerGroup, o.PartitionID}, "/") cps.ownershipMu.Lock() defer cps.ownershipMu.Unlock() @@ -222,14 +194,14 @@ func (cps *testCheckpointStore) ClaimOwnership(ctx context.Context, partitionOwn cps.ownershipMu.Lock() defer cps.ownershipMu.Unlock() - if po.CheckpointStoreAddress.ConsumerGroup == "" || - po.CheckpointStoreAddress.EventHubName == "" || - po.CheckpointStoreAddress.FullyQualifiedNamespace == "" || - po.CheckpointStoreAddress.PartitionID == "" { + if po.ConsumerGroup == "" || + po.EventHubName == "" || + po.FullyQualifiedNamespace == "" || + po.PartitionID == "" { panic("bad test, not all required fields were filled out for ownership data") } - key := strings.Join([]string{po.CheckpointStoreAddress.FullyQualifiedNamespace, po.CheckpointStoreAddress.EventHubName, po.CheckpointStoreAddress.ConsumerGroup, po.CheckpointStoreAddress.PartitionID}, "/") + key := strings.Join([]string{po.FullyQualifiedNamespace, po.EventHubName, po.ConsumerGroup, po.PartitionID}, "/") current, exists := cps.ownerships[key] @@ -246,8 +218,8 @@ func (cps *testCheckpointStore) ClaimOwnership(ctx context.Context, partitionOwn return nil, err } - newOwnership.OwnershipData.ETag = uuid.String() - newOwnership.OwnershipData.LastModifiedTime = time.Now().UTC() + newOwnership.ETag = uuid.String() + newOwnership.LastModifiedTime = time.Now().UTC() cps.ownerships[key] = newOwnership return &newOwnership, nil @@ -295,19 +267,19 @@ func (cps *testCheckpointStore) UpdateCheckpoint(ctx context.Context, checkpoint cps.checkpointsMu.Lock() defer cps.checkpointsMu.Unlock() - if checkpoint.CheckpointStoreAddress.ConsumerGroup == "" || - checkpoint.CheckpointStoreAddress.EventHubName == "" || - checkpoint.CheckpointStoreAddress.FullyQualifiedNamespace == "" || - checkpoint.CheckpointStoreAddress.PartitionID == "" { + if checkpoint.ConsumerGroup == "" || + checkpoint.EventHubName == "" || + checkpoint.FullyQualifiedNamespace == "" || + checkpoint.PartitionID == "" { panic("bad test, not all required fields were filled out for checkpoint data") } - key := toInMemoryKey(checkpoint.CheckpointStoreAddress) + key := toInMemoryKey(checkpoint) cps.checkpoints[key] = checkpoint return nil } -func toInMemoryKey(a CheckpointStoreAddress) string { +func toInMemoryKey(a Checkpoint) string { return strings.Join([]string{a.FullyQualifiedNamespace, a.EventHubName, a.ConsumerGroup, a.PartitionID}, "/") } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md index d3e0178ec38d..f13c2cf59a52 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md @@ -1,5 +1,220 @@ # Release History +## 2.2.0-beta.1 (2022-09-17) +### Features Added + +- New const `FleetMemberProvisioningStateFailed` +- New const `ControlledValuesRequestsOnly` +- New const `FleetMemberProvisioningStateCanceled` +- New const `TrustedAccessRoleBindingProvisioningStateUpdating` +- New const `LevelWarning` +- New const `UpdateModeOff` +- New const `FleetProvisioningStateCreating` +- New const `UpdateModeInitial` +- New const `FleetMemberProvisioningStateLeaving` +- New const `IpvsSchedulerRoundRobin` +- New const `IpvsSchedulerLeastConnection` +- New const `FleetMemberProvisioningStateJoining` +- New const `FleetProvisioningStateFailed` +- New const `BackendPoolTypeNodeIPConfiguration` +- New const `OSSKUMariner` +- New const `FleetProvisioningStateSucceeded` +- New const `ModeIPVS` +- New const `FleetProvisioningStateUpdating` +- New const `NetworkPluginModeOverlay` +- New const `FleetMemberProvisioningStateUpdating` +- New const `TrustedAccessRoleBindingProvisioningStateFailed` +- New const `TrustedAccessRoleBindingProvisioningStateDeleting` +- New const `ModeIPTABLES` +- New const `UpdateModeAuto` +- New const `BackendPoolTypeNodeIP` +- New const `FleetMemberProvisioningStateSucceeded` +- New const `LevelOff` +- New const `UpdateModeRecreate` +- New const `ControlledValuesRequestsAndLimits` +- New const `FleetProvisioningStateDeleting` +- New const `TrustedAccessRoleBindingProvisioningStateSucceeded` +- New const `PublicNetworkAccessSecuredByPerimeter` +- New const `FleetProvisioningStateCanceled` +- New const `SnapshotTypeManagedCluster` +- New const `LevelEnforcement` +- New type alias `NetworkPluginMode` +- New type alias `IpvsScheduler` +- New type alias `FleetMemberProvisioningState` +- New type alias `TrustedAccessRoleBindingProvisioningState` +- New type alias `FleetProvisioningState` +- New type alias `Level` +- New type alias `Mode` +- New type alias `BackendPoolType` +- New type alias `ControlledValues` +- New type alias `UpdateMode` +- New function `PossibleUpdateModeValues() []UpdateMode` +- New function `PossibleModeValues() []Mode` +- New function `*AgentPoolsClient.AbortLatestOperation(context.Context, string, string, string, *AgentPoolsClientAbortLatestOperationOptions) (AgentPoolsClientAbortLatestOperationResponse, error)` +- New function `PossibleNetworkPluginModeValues() []NetworkPluginMode` +- New function `NewTrustedAccessRoleBindingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRoleBindingsClient, error)` +- New function `PossibleTrustedAccessRoleBindingProvisioningStateValues() []TrustedAccessRoleBindingProvisioningState` +- New function `*ManagedClusterSnapshotsClient.NewListPager(*ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse]` +- New function `NewFleetMembersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FleetMembersClient, error)` +- New function `*ManagedClusterSnapshotsClient.Delete(context.Context, string, string, *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error)` +- New function `NewManagedClusterSnapshotsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error)` +- New function `PossibleIpvsSchedulerValues() []IpvsScheduler` +- New function `*FleetMembersClient.Get(context.Context, string, string, string, *FleetMembersClientGetOptions) (FleetMembersClientGetResponse, error)` +- New function `NewTrustedAccessRolesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TrustedAccessRolesClient, error)` +- New function `*ManagedClustersClient.BeginRotateServiceAccountSigningKeys(context.Context, string, string, *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*runtime.Poller[ManagedClustersClientRotateServiceAccountSigningKeysResponse], error)` +- New function `*TrustedAccessRolesClient.NewListPager(string, *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse]` +- New function `PossibleBackendPoolTypeValues() []BackendPoolType` +- New function `*TrustedAccessRoleBindingsClient.NewListPager(string, string, *TrustedAccessRoleBindingsClientListOptions) *runtime.Pager[TrustedAccessRoleBindingsClientListResponse]` +- New function `*ManagedClusterSnapshotsClient.NewListByResourceGroupPager(string, *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse]` +- New function `*FleetMembersClient.BeginDelete(context.Context, string, string, string, *FleetMembersClientBeginDeleteOptions) (*runtime.Poller[FleetMembersClientDeleteResponse], error)` +- New function `*ManagedClusterSnapshotsClient.Get(context.Context, string, string, *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error)` +- New function `PossibleFleetProvisioningStateValues() []FleetProvisioningState` +- New function `*TrustedAccessRoleBindingsClient.Delete(context.Context, string, string, string, *TrustedAccessRoleBindingsClientDeleteOptions) (TrustedAccessRoleBindingsClientDeleteResponse, error)` +- New function `*FleetsClient.NewListPager(*FleetsClientListOptions) *runtime.Pager[FleetsClientListResponse]` +- New function `PossibleFleetMemberProvisioningStateValues() []FleetMemberProvisioningState` +- New function `*FleetMembersClient.BeginCreateOrUpdate(context.Context, string, string, string, FleetMember, *FleetMembersClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetMembersClientCreateOrUpdateResponse], error)` +- New function `NewFleetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FleetsClient, error)` +- New function `*ManagedClusterSnapshotsClient.CreateOrUpdate(context.Context, string, string, ManagedClusterSnapshot, *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error)` +- New function `*ManagedClusterSnapshotsClient.UpdateTags(context.Context, string, string, TagsObject, *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error)` +- New function `*FleetsClient.ListCredentials(context.Context, string, string, *FleetsClientListCredentialsOptions) (FleetsClientListCredentialsResponse, error)` +- New function `*FleetsClient.NewListByResourceGroupPager(string, *FleetsClientListByResourceGroupOptions) *runtime.Pager[FleetsClientListByResourceGroupResponse]` +- New function `PossibleControlledValuesValues() []ControlledValues` +- New function `*FleetsClient.Update(context.Context, string, string, *FleetsClientUpdateOptions) (FleetsClientUpdateResponse, error)` +- New function `*FleetMembersClient.NewListByFleetPager(string, string, *FleetMembersClientListByFleetOptions) *runtime.Pager[FleetMembersClientListByFleetResponse]` +- New function `*ManagedClustersClient.AbortLatestOperation(context.Context, string, string, *ManagedClustersClientAbortLatestOperationOptions) (ManagedClustersClientAbortLatestOperationResponse, error)` +- New function `*FleetsClient.BeginDelete(context.Context, string, string, *FleetsClientBeginDeleteOptions) (*runtime.Poller[FleetsClientDeleteResponse], error)` +- New function `*TrustedAccessRoleBindingsClient.Get(context.Context, string, string, string, *TrustedAccessRoleBindingsClientGetOptions) (TrustedAccessRoleBindingsClientGetResponse, error)` +- New function `*TrustedAccessRoleBindingsClient.CreateOrUpdate(context.Context, string, string, string, TrustedAccessRoleBinding, *TrustedAccessRoleBindingsClientCreateOrUpdateOptions) (TrustedAccessRoleBindingsClientCreateOrUpdateResponse, error)` +- New function `PossibleLevelValues() []Level` +- New function `*FleetsClient.BeginCreateOrUpdate(context.Context, string, string, Fleet, *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error)` +- New function `*FleetsClient.Get(context.Context, string, string, *FleetsClientGetOptions) (FleetsClientGetResponse, error)` +- New struct `AgentPoolWindowsProfile` +- New struct `AgentPoolsClientAbortLatestOperationOptions` +- New struct `AgentPoolsClientAbortLatestOperationResponse` +- New struct `AzureEntityResource` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New struct `Fleet` +- New struct `FleetCredentialResult` +- New struct `FleetCredentialResults` +- New struct `FleetHubProfile` +- New struct `FleetListResult` +- New struct `FleetMember` +- New struct `FleetMemberProperties` +- New struct `FleetMembersClient` +- New struct `FleetMembersClientBeginCreateOrUpdateOptions` +- New struct `FleetMembersClientBeginDeleteOptions` +- New struct `FleetMembersClientCreateOrUpdateResponse` +- New struct `FleetMembersClientDeleteResponse` +- New struct `FleetMembersClientGetOptions` +- New struct `FleetMembersClientGetResponse` +- New struct `FleetMembersClientListByFleetOptions` +- New struct `FleetMembersClientListByFleetResponse` +- New struct `FleetMembersListResult` +- New struct `FleetPatch` +- New struct `FleetProperties` +- New struct `FleetsClient` +- New struct `FleetsClientBeginCreateOrUpdateOptions` +- New struct `FleetsClientBeginDeleteOptions` +- New struct `FleetsClientCreateOrUpdateResponse` +- New struct `FleetsClientDeleteResponse` +- New struct `FleetsClientGetOptions` +- New struct `FleetsClientGetResponse` +- New struct `FleetsClientListByResourceGroupOptions` +- New struct `FleetsClientListByResourceGroupResponse` +- New struct `FleetsClientListCredentialsOptions` +- New struct `FleetsClientListCredentialsResponse` +- New struct `FleetsClientListOptions` +- New struct `FleetsClientListResponse` +- New struct `FleetsClientUpdateOptions` +- New struct `FleetsClientUpdateResponse` +- New struct `GuardrailsProfile` +- New struct `ManagedClusterAzureMonitorProfile` +- New struct `ManagedClusterAzureMonitorProfileKubeStateMetrics` +- New struct `ManagedClusterAzureMonitorProfileMetrics` +- New struct `ManagedClusterIngressProfile` +- New struct `ManagedClusterIngressProfileWebAppRouting` +- New struct `ManagedClusterOIDCIssuerProfile` +- New struct `ManagedClusterPropertiesForSnapshot` +- New struct `ManagedClusterSecurityProfileImageCleaner` +- New struct `ManagedClusterSecurityProfileNodeRestriction` +- New struct `ManagedClusterSecurityProfileWorkloadIdentity` +- New struct `ManagedClusterSnapshot` +- New struct `ManagedClusterSnapshotListResult` +- New struct `ManagedClusterSnapshotProperties` +- New struct `ManagedClusterSnapshotsClient` +- New struct `ManagedClusterSnapshotsClientCreateOrUpdateOptions` +- New struct `ManagedClusterSnapshotsClientCreateOrUpdateResponse` +- New struct `ManagedClusterSnapshotsClientDeleteOptions` +- New struct `ManagedClusterSnapshotsClientDeleteResponse` +- New struct `ManagedClusterSnapshotsClientGetOptions` +- New struct `ManagedClusterSnapshotsClientGetResponse` +- New struct `ManagedClusterSnapshotsClientListByResourceGroupOptions` +- New struct `ManagedClusterSnapshotsClientListByResourceGroupResponse` +- New struct `ManagedClusterSnapshotsClientListOptions` +- New struct `ManagedClusterSnapshotsClientListResponse` +- New struct `ManagedClusterSnapshotsClientUpdateTagsOptions` +- New struct `ManagedClusterSnapshotsClientUpdateTagsResponse` +- New struct `ManagedClusterStorageProfileBlobCSIDriver` +- New struct `ManagedClusterWorkloadAutoScalerProfile` +- New struct `ManagedClusterWorkloadAutoScalerProfileKeda` +- New struct `ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler` +- New struct `ManagedClustersClientAbortLatestOperationOptions` +- New struct `ManagedClustersClientAbortLatestOperationResponse` +- New struct `ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions` +- New struct `ManagedClustersClientRotateServiceAccountSigningKeysResponse` +- New struct `NetworkProfileForSnapshot` +- New struct `NetworkProfileKubeProxyConfig` +- New struct `NetworkProfileKubeProxyConfigIpvsConfig` +- New struct `TrustedAccessRole` +- New struct `TrustedAccessRoleBinding` +- New struct `TrustedAccessRoleBindingListResult` +- New struct `TrustedAccessRoleBindingProperties` +- New struct `TrustedAccessRoleBindingsClient` +- New struct `TrustedAccessRoleBindingsClientCreateOrUpdateOptions` +- New struct `TrustedAccessRoleBindingsClientCreateOrUpdateResponse` +- New struct `TrustedAccessRoleBindingsClientDeleteOptions` +- New struct `TrustedAccessRoleBindingsClientDeleteResponse` +- New struct `TrustedAccessRoleBindingsClientGetOptions` +- New struct `TrustedAccessRoleBindingsClientGetResponse` +- New struct `TrustedAccessRoleBindingsClientListOptions` +- New struct `TrustedAccessRoleBindingsClientListResponse` +- New struct `TrustedAccessRoleListResult` +- New struct `TrustedAccessRoleRule` +- New struct `TrustedAccessRolesClient` +- New struct `TrustedAccessRolesClientListOptions` +- New struct `TrustedAccessRolesClientListResponse` +- New field `ImageCleaner` in struct `ManagedClusterSecurityProfile` +- New field `NodeRestriction` in struct `ManagedClusterSecurityProfile` +- New field `WorkloadIdentity` in struct `ManagedClusterSecurityProfile` +- New field `BackendPoolType` in struct `ManagedClusterLoadBalancerProfile` +- New field `IngressProfile` in struct `ManagedClusterProperties` +- New field `OidcIssuerProfile` in struct `ManagedClusterProperties` +- New field `EnableNamespaceResources` in struct `ManagedClusterProperties` +- New field `CreationData` in struct `ManagedClusterProperties` +- New field `AzureMonitorProfile` in struct `ManagedClusterProperties` +- New field `GuardrailsProfile` in struct `ManagedClusterProperties` +- New field `WorkloadAutoScalerProfile` in struct `ManagedClusterProperties` +- New field `EffectiveNoProxy` in struct `ManagedClusterHTTPProxyConfig` +- New field `Version` in struct `ManagedClusterStorageProfileDiskCSIDriver` +- New field `IgnorePodDisruptionBudget` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `BlobCSIDriver` in struct `ManagedClusterStorageProfile` +- New field `KubeProxyConfig` in struct `NetworkProfile` +- New field `NetworkPluginMode` in struct `NetworkProfile` +- New field `IgnorePodDisruptionBudget` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `EnableVnetIntegration` in struct `ManagedClusterAPIServerAccessProfile` +- New field `SubnetID` in struct `ManagedClusterAPIServerAccessProfile` +- New field `CapacityReservationGroupID` in struct `ManagedClusterAgentPoolProfile` +- New field `WindowsProfile` in struct `ManagedClusterAgentPoolProfile` +- New field `EnableCustomCATrust` in struct `ManagedClusterAgentPoolProfile` +- New field `MessageOfTheDay` in struct `ManagedClusterAgentPoolProfile` +- New field `MessageOfTheDay` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `CapacityReservationGroupID` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `EnableCustomCATrust` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `WindowsProfile` in struct `ManagedClusterAgentPoolProfileProperties` + + ## 2.1.0 (2022-08-25) ### Features Added @@ -34,4 +249,4 @@ The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containers To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go index f256e329a4c0..c879f1bfb648 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client.go @@ -20,6 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -55,9 +56,65 @@ func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredentia return client, nil } +// AbortLatestOperation - Aborting last running operation on agent pool. We return a 204 no content code here to indicate +// that the operation has been accepted and an abort will be attempted but is not guaranteed to complete +// successfully. Please look up the provisioning state of the agent pool to keep track of whether it changes to Canceled. +// A canceled provisioning state indicates that the abort was successful +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// agentPoolName - The name of the agent pool. +// options - AgentPoolsClientAbortLatestOperationOptions contains the optional parameters for the AgentPoolsClient.AbortLatestOperation +// method. +func (client *AgentPoolsClient) AbortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientAbortLatestOperationOptions) (AgentPoolsClientAbortLatestOperationResponse, error) { + req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) + if err != nil { + return AgentPoolsClientAbortLatestOperationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AgentPoolsClientAbortLatestOperationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AgentPoolsClientAbortLatestOperationResponse{}, runtime.NewResponseError(resp) + } + return AgentPoolsClientAbortLatestOperationResponse{}, nil +} + +// abortLatestOperationCreateRequest creates the AbortLatestOperation request. +func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientAbortLatestOperationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if agentPoolName == "" { + return nil, errors.New("parameter agentPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginCreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // agentPoolName - The name of the agent pool. @@ -78,7 +135,7 @@ func (client *AgentPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *AgentPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, parameters, options) if err != nil { @@ -118,7 +175,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -126,7 +183,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // agentPoolName - The name of the agent pool. @@ -145,7 +202,7 @@ func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) if err != nil { @@ -185,7 +242,10 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") + if options != nil && options.IgnorePodDisruptionBudget != nil { + reqQP.Set("ignore-pod-disruption-budget", strconv.FormatBool(*options.IgnorePodDisruptionBudget)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +253,7 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the specified managed cluster agent pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // agentPoolName - The name of the agent pool. @@ -237,7 +297,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +315,7 @@ func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoo // GetAvailableAgentPoolVersions - See supported Kubernetes versions [https://docs.microsoft.com/azure/aks/supported-kubernetes-versions] // for more details about the version lifecycle. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - AgentPoolsClientGetAvailableAgentPoolVersionsOptions contains the optional parameters for the AgentPoolsClient.GetAvailableAgentPoolVersions @@ -295,7 +355,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,7 +372,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp // GetUpgradeProfile - Gets the upgrade profile for an agent pool. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // agentPoolName - The name of the agent pool. @@ -357,7 +417,7 @@ func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,8 +433,7 @@ func (client *AgentPoolsClient) getUpgradeProfileHandleResponse(resp *http.Respo } // NewListPager - Gets a list of agent pools in the specified managed cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.List method. @@ -426,7 +485,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -445,7 +504,7 @@ func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPo // to the nodes. AKS provides one new image per week with the latest updates. For more details on node image // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // agentPoolName - The name of the agent pool. @@ -467,7 +526,7 @@ func (client *AgentPoolsClient) BeginUpgradeNodeImageVersion(ctx context.Context // the nodes. AKS provides one new image per week with the latest updates. For more details on node image // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *AgentPoolsClient) upgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*http.Response, error) { req, err := client.upgradeNodeImageVersionCreateRequest(ctx, resourceGroupName, resourceName, agentPoolName, options) if err != nil { @@ -507,7 +566,7 @@ func (client *AgentPoolsClient) upgradeNodeImageVersionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go index 038fe4981077..8d71540c444e 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/agentpools_client_example_test.go @@ -17,7 +17,24 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsAbortOperation.json +func ExampleAgentPoolsClient_AbortLatestOperation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.AbortLatestOperation(ctx, "rg1", "clustername1", "agentpool1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsList.json func ExampleAgentPoolsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +58,7 @@ func ExampleAgentPoolsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsGet.json func ExampleAgentPoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +77,38 @@ func ExampleAgentPoolsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_Snapshot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsAssociate_CRG.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_associateAgentPoolWithCapacityReservationGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/CapacityReservationGroups/crg1"), + Count: to.Ptr[int32](3), + OrchestratorVersion: to.Ptr(""), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_Snapshot.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPoolSnapshot() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +142,38 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolUsingAnAgentPool _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_DedicatedHostGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_EnableCustomCATrust.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithCustomCaTrustEnabled() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + EnableCustomCATrust: to.Ptr(true), + OrchestratorVersion: to.Ptr(""), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_DedicatedHostGroup.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHostGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -125,7 +204,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithDedicatedHos _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_EnableEncryptionAtHost.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAtHostEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,7 +235,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEncryptionAt _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_Ephemeral.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_Ephemeral.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOsDisk() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,7 +267,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithEphemeralOsD _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_EnableFIPS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_EnableFIPS.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledOs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -219,7 +298,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithFipsEnabledO _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_GPUMIG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_GPUMIG.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -273,7 +352,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithGpumig() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_WasmWasi.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_WasmWasi.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndTheWasiRuntime() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -306,7 +385,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKrustletAndT _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_CustomNodeConfig.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_CustomNodeConfig.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfigAndLinuxOsConfig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -359,7 +438,40 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithKubeletConfi _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_OSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_MessageOfTheDay.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithMessageOfTheDay() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", "agentpool1", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + MessageOfTheDay: to.Ptr("Zm9vCg=="), + Mode: to.Ptr(armcontainerservice.AgentPoolModeUser), + OrchestratorVersion: to.Ptr(""), + OSDiskSizeGB: to.Ptr[int32](64), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_OSSKU.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -413,7 +525,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithOssku() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_PPG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_PPG.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -444,7 +556,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithPpg() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_EnableUltraSSD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_EnableUltraSSD.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -475,7 +587,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithUltraSsdEnab _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_WindowsOSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_WindowsOSSKU.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -506,7 +618,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createAgentPoolWithWindowsOssku _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_Spot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_Spot.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -546,7 +658,41 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createSpotAgentPool() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_WindowsDisableOutboundNAT.json +func ExampleAgentPoolsClient_BeginCreateOrUpdate_createWindowsAgentPoolWithDisablingOutboundNat() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", "wnp2", armcontainerservice.AgentPool{ + Properties: &armcontainerservice.ManagedClusterAgentPoolProfileProperties{ + Count: to.Ptr[int32](3), + OrchestratorVersion: to.Ptr("1.23.8"), + OSSKU: to.Ptr(armcontainerservice.OSSKUWindows2022), + OSType: to.Ptr(armcontainerservice.OSTypeWindows), + VMSize: to.Ptr("Standard_D4s_v3"), + WindowsProfile: &armcontainerservice.AgentPoolWindowsProfile{ + DisableOutboundNat: to.Ptr(true), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsCreate_Update.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -587,7 +733,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_createUpdateAgentPool() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPools_Start.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPools_Start.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -616,7 +762,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_startAgentPool() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPools_Stop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPools_Stop.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -645,7 +791,7 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_stopAgentPool() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPools_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPools_Update.json func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -682,8 +828,29 @@ func ExampleAgentPoolsClient_BeginCreateOrUpdate_updateAgentPool() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsDelete.json -func ExampleAgentPoolsClient_BeginDelete() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsDelete.json +func ExampleAgentPoolsClient_BeginDelete_deleteAgentPool() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewAgentPoolsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "rg1", "clustername1", "agentpool1", &armcontainerservice.AgentPoolsClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsDelete_IgnorePodDisruptionBudget.json +func ExampleAgentPoolsClient_BeginDelete_deleteAgentPoolByIgnoringPodDisruptionBudget() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -693,7 +860,7 @@ func ExampleAgentPoolsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "rg1", "clustername1", "agentpool1", nil) + poller, err := client.BeginDelete(ctx, "rg1", "clustername1", "agentpool1", &armcontainerservice.AgentPoolsClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -703,7 +870,7 @@ func ExampleAgentPoolsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsGetUpgradeProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsGetUpgradeProfile.json func ExampleAgentPoolsClient_GetUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -722,7 +889,7 @@ func ExampleAgentPoolsClient_GetUpgradeProfile() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsGetAgentPoolAvailableVersions.json func ExampleAgentPoolsClient_GetAvailableAgentPoolVersions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -741,7 +908,7 @@ func ExampleAgentPoolsClient_GetAvailableAgentPoolVersions() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/AgentPoolsUpgradeNodeImageVersion.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/AgentPoolsUpgradeNodeImageVersion.json func ExampleAgentPoolsClient_BeginUpgradeNodeImageVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md index ffc254593a2d..740d1bb27163 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/df66d048c82fd136d5a15dea61c3c35bf6da9d43/specification/containerservice/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/df66d048c82fd136d5a15dea61c3c35bf6da9d43/specification/containerservice/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/containerservice/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/containerservice/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.1.0 -``` \ No newline at end of file +module-version: 2.2.0-beta.1 +``` diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/build.go b/sdk/resourcemanager/containerservice/armcontainerservice/build.go index ed9d23a63563..70432c3431c6 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/build.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/containerservice/armcontainerservice +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/containerservice/armcontainerservice package armcontainerservice diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/constants.go b/sdk/resourcemanager/containerservice/armcontainerservice/constants.go index cca02a243cae..c80aede90024 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/constants.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/constants.go @@ -11,7 +11,7 @@ package armcontainerservice const ( moduleName = "armcontainerservice" - moduleVersion = "v2.1.0" + moduleVersion = "v2.2.0-beta.1" ) // AgentPoolMode - A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent @@ -52,6 +52,24 @@ func PossibleAgentPoolTypeValues() []AgentPoolType { } } +// BackendPoolType - The type of the managed inbound Load Balancer BackendPool. +type BackendPoolType string + +const ( + // BackendPoolTypeNodeIP - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIP BackendPoolType = "NodeIP" + // BackendPoolTypeNodeIPConfiguration - The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + BackendPoolTypeNodeIPConfiguration BackendPoolType = "NodeIPConfiguration" +) + +// PossibleBackendPoolTypeValues returns the possible values for the BackendPoolType const type. +func PossibleBackendPoolTypeValues() []BackendPoolType { + return []BackendPoolType{ + BackendPoolTypeNodeIP, + BackendPoolTypeNodeIPConfiguration, + } +} + // Code - Tells whether the cluster is Running or Stopped type Code string @@ -467,6 +485,24 @@ func PossibleContainerServiceVMSizeTypesValues() []ContainerServiceVMSizeTypes { } } +// ControlledValues - Controls which resource value autoscaler will change. Default value is RequestsAndLimits. +type ControlledValues string + +const ( + // ControlledValuesRequestsAndLimits - Autoscaler will control resource requests and limits. + ControlledValuesRequestsAndLimits ControlledValues = "RequestsAndLimits" + // ControlledValuesRequestsOnly - Autoscaler will control resource requests only. + ControlledValuesRequestsOnly ControlledValues = "RequestsOnly" +) + +// PossibleControlledValuesValues returns the possible values for the ControlledValues const type. +func PossibleControlledValuesValues() []ControlledValues { + return []ControlledValues{ + ControlledValuesRequestsAndLimits, + ControlledValuesRequestsOnly, + } +} + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is // 1. type Count int32 @@ -550,6 +586,54 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { } } +// FleetMemberProvisioningState - The provisioning state of the last accepted operation. +type FleetMemberProvisioningState string + +const ( + FleetMemberProvisioningStateCanceled FleetMemberProvisioningState = "Canceled" + FleetMemberProvisioningStateFailed FleetMemberProvisioningState = "Failed" + FleetMemberProvisioningStateJoining FleetMemberProvisioningState = "Joining" + FleetMemberProvisioningStateLeaving FleetMemberProvisioningState = "Leaving" + FleetMemberProvisioningStateSucceeded FleetMemberProvisioningState = "Succeeded" + FleetMemberProvisioningStateUpdating FleetMemberProvisioningState = "Updating" +) + +// PossibleFleetMemberProvisioningStateValues returns the possible values for the FleetMemberProvisioningState const type. +func PossibleFleetMemberProvisioningStateValues() []FleetMemberProvisioningState { + return []FleetMemberProvisioningState{ + FleetMemberProvisioningStateCanceled, + FleetMemberProvisioningStateFailed, + FleetMemberProvisioningStateJoining, + FleetMemberProvisioningStateLeaving, + FleetMemberProvisioningStateSucceeded, + FleetMemberProvisioningStateUpdating, + } +} + +// FleetProvisioningState - The provisioning state of the last accepted operation. +type FleetProvisioningState string + +const ( + FleetProvisioningStateCanceled FleetProvisioningState = "Canceled" + FleetProvisioningStateCreating FleetProvisioningState = "Creating" + FleetProvisioningStateDeleting FleetProvisioningState = "Deleting" + FleetProvisioningStateFailed FleetProvisioningState = "Failed" + FleetProvisioningStateSucceeded FleetProvisioningState = "Succeeded" + FleetProvisioningStateUpdating FleetProvisioningState = "Updating" +) + +// PossibleFleetProvisioningStateValues returns the possible values for the FleetProvisioningState const type. +func PossibleFleetProvisioningStateValues() []FleetProvisioningState { + return []FleetProvisioningState{ + FleetProvisioningStateCanceled, + FleetProvisioningStateCreating, + FleetProvisioningStateDeleting, + FleetProvisioningStateFailed, + FleetProvisioningStateSucceeded, + FleetProvisioningStateUpdating, + } +} + type Format string const ( @@ -605,6 +689,24 @@ func PossibleIPFamilyValues() []IPFamily { } } +// IpvsScheduler - IPVS scheduler, for more information please see http://www.linuxvirtualserver.org/docs/scheduling.html. +type IpvsScheduler string + +const ( + // IpvsSchedulerLeastConnection - Least Connection + IpvsSchedulerLeastConnection IpvsScheduler = "LeastConnection" + // IpvsSchedulerRoundRobin - Round Robin + IpvsSchedulerRoundRobin IpvsScheduler = "RoundRobin" +) + +// PossibleIpvsSchedulerValues returns the possible values for the IpvsScheduler const type. +func PossibleIpvsSchedulerValues() []IpvsScheduler { + return []IpvsScheduler{ + IpvsSchedulerLeastConnection, + IpvsSchedulerRoundRobin, + } +} + // KeyVaultNetworkAccessTypes - Network access of key vault. The possible values are Public and Private. Public means the // key vault allows public access from all networks. Private means the key vault disables public access and // enables private link. The default value is Public. @@ -641,6 +743,25 @@ func PossibleKubeletDiskTypeValues() []KubeletDiskType { } } +// Level - The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes +// via systemExcludedNamespaces +type Level string + +const ( + LevelEnforcement Level = "Enforcement" + LevelOff Level = "Off" + LevelWarning Level = "Warning" +) + +// PossibleLevelValues returns the possible values for the Level const type. +func PossibleLevelValues() []Level { + return []Level{ + LevelEnforcement, + LevelOff, + LevelWarning, + } +} + // LicenseType - The license type to use for Windows VMs. See Azure Hybrid User Benefits [https://azure.microsoft.com/pricing/hybrid-benefit/faq/] // for more details. type LicenseType string @@ -735,6 +856,24 @@ func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { } } +// Mode - Specify which proxy mode to use ('IPTABLES' or 'IPVS') +type Mode string + +const ( + // ModeIPTABLES - IPTables proxy mode + ModeIPTABLES Mode = "IPTABLES" + // ModeIPVS - IPVS proxy mode. Must be using Kubernetes version >= 1.22. + ModeIPVS Mode = "IPVS" +) + +// PossibleModeValues returns the possible values for the Mode const type. +func PossibleModeValues() []Mode { + return []Mode{ + ModeIPTABLES, + ModeIPVS, + } +} + // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. type NetworkMode string @@ -764,8 +903,8 @@ const ( // NetworkPluginKubenet - Use the Kubenet network plugin. See [Kubenet (basic) networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) // for more information. NetworkPluginKubenet NetworkPlugin = "kubenet" - // NetworkPluginNone - No CNI plugin is pre-installed. See [BYO CNI](https://docs.microsoft.com/en-us/azure/aks/use-byo-cni) - // for more information. + // NetworkPluginNone - Do not use a network plugin. A custom CNI will need to be installed after cluster creation for networking + // functionality. NetworkPluginNone NetworkPlugin = "none" ) @@ -778,6 +917,22 @@ func PossibleNetworkPluginValues() []NetworkPlugin { } } +// NetworkPluginMode - The mode the network plugin should use. +type NetworkPluginMode string + +const ( + // NetworkPluginModeOverlay - Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than + // Kubenet reference plugins host-local and bridge. + NetworkPluginModeOverlay NetworkPluginMode = "Overlay" +) + +// PossibleNetworkPluginModeValues returns the possible values for the NetworkPluginMode const type. +func PossibleNetworkPluginModeValues() []NetworkPluginMode { + return []NetworkPluginMode{ + NetworkPluginModeOverlay, + } +} + // NetworkPolicy - Network policy used for building the Kubernetes network. type NetworkPolicy string @@ -822,12 +977,14 @@ func PossibleOSDiskTypeValues() []OSDiskType { } } -// OSSKU - Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 -// when Kubernetes = 1.25 if OSType is Windows. +// OSSKU - Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 +// if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 +// after Windows2019 is deprecated. type OSSKU string const ( OSSKUCBLMariner OSSKU = "CBLMariner" + OSSKUMariner OSSKU = "Mariner" OSSKUUbuntu OSSKU = "Ubuntu" OSSKUWindows2019 OSSKU = "Windows2019" OSSKUWindows2022 OSSKU = "Windows2022" @@ -837,6 +994,7 @@ const ( func PossibleOSSKUValues() []OSSKU { return []OSSKU{ OSSKUCBLMariner, + OSSKUMariner, OSSKUUbuntu, OSSKUWindows2019, OSSKUWindows2022, @@ -913,8 +1071,12 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin type PublicNetworkAccess string const ( + // PublicNetworkAccessDisabled - Inbound traffic to managedCluster is disabled, traffic from managedCluster is allowed. PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessEnabled - Inbound/Outbound to the managedCluster is allowed. + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessSecuredByPerimeter - Inbound/Outbound traffic is managed by Microsoft.Network/NetworkSecurityPerimeters. + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -922,6 +1084,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, } } @@ -1014,6 +1177,8 @@ func PossibleScaleSetPriorityValues() []ScaleSetPriority { type SnapshotType string const ( + // SnapshotTypeManagedCluster - The snapshot is a snapshot of a managed cluster. + SnapshotTypeManagedCluster SnapshotType = "ManagedCluster" // SnapshotTypeNodePool - The snapshot is a snapshot of a node pool. SnapshotTypeNodePool SnapshotType = "NodePool" ) @@ -1021,10 +1186,60 @@ const ( // PossibleSnapshotTypeValues returns the possible values for the SnapshotType const type. func PossibleSnapshotTypeValues() []SnapshotType { return []SnapshotType{ + SnapshotTypeManagedCluster, SnapshotTypeNodePool, } } +// TrustedAccessRoleBindingProvisioningState - The current provisioning state of trusted access role binding. +type TrustedAccessRoleBindingProvisioningState string + +const ( + TrustedAccessRoleBindingProvisioningStateDeleting TrustedAccessRoleBindingProvisioningState = "Deleting" + TrustedAccessRoleBindingProvisioningStateFailed TrustedAccessRoleBindingProvisioningState = "Failed" + TrustedAccessRoleBindingProvisioningStateSucceeded TrustedAccessRoleBindingProvisioningState = "Succeeded" + TrustedAccessRoleBindingProvisioningStateUpdating TrustedAccessRoleBindingProvisioningState = "Updating" +) + +// PossibleTrustedAccessRoleBindingProvisioningStateValues returns the possible values for the TrustedAccessRoleBindingProvisioningState const type. +func PossibleTrustedAccessRoleBindingProvisioningStateValues() []TrustedAccessRoleBindingProvisioningState { + return []TrustedAccessRoleBindingProvisioningState{ + TrustedAccessRoleBindingProvisioningStateDeleting, + TrustedAccessRoleBindingProvisioningStateFailed, + TrustedAccessRoleBindingProvisioningStateSucceeded, + TrustedAccessRoleBindingProvisioningStateUpdating, + } +} + +// UpdateMode - Each update mode level is a superset of the lower levels. Off 0 + }, + Fetcher: func(ctx context.Context, page *FleetMembersClientListByFleetResponse) (FleetMembersClientListByFleetResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FleetMembersClientListByFleetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetMembersClientListByFleetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetMembersClientListByFleetResponse{}, runtime.NewResponseError(resp) + } + return client.listByFleetHandleResponse(resp) + }, + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetMembersClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetMembersClient) listByFleetHandleResponse(resp *http.Response) (FleetMembersClientListByFleetResponse, error) { + result := FleetMembersClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetMembersListResult); err != nil { + return FleetMembersClientListByFleetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fleetmembers_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/fleetmembers_client_example_test.go new file mode 100644 index 000000000000..73a95ac26998 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fleetmembers_client_example_test.go @@ -0,0 +1,111 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/FleetMembers_Create.json +func ExampleFleetMembersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetMembersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "fleet-1", "member-1", armcontainerservice.FleetMember{ + Properties: &armcontainerservice.FleetMemberProperties{ + ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + }, + }, &armcontainerservice.FleetMembersClientBeginCreateOrUpdateOptions{IfMatch: nil, + IfNoneMatch: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/FleetMembers_Get.json +func ExampleFleetMembersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetMembersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "rg1", "fleet-1", "member-1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/FleetMembers_Delete.json +func ExampleFleetMembersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetMembersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "rg1", "fleet-1", "member-1", &armcontainerservice.FleetMembersClientBeginDeleteOptions{IfMatch: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/FleetMembers_List.json +func ExampleFleetMembersClient_NewListByFleetPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetMembersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByFleetPager("rg1", "fleet-1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client.go new file mode 100644 index 000000000000..b74f95d59f31 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client.go @@ -0,0 +1,489 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcontainerservice + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FleetsClient contains the methods for the Fleets group. +// Don't use this type directly, use NewFleetsClient() instead. +type FleetsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFleetsClient creates a new instance of FleetsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FleetsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// fleetName - The name of the Fleet resource. +// parameters - The Fleet to create or update. +// options - FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate +// method. +func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, parameters Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FleetsClientCreateOrUpdateResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FleetsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates or updates a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, parameters Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, parameters Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// fleetName - The name of the Fleet resource. +// options - FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*runtime.Poller[FleetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[FleetsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// fleetName - The name of the Fleet resource. +// options - FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (FleetsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return FleetsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClientGetResponse, error) { + result := FleetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { + return FleetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists fleets in the specified subscription. +// Generated from API version 2022-07-02-preview +// options - FleetsClientListOptions contains the optional parameters for the FleetsClient.List method. +func (client *FleetsClient) NewListPager(options *FleetsClientListOptions) *runtime.Pager[FleetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListResponse]{ + More: func(page FleetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListResponse) (FleetsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FleetsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FleetsClient) listCreateRequest(ctx context.Context, options *FleetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FleetsClient) listHandleResponse(resp *http.Response) (FleetsClientListResponse, error) { + result := FleetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists fleets in the specified subscription and resource group. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.ListByResourceGroup +// method. +func (client *FleetsClient) NewListByResourceGroupPager(resourceGroupName string, options *FleetsClientListByResourceGroupOptions) *runtime.Pager[FleetsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListByResourceGroupResponse]{ + More: func(page FleetsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListByResourceGroupResponse) (FleetsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *FleetsClient) listByResourceGroupHandleResponse(resp *http.Response) (FleetsClientListByResourceGroupResponse, error) { + result := FleetsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// ListCredentials - Lists the user credentials of a Fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// fleetName - The name of the Fleet resource. +// options - FleetsClientListCredentialsOptions contains the optional parameters for the FleetsClient.ListCredentials method. +func (client *FleetsClient) ListCredentials(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientListCredentialsOptions) (FleetsClientListCredentialsResponse, error) { + req, err := client.listCredentialsCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return FleetsClientListCredentialsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetsClientListCredentialsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetsClientListCredentialsResponse{}, runtime.NewResponseError(resp) + } + return client.listCredentialsHandleResponse(resp) +} + +// listCredentialsCreateRequest creates the ListCredentials request. +func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientListCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCredentialsHandleResponse handles the ListCredentials response. +func (client *FleetsClient) listCredentialsHandleResponse(resp *http.Response) (FleetsClientListCredentialsResponse, error) { + result := FleetsClientListCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetCredentialResults); err != nil { + return FleetsClientListCredentialsResponse{}, err + } + return result, nil +} + +// Update - Patches a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// fleetName - The name of the Fleet resource. +// options - FleetsClientUpdateOptions contains the optional parameters for the FleetsClient.Update method. +func (client *FleetsClient) Update(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientUpdateOptions) (FleetsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return FleetsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FleetsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + return req, runtime.MarshalAsJSON(req, *options.Parameters) + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *FleetsClient) updateHandleResponse(resp *http.Response) (FleetsClientUpdateResponse, error) { + result := FleetsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { + return FleetsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client_example_test.go new file mode 100644 index 000000000000..868897335706 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/fleets_client_example_test.go @@ -0,0 +1,187 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_CreateOrUpdate.json +func ExampleFleetsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "fleet-1", armcontainerservice.Fleet{ + Location: to.Ptr("East US"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.FleetProperties{ + HubProfile: &armcontainerservice.FleetHubProfile{ + DNSPrefix: to.Ptr("dnsprefix1"), + }, + }, + }, &armcontainerservice.FleetsClientBeginCreateOrUpdateOptions{IfMatch: nil, + IfNoneMatch: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_PatchTags.json +func ExampleFleetsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "rg1", "fleet-1", &armcontainerservice.FleetsClientUpdateOptions{IfMatch: to.Ptr("dfjkwelr7384"), + Parameters: &armcontainerservice.FleetPatch{ + Tags: map[string]*string{ + "env": to.Ptr("prod"), + "tier": to.Ptr("secure"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_Get.json +func ExampleFleetsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "rg1", "fleet-1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_Delete.json +func ExampleFleetsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "rg1", "fleet-1", &armcontainerservice.FleetsClientBeginDeleteOptions{IfMatch: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_ListByResourceGroup.json +func ExampleFleetsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("rg1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_ListBySub.json +func ExampleFleetsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-07-02-preview/examples/Fleets_ListCredentialsResult.json +func ExampleFleetsClient_ListCredentials() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewFleetsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListCredentials(ctx, "rg1", "fleet", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go index 353cc3226ec7..16e8c5003467 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client.go @@ -57,7 +57,7 @@ func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore // CreateOrUpdate - Creates or updates a maintenance configuration in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // configName - The name of the maintenance configuration. @@ -103,7 +103,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -120,7 +120,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp // Delete - Deletes a maintenance configuration. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // configName - The name of the maintenance configuration. @@ -165,7 +165,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,7 +173,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C // Get - Gets the specified maintenance configuration of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // configName - The name of the maintenance configuration. @@ -218,7 +218,7 @@ func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,8 +234,7 @@ func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Resp } // NewListByManagedClusterPager - Gets a list of maintenance configurations in the specified managed cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - MaintenanceConfigurationsClientListByManagedClusterOptions contains the optional parameters for the MaintenanceConfigurationsClient.ListByManagedCluster @@ -288,7 +287,7 @@ func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go index 3b39d00f3622..ffeea7ff4b16 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/maintenanceconfigurations_client_example_test.go @@ -19,7 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/MaintenanceConfigurationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/MaintenanceConfigurationsList.json func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -43,7 +43,7 @@ func ExampleMaintenanceConfigurationsClient_NewListByManagedClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/MaintenanceConfigurationsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/MaintenanceConfigurationsGet.json func ExampleMaintenanceConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -62,7 +62,7 @@ func ExampleMaintenanceConfigurationsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/MaintenanceConfigurationsCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/MaintenanceConfigurationsCreate_Update.json func ExampleMaintenanceConfigurationsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleMaintenanceConfigurationsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/MaintenanceConfigurationsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/MaintenanceConfigurationsDelete.json func ExampleMaintenanceConfigurationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go index 754117a7ca6d..c521c939590f 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client.go @@ -20,6 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -55,9 +56,61 @@ func NewManagedClustersClient(subscriptionID string, credential azcore.TokenCred return client, nil } +// AbortLatestOperation - Aborting last running operation on managed cluster. We return a 204 no content code here to indicate +// that the operation has been accepted and an abort will be attempted but is not guaranteed to +// complete successfully. Please look up the provisioning state of the managed cluster to keep track of whether it changes +// to Canceled. A canceled provisioning state indicates that the abort was +// successful +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// options - ManagedClustersClientAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.AbortLatestOperation +// method. +func (client *ManagedClustersClient) AbortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientAbortLatestOperationOptions) (ManagedClustersClientAbortLatestOperationResponse, error) { + req, err := client.abortLatestOperationCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClustersClientAbortLatestOperationResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClustersClientAbortLatestOperationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ManagedClustersClientAbortLatestOperationResponse{}, runtime.NewResponseError(resp) + } + return ManagedClustersClientAbortLatestOperationResponse{}, nil +} + +// abortLatestOperationCreateRequest creates the AbortLatestOperation request. +func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientAbortLatestOperationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginCreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // parameters - The managed cluster to create or update. @@ -77,7 +130,7 @@ func (client *ManagedClustersClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -113,7 +166,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,7 +174,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete @@ -140,7 +193,7 @@ func (client *ManagedClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -176,7 +229,10 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") + if options != nil && options.IgnorePodDisruptionBudget != nil { + reqQP.Set("ignore-pod-disruption-budget", strconv.FormatBool(*options.IgnorePodDisruptionBudget)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +240,7 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientGetOptions contains the optional parameters for the ManagedClustersClient.Get method. @@ -223,7 +279,7 @@ func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +298,7 @@ func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (Man // or ListClusterAdminCredentials // [https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials] . // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // roleName - The name of the role for managed cluster accessProfile resource. @@ -287,7 +343,7 @@ func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -304,7 +360,7 @@ func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.R // GetCommandResult - Gets the results of a command which has been run on the Managed Cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // commandID - Id of the command. @@ -349,7 +405,7 @@ func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +422,7 @@ func (client *ManagedClustersClient) getCommandResultHandleResponse(resp *http.R // GetOSOptions - Gets supported OS options in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // location - The name of Azure region. // options - ManagedClustersClientGetOSOptionsOptions contains the optional parameters for the ManagedClustersClient.GetOSOptions // method. @@ -401,7 +457,7 @@ func (client *ManagedClustersClient) getOSOptionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") if options != nil && options.ResourceType != nil { reqQP.Set("resource-type", *options.ResourceType) } @@ -421,7 +477,7 @@ func (client *ManagedClustersClient) getOSOptionsHandleResponse(resp *http.Respo // GetUpgradeProfile - Gets the upgrade profile of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetUpgradeProfile @@ -461,7 +517,7 @@ func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,8 +533,7 @@ func (client *ManagedClustersClient) getUpgradeProfileHandleResponse(resp *http. } // NewListPager - Gets a list of managed clusters in the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // options - ManagedClustersClientListOptions contains the optional parameters for the ManagedClustersClient.List method. func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClientListOptions) *runtime.Pager[ManagedClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedClustersClientListResponse]{ @@ -520,7 +575,7 @@ func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -536,8 +591,7 @@ func (client *ManagedClustersClient) listHandleResponse(resp *http.Response) (Ma } // NewListByResourceGroupPager - Lists managed clusters in the specified subscription and resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // options - ManagedClustersClientListByResourceGroupOptions contains the optional parameters for the ManagedClustersClient.ListByResourceGroup // method. @@ -585,7 +639,7 @@ func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -602,7 +656,7 @@ func (client *ManagedClustersClient) listByResourceGroupHandleResponse(resp *htt // ListClusterAdminCredentials - Lists the admin credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientListClusterAdminCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterAdminCredentials @@ -642,7 +696,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -662,7 +716,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsHandleResponse(r // ListClusterMonitoringUserCredentials - Lists the cluster monitoring user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientListClusterMonitoringUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterMonitoringUserCredentials @@ -702,7 +756,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -722,7 +776,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsHandleR // ListClusterUserCredentials - Lists the user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientListClusterUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterUserCredentials @@ -762,7 +816,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -785,8 +839,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsHandleResponse(re // NewListOutboundNetworkDependenciesEndpointsPager - Gets a list of egress endpoints (network endpoints of all outbound dependencies) // in the specified managed cluster. The operation returns properties of each egress endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the @@ -839,7 +892,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -856,7 +909,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsHan // BeginResetAADProfile - Reset the AAD Profile of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // parameters - The AAD profile to set on the Managed Cluster @@ -876,7 +929,7 @@ func (client *ManagedClustersClient) BeginResetAADProfile(ctx context.Context, r // ResetAADProfile - Reset the AAD Profile of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) resetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*http.Response, error) { req, err := client.resetAADProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -912,7 +965,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -920,7 +973,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co // BeginResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // parameters - The service principal profile to set on the managed cluster. @@ -940,7 +993,7 @@ func (client *ManagedClustersClient) BeginResetServicePrincipalProfile(ctx conte // ResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) resetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*http.Response, error) { req, err := client.resetServicePrincipalProfileCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -976,7 +1029,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -985,7 +1038,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c // BeginRotateClusterCertificates - See Certificate rotation [https://docs.microsoft.com/azure/aks/certificate-rotation] for // more details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientBeginRotateClusterCertificatesOptions contains the optional parameters for the ManagedClustersClient.BeginRotateClusterCertificates @@ -1005,7 +1058,7 @@ func (client *ManagedClustersClient) BeginRotateClusterCertificates(ctx context. // RotateClusterCertificates - See Certificate rotation [https://docs.microsoft.com/azure/aks/certificate-rotation] for more // details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) rotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*http.Response, error) { req, err := client.rotateClusterCertificatesCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -1041,7 +1094,70 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// options - ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions contains the optional parameters for the ManagedClustersClient.BeginRotateServiceAccountSigningKeys +// method. +func (client *ManagedClustersClient) BeginRotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*runtime.Poller[ManagedClustersClientRotateServiceAccountSigningKeysResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rotateServiceAccountSigningKeys(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ManagedClustersClientRotateServiceAccountSigningKeysResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ManagedClustersClientRotateServiceAccountSigningKeysResponse](options.ResumeToken, client.pl, nil) + } +} + +// RotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +func (client *ManagedClustersClient) rotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*http.Response, error) { + req, err := client.rotateServiceAccountSigningKeysCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// rotateServiceAccountSigningKeysCreateRequest creates the RotateServiceAccountSigningKeys request. +func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1051,7 +1167,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx // see AKS Run Command // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // requestPayload - The run command request @@ -1073,7 +1189,7 @@ func (client *ManagedClustersClient) BeginRunCommand(ctx context.Context, resour // see AKS Run Command // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) runCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, resourceName, requestPayload, options) if err != nil { @@ -1109,7 +1225,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, requestPayload) @@ -1118,7 +1234,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context // BeginStart - See starting a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] for more details about starting // a cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientBeginStartOptions contains the optional parameters for the ManagedClustersClient.BeginStart @@ -1138,7 +1254,7 @@ func (client *ManagedClustersClient) BeginStart(ctx context.Context, resourceGro // Start - See starting a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] for more details about starting // a cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) start(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -1174,7 +1290,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1185,7 +1301,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res // cluster does not accrue charges while it is stopped. See stopping a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // options - ManagedClustersClientBeginStopOptions contains the optional parameters for the ManagedClustersClient.BeginStop @@ -1207,7 +1323,7 @@ func (client *ManagedClustersClient) BeginStop(ctx context.Context, resourceGrou // cluster does not accrue charges while it is stopped. See stopping a cluster [https://docs.microsoft.com/azure/aks/start-stop-cluster] // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) stop(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -1243,7 +1359,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1251,7 +1367,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso // BeginUpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // resourceName - The name of the managed cluster resource. // parameters - Parameters supplied to the Update Managed Cluster Tags operation. @@ -1271,7 +1387,7 @@ func (client *ManagedClustersClient) BeginUpdateTags(ctx context.Context, resour // UpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01 +// Generated from API version 2022-08-02-preview func (client *ManagedClustersClient) updateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*http.Response, error) { req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -1307,7 +1423,7 @@ func (client *ManagedClustersClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01") + reqQP.Set("api-version", "2022-08-02-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go index 2c258b559398..0061efaa171a 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclusters_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ContainerServiceGetOSOptions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ContainerServiceGetOSOptions.json func ExampleManagedClustersClient_GetOSOptions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -36,7 +36,7 @@ func ExampleManagedClustersClient_GetOSOptions() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersList.json func ExampleManagedClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleManagedClustersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersListByResourceGroup.json func ExampleManagedClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -84,7 +84,7 @@ func ExampleManagedClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersGetUpgradeProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersGetUpgradeProfile.json func ExampleManagedClustersClient_GetUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,7 +103,7 @@ func ExampleManagedClustersClient_GetUpgradeProfile() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersGetAccessProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersGetAccessProfile.json func ExampleManagedClustersClient_GetAccessProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -122,7 +122,7 @@ func ExampleManagedClustersClient_GetAccessProfile() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersListClusterAdminCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersListClusterCredentialResult.json func ExampleManagedClustersClient_ListClusterAdminCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -141,8 +141,8 @@ func ExampleManagedClustersClient_ListClusterAdminCredentials() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersListClusterUserCredentials.json -func ExampleManagedClustersClient_ListClusterUserCredentials() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersGet.json +func ExampleManagedClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -152,9 +152,7 @@ func ExampleManagedClustersClient_ListClusterUserCredentials() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListClusterUserCredentials(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions{ServerFqdn: nil, - Format: nil, - }) + res, err := client.Get(ctx, "rg1", "clustername1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -162,8 +160,8 @@ func ExampleManagedClustersClient_ListClusterUserCredentials() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersListClusterMonitoringUserCredentials.json -func ExampleManagedClustersClient_ListClusterMonitoringUserCredentials() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersAssociate_CRG.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_associateManagedClusterWithCapacityReservationGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -173,16 +171,79 @@ func ExampleManagedClustersClient_ListClusterMonitoringUserCredentials() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListClusterMonitoringUserCredentials(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientListClusterMonitoringUserCredentialsOptions{ServerFqdn: nil}) + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + CapacityReservationGroupID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/capacityReservationGroups/crg1"), + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUNameBasic), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } // TODO: use response item _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersGet.json -func ExampleManagedClustersClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_MCSnapshot.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingAManagedClusterSnapshot() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -192,15 +253,60 @@ func ExampleManagedClustersClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, "rg1", "clustername1", nil) + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableFIPS: to.Ptr(true), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + CreationData: &armcontainerservice.CreationData{ + SourceResourceID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/managedclustersnapshots/snapshot1"), + }, + DNSPrefix: to.Ptr("dnsprefix1"), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUNameBasic), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } // TODO: use response item _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_Snapshot.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_Snapshot.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingAnAgentPoolSnapshot() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -285,7 +391,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterUsingA _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_ManagedNATGateway.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_ManagedNATGateway.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAksManagedNatGatewayAsOutboundType() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -366,7 +472,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAk _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_AzureKeyvaultSecretsProvider.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAzureKeyVaultSecretsProviderAddon() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -455,7 +561,89 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithAz _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_DedicatedHostGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_EnableCustomCATrust.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithCustomCaTrustEnabled() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableCustomCATrust: to.Ptr(true), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUNameBasic), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_DedicatedHostGroup.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithDedicatedHostGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -536,7 +724,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithDe _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_EnableEncryptionAtHost.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithEncryptionAtHostEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -618,7 +806,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithEn _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_EnabledFIPS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_EnabledFIPS.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithFipsEnabledOs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -700,7 +888,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithFi _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_GPUMIG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_GPUMIG.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithGpumig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -790,7 +978,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithGp _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_HTTPProxy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_HTTPProxy.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithHttpProxyConfigured() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -879,7 +1067,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithHt _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_NodePublicIPPrefix.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithNodePublicIpPrefix() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -961,7 +1149,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithNo _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_OSSKU.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_OSSKU.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithOssku() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1051,7 +1239,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithOs _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_PPG.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_PPG.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPpg() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1133,7 +1321,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPp _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_PodIdentity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_PodIdentity.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPodIdentityEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1218,7 +1406,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithPo _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_DisableRunCommand.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_DisableRunCommand.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithRunCommandDisabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1302,7 +1490,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithRu _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_SecurityProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_SecurityProfile.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSecurityProfileConfigured() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1375,7 +1563,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithSe _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_EnableUltraSSD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_EnableUltraSSD.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUltraSsdEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1457,7 +1645,78 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUl _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_IngressProfile_WebAppRouting.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithWebAppRoutingIngressProfileConfigured() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS2_v2"), + Name: to.Ptr("nodepool1"), + }}, + DNSPrefix: to.Ptr("dnsprefix1"), + IngressProfile: &armcontainerservice.ManagedClusterIngressProfile{ + WebAppRouting: &armcontainerservice.ManagedClusterIngressProfileWebAppRouting{ + DNSZoneResourceID: to.Ptr("/subscriptions/SUB_ID/resourceGroups/RG_NAME/providers/Microsoft.Network/dnszones/DNS_ZONE_NAME"), + Enabled: to.Ptr(true), + }, + }, + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUNameBasic), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_UserAssignedNATGateway.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUserAssignedNatGatewayAsOutboundType() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1533,7 +1792,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedClusterWithUs _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateClusterWithPublicFqdnSpecified() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1618,7 +1877,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateClusterWithFqdnSubdomainSpecified() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1703,7 +1962,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createManagedPrivateCluste _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateAadManagedClusterWithEnableAzureRbac() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1792,7 +2051,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateAadManagedClus _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_Update.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1889,7 +2148,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_UpdateWithAHUB.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_UpdateWithAHUB.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithEnableAhub() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1981,7 +2240,93 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_UpdateWithEnableNamespaceResources.json +func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithEnableNamespaceResources() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "clustername1", armcontainerservice.ManagedCluster{ + Location: to.Ptr("location1"), + Tags: map[string]*string{ + "archv2": to.Ptr(""), + "tier": to.Ptr("production"), + }, + Properties: &armcontainerservice.ManagedClusterProperties{ + AddonProfiles: map[string]*armcontainerservice.ManagedClusterAddonProfile{}, + AgentPoolProfiles: []*armcontainerservice.ManagedClusterAgentPoolProfile{ + { + Type: to.Ptr(armcontainerservice.AgentPoolTypeVirtualMachineScaleSets), + AvailabilityZones: []*string{ + to.Ptr("1"), + to.Ptr("2"), + to.Ptr("3")}, + Count: to.Ptr[int32](3), + EnableNodePublicIP: to.Ptr(true), + Mode: to.Ptr(armcontainerservice.AgentPoolModeSystem), + OSType: to.Ptr(armcontainerservice.OSTypeLinux), + VMSize: to.Ptr("Standard_DS1_v2"), + Name: to.Ptr("nodepool1"), + }}, + AutoScalerProfile: &armcontainerservice.ManagedClusterPropertiesAutoScalerProfile{ + ScaleDownDelayAfterAdd: to.Ptr("15m"), + ScanInterval: to.Ptr("20s"), + }, + DiskEncryptionSetID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + DNSPrefix: to.Ptr("dnsprefix1"), + EnableNamespaceResources: to.Ptr(true), + EnablePodSecurityPolicy: to.Ptr(true), + EnableRBAC: to.Ptr(true), + KubernetesVersion: to.Ptr(""), + LinuxProfile: &armcontainerservice.LinuxProfile{ + AdminUsername: to.Ptr("azureuser"), + SSH: &armcontainerservice.SSHConfiguration{ + PublicKeys: []*armcontainerservice.SSHPublicKey{ + { + KeyData: to.Ptr("keydata"), + }}, + }, + }, + NetworkProfile: &armcontainerservice.NetworkProfile{ + LoadBalancerProfile: &armcontainerservice.ManagedClusterLoadBalancerProfile{ + ManagedOutboundIPs: &armcontainerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{ + Count: to.Ptr[int32](2), + }, + }, + LoadBalancerSKU: to.Ptr(armcontainerservice.LoadBalancerSKUStandard), + OutboundType: to.Ptr(armcontainerservice.OutboundTypeLoadBalancer), + }, + ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ + ClientID: to.Ptr("clientid"), + Secret: to.Ptr("secret"), + }, + WindowsProfile: &armcontainerservice.ManagedClusterWindowsProfile{ + AdminPassword: to.Ptr("replacePassword1234$"), + AdminUsername: to.Ptr("azureuser"), + }, + }, + SKU: &armcontainerservice.ManagedClusterSKU{ + Name: to.Ptr(armcontainerservice.ManagedClusterSKUNameBasic), + Tier: to.Ptr(armcontainerservice.ManagedClusterSKUTierFree), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_UpdateWindowsGmsa.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithWindowsGMsaEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2075,7 +2420,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersCreate_DualStackNetworking.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersCreate_DualStackNetworking.json func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedClusterWithDualStackNetworking() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2175,7 +2520,7 @@ func ExampleManagedClustersClient_BeginCreateOrUpdate_createUpdateManagedCluster _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersUpdateTags.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersUpdateTags.json func ExampleManagedClustersClient_BeginUpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2203,7 +2548,7 @@ func ExampleManagedClustersClient_BeginUpdateTags() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersDelete.json func ExampleManagedClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2214,7 +2559,7 @@ func ExampleManagedClustersClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, "rg1", "clustername1", nil) + poller, err := client.BeginDelete(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientBeginDeleteOptions{IgnorePodDisruptionBudget: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -2224,7 +2569,7 @@ func ExampleManagedClustersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersResetServicePrincipalProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersResetServicePrincipalProfile.json func ExampleManagedClustersClient_BeginResetServicePrincipalProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2248,7 +2593,7 @@ func ExampleManagedClustersClient_BeginResetServicePrincipalProfile() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersResetAADProfile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersResetAADProfile.json func ExampleManagedClustersClient_BeginResetAADProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2274,7 +2619,24 @@ func ExampleManagedClustersClient_BeginResetAADProfile() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersRotateClusterCertificates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersAbortOperation.json +func ExampleManagedClustersClient_AbortLatestOperation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.AbortLatestOperation(ctx, "rg1", "clustername1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersRotateClusterCertificates.json func ExampleManagedClustersClient_BeginRotateClusterCertificates() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2295,7 +2657,28 @@ func ExampleManagedClustersClient_BeginRotateClusterCertificates() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersStop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersRotateServiceAccountSigningKeys.json +func ExampleManagedClustersClient_BeginRotateServiceAccountSigningKeys() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRotateServiceAccountSigningKeys(ctx, "rg1", "clustername1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersStop.json func ExampleManagedClustersClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2316,7 +2699,7 @@ func ExampleManagedClustersClient_BeginStop() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/ManagedClustersStart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClustersStart.json func ExampleManagedClustersClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2337,7 +2720,7 @@ func ExampleManagedClustersClient_BeginStart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/RunCommandRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/RunCommandRequest.json func ExampleManagedClustersClient_BeginRunCommand() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2364,7 +2747,7 @@ func ExampleManagedClustersClient_BeginRunCommand() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/RunCommandResultFailed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/RunCommandResultFailed.json func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2383,7 +2766,7 @@ func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/RunCommandResultSucceed.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/RunCommandResultSucceed.json func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2402,7 +2785,7 @@ func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-07-01/examples/OutboundNetworkDependenciesEndpointsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/OutboundNetworkDependenciesEndpointsList.json func ExampleManagedClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go new file mode 100644 index 000000000000..7e9b4192f6a2 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client.go @@ -0,0 +1,400 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcontainerservice + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedClusterSnapshotsClient contains the methods for the ManagedClusterSnapshots group. +// Don't use this type directly, use NewManagedClusterSnapshotsClient() instead. +type ManagedClusterSnapshotsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewManagedClusterSnapshotsClient creates a new instance of ManagedClusterSnapshotsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewManagedClusterSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedClusterSnapshotsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ManagedClusterSnapshotsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// parameters - The managed cluster snapshot to create or update. +// options - ManagedClusterSnapshotsClientCreateOrUpdateOptions contains the optional parameters for the ManagedClusterSnapshotsClient.CreateOrUpdate +// method. +func (client *ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot, options *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedClusterSnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot, options *ManagedClusterSnapshotsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagedClusterSnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientCreateOrUpdateResponse, error) { + result := ManagedClusterSnapshotsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// options - ManagedClusterSnapshotsClientDeleteOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Delete +// method. +func (client *ManagedClusterSnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientDeleteOptions) (ManagedClusterSnapshotsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClusterSnapshotsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ManagedClusterSnapshotsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ManagedClusterSnapshotsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedClusterSnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// options - ManagedClusterSnapshotsClientGetOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Get +// method. +func (client *ManagedClusterSnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientGetOptions) (ManagedClusterSnapshotsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) + if err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ManagedClusterSnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClusterSnapshotsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedClusterSnapshotsClient) getHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientGetResponse, error) { + result := ManagedClusterSnapshotsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of managed cluster snapshots in the specified subscription. +// Generated from API version 2022-08-02-preview +// options - ManagedClusterSnapshotsClientListOptions contains the optional parameters for the ManagedClusterSnapshotsClient.List +// method. +func (client *ManagedClusterSnapshotsClient) NewListPager(options *ManagedClusterSnapshotsClientListOptions) *runtime.Pager[ManagedClusterSnapshotsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClusterSnapshotsClientListResponse]{ + More: func(page ManagedClusterSnapshotsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClusterSnapshotsClientListResponse) (ManagedClusterSnapshotsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedClusterSnapshotsClient) listCreateRequest(ctx context.Context, options *ManagedClusterSnapshotsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedClusterSnapshotsClient) listHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientListResponse, error) { + result := ManagedClusterSnapshotsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshotListResult); err != nil { + return ManagedClusterSnapshotsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists managed cluster snapshots in the specified subscription and resource group. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - ManagedClusterSnapshotsClientListByResourceGroupOptions contains the optional parameters for the ManagedClusterSnapshotsClient.ListByResourceGroup +// method. +func (client *ManagedClusterSnapshotsClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedClusterSnapshotsClientListByResourceGroupOptions) *runtime.Pager[ManagedClusterSnapshotsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedClusterSnapshotsClientListByResourceGroupResponse]{ + More: func(page ManagedClusterSnapshotsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedClusterSnapshotsClientListByResourceGroupResponse) (ManagedClusterSnapshotsClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ManagedClusterSnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ManagedClusterSnapshotsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ManagedClusterSnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientListByResourceGroupResponse, error) { + result := ManagedClusterSnapshotsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshotListResult); err != nil { + return ManagedClusterSnapshotsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// UpdateTags - Updates tags on a managed cluster snapshot. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-02-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// resourceName - The name of the managed cluster resource. +// parameters - Parameters supplied to the Update managed cluster snapshot Tags operation. +// options - ManagedClusterSnapshotsClientUpdateTagsOptions contains the optional parameters for the ManagedClusterSnapshotsClient.UpdateTags +// method. +func (client *ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClusterSnapshotsClientUpdateTagsOptions) (ManagedClusterSnapshotsClientUpdateTagsResponse, error) { + req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) + if err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + } + return client.updateTagsHandleResponse(resp) +} + +// updateTagsCreateRequest creates the UpdateTags request. +func (client *ManagedClusterSnapshotsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClusterSnapshotsClientUpdateTagsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateTagsHandleResponse handles the UpdateTags response. +func (client *ManagedClusterSnapshotsClient) updateTagsHandleResponse(resp *http.Response) (ManagedClusterSnapshotsClientUpdateTagsResponse, error) { + result := ManagedClusterSnapshotsClientUpdateTagsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterSnapshot); err != nil { + return ManagedClusterSnapshotsClientUpdateTagsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go new file mode 100644 index 000000000000..58a65984fff1 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/managedclustersnapshots_client_example_test.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsList.json +func ExampleManagedClusterSnapshotsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsListByResourceGroup.json +func ExampleManagedClusterSnapshotsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("rg1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsGet.json +func ExampleManagedClusterSnapshotsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "rg1", "snapshot1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsCreate.json +func ExampleManagedClusterSnapshotsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "rg1", "snapshot1", armcontainerservice.ManagedClusterSnapshot{ + Location: to.Ptr("westus"), + Tags: map[string]*string{ + "key1": to.Ptr("val1"), + "key2": to.Ptr("val2"), + }, + Properties: &armcontainerservice.ManagedClusterSnapshotProperties{ + CreationData: &armcontainerservice.CreationData{ + SourceResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsUpdateTags.json +func ExampleManagedClusterSnapshotsClient_UpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.UpdateTags(ctx, "rg1", "snapshot1", armcontainerservice.TagsObject{ + Tags: map[string]*string{ + "key2": to.Ptr("new-val2"), + "key3": to.Ptr("val3"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/ManagedClusterSnapshotsDelete.json +func ExampleManagedClusterSnapshotsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewManagedClusterSnapshotsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "rg1", "snapshot1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/models.go b/sdk/resourcemanager/containerservice/armcontainerservice/models.go index 5211b6379970..ba70cbbb6a5f 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/models.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/models.go @@ -121,6 +121,19 @@ type AgentPoolUpgradeSettings struct { MaxSurge *string `json:"maxSurge,omitempty"` } +// AgentPoolWindowsProfile - The Windows agent pool's specific profile. +type AgentPoolWindowsProfile struct { + // The default value is false. Outbound NAT can only be disabled if the cluster outboundType is NAT Gateway and the Windows + // agent pool does not have node public IP enabled. + DisableOutboundNat *bool `json:"disableOutboundNat,omitempty"` +} + +// AgentPoolsClientAbortLatestOperationOptions contains the optional parameters for the AgentPoolsClient.AbortLatestOperation +// method. +type AgentPoolsClientAbortLatestOperationOptions struct { + // placeholder for future optional parameters +} + // AgentPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginCreateOrUpdate // method. type AgentPoolsClientBeginCreateOrUpdateOptions struct { @@ -130,6 +143,8 @@ type AgentPoolsClientBeginCreateOrUpdateOptions struct { // AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. type AgentPoolsClientBeginDeleteOptions struct { + // ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget + IgnorePodDisruptionBudget *bool // Resumes the LRO from the provided token. ResumeToken string } @@ -183,27 +198,6 @@ type AzureKeyVaultKms struct { KeyVaultResourceID *string `json:"keyVaultResourceId,omitempty"` } -// CloudError - An error response from the Container service. -type CloudError struct { - // Details about the error. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the Container service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} - // CommandResultProperties - The results of a run command type CommandResultProperties struct { // READ-ONLY; The exit code of the command @@ -246,12 +240,6 @@ type CredentialResults struct { Kubeconfigs []*CredentialResult `json:"kubeconfigs,omitempty" azure:"ro"` } -// DiagnosticsProfile - Profile for diagnostics on the container service cluster. -type DiagnosticsProfile struct { - // REQUIRED; Profile for diagnostics on the container service VMs. - VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` -} - // EndpointDependency - A domain name that AKS agent nodes are reaching at. type EndpointDependency struct { // The domain name of the dependency. @@ -285,6 +273,222 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes `json:"type,omitempty"` } +// Fleet - The Fleet resource which contains multiple Kubernetes clusters as its members. +type Fleet struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Properties of a Fleet. + Properties *FleetProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FleetCredentialResult - The credential result response. +type FleetCredentialResult struct { + // READ-ONLY; The name of the credential. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Value []byte `json:"value,omitempty" azure:"ro"` +} + +// FleetCredentialResults - The list credential result response. +type FleetCredentialResults struct { + // READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs []*FleetCredentialResult `json:"kubeconfigs,omitempty" azure:"ro"` +} + +// FleetHubProfile - The FleetHubProfile configures the fleet hub. +type FleetHubProfile struct { + // DNS prefix used to create the FQDN for the Fleet hub. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + + // READ-ONLY; The FQDN of the Fleet hub. + Fqdn *string `json:"fqdn,omitempty" azure:"ro"` + + // READ-ONLY; The Kubernetes version of the Fleet hub. + KubernetesVersion *string `json:"kubernetesVersion,omitempty" azure:"ro"` +} + +// FleetListResult - The response from the List Fleets operation. +type FleetListResult struct { + // The list of Fleets. + Value []*Fleet `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next page of Fleets. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// FleetMember - A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. +type FleetMember struct { + // Properties of a Fleet member. + Properties *FleetMemberProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FleetMemberProperties - Properties of a Fleet member. +type FleetMemberProperties struct { + // The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + + // READ-ONLY; The provisioning state of the last accepted operation. + ProvisioningState *FleetMemberProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// FleetMembersClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetMembersClient.BeginCreateOrUpdate +// method. +type FleetMembersClientBeginCreateOrUpdateOptions struct { + // Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Set to '*' to allow a new resource to be created and prevent updating an existing resource. Other values will result in + // a 412 Pre-condition Failed response. + IfNoneMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetMembersClientBeginDeleteOptions contains the optional parameters for the FleetMembersClient.BeginDelete method. +type FleetMembersClientBeginDeleteOptions struct { + // Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetMembersClientGetOptions contains the optional parameters for the FleetMembersClient.Get method. +type FleetMembersClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetMembersClientListByFleetOptions contains the optional parameters for the FleetMembersClient.ListByFleet method. +type FleetMembersClientListByFleetOptions struct { + // placeholder for future optional parameters +} + +// FleetMembersListResult - The response from the List FleetMembers operation. +type FleetMembersListResult struct { + // The list of members in a given Fleet. + Value []*FleetMember `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next page of Fleet members. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// FleetPatch - Properties of a Fleet that can be patched. +type FleetPatch struct { + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// FleetProperties - Properties of a Fleet. +type FleetProperties struct { + // The FleetHubProfile configures the Fleet's hub. + HubProfile *FleetHubProfile `json:"hubProfile,omitempty"` + + // READ-ONLY; The provisioning state of the last accepted operation. + ProvisioningState *FleetProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. +type FleetsClientBeginCreateOrUpdateOptions struct { + // Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Set to '*' to allow a new resource to be created and prevent updating an existing resource. Other values will result in + // a 412 Pre-condition Failed response. + IfNoneMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +type FleetsClientBeginDeleteOptions struct { + // Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +type FleetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.ListByResourceGroup method. +type FleetsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListCredentialsOptions contains the optional parameters for the FleetsClient.ListCredentials method. +type FleetsClientListCredentialsOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListOptions contains the optional parameters for the FleetsClient.List method. +type FleetsClientListOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientUpdateOptions contains the optional parameters for the FleetsClient.Update method. +type FleetsClientUpdateOptions struct { + // Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // The properties of a Fleet to update. + Parameters *FleetPatch +} + +// GuardrailsProfile - The Guardrails profile. +type GuardrailsProfile struct { + // REQUIRED; The guardrails level to be used. By default, Guardrails is enabled for all namespaces except those that AKS excludes + // via systemExcludedNamespaces + Level *Level `json:"level,omitempty"` + + // REQUIRED; The version of constraints to use + Version *string `json:"version,omitempty"` + + // List of namespaces excluded from guardrails checks + ExcludedNamespaces []*string `json:"excludedNamespaces,omitempty"` + + // READ-ONLY; List of namespaces specified by AKS to be excluded from Guardrails + SystemExcludedNamespaces []*string `json:"systemExcludedNamespaces,omitempty" azure:"ro"` +} + // KubeletConfig - See AKS custom node configuration [https://docs.microsoft.com/azure/aks/custom-node-configuration] for // more details. type KubeletConfig struct { @@ -490,9 +694,16 @@ type ManagedClusterAPIServerAccessProfile struct { // Whether to create additional public FQDN for private cluster or not. EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` + // Whether to enable apiserver vnet integration for the cluster or not. + EnableVnetIntegration *bool `json:"enableVnetIntegration,omitempty"` + // The default is System. For more details see configure private DNS zone [https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone]. // Allowed values are 'system' and 'none'. PrivateDNSZone *string `json:"privateDNSZone,omitempty"` + + // It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an existing cluster to enable apiserver vnet + // integration. + SubnetID *string `json:"subnetId,omitempty"` } // ManagedClusterAccessProfile - Managed cluster Access Profile. @@ -551,6 +762,9 @@ type ManagedClusterAgentPoolProfile struct { // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. AvailabilityZones []*string `json:"availabilityZones,omitempty"` + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user // pools and in the range of 1 to 1000 (inclusive) for system pools. The default // value is 1. @@ -562,6 +776,10 @@ type ManagedClusterAgentPoolProfile struct { // Whether to enable auto-scaler EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // When set to true, AKS deploys a daemonset and host services to sync custom certificate authorities from a user-provided + // config map into node trust stores. Defaults to false. + EnableCustomCATrust *bool `json:"enableCustomCATrust,omitempty"` + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` @@ -602,6 +820,11 @@ type ManagedClusterAgentPoolProfile struct { // The maximum number of pods that can run on a node. MaxPods *int32 `json:"maxPods,omitempty"` + // A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of + // the day for Linux nodes. It must not be specified for Windows nodes. It must be a + // static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // The minimum number of nodes for auto-scaling MinCount *int32 `json:"minCount,omitempty"` @@ -627,20 +850,21 @@ type ManagedClusterAgentPoolProfile struct { // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. OSDiskType *OSDiskType `json:"osDiskType,omitempty"` - // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when - // Kubernetes = 1.25 if OSType is Windows. + // Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if + // OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 + // after Windows2019 is deprecated. OSSKU *OSSKU `json:"osSKU,omitempty"` // The operating system type. The default is Linux. OSType *OSType `json:"osType,omitempty"` - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, - // you should upgrade all node pools in an AKS cluster to the same Kubernetes - // version. The node pool version must have the same major version as the control plane. The node pool minor version must - // be within two minor versions of the control plane version. The node pool version - // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + // Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating + // the agent pool with the same once it has been created will not trigger an + // upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster + // to the same Kubernetes version. The node pool version must have the same + // major version as the control plane. The node pool minor version must be within two minor versions of the control plane + // version. The node pool version cannot be greater than the control plane version. + // For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: @@ -688,11 +912,14 @@ type ManagedClusterAgentPoolProfile struct { // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // The Windows agent pool's specific profile. + WindowsProfile *AgentPoolWindowsProfile `json:"windowsProfile,omitempty"` + // Determines the type of workload a node can run. WorkloadRuntime *WorkloadRuntime `json:"workloadRuntime,omitempty"` - // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion - // is , this field will contain the full version being used. + // READ-ONLY; If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // was , this field will contain the full version being used. CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty" azure:"ro"` // READ-ONLY; The version of node image @@ -707,6 +934,9 @@ type ManagedClusterAgentPoolProfileProperties struct { // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. AvailabilityZones []*string `json:"availabilityZones,omitempty"` + // AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user // pools and in the range of 1 to 1000 (inclusive) for system pools. The default // value is 1. @@ -718,6 +948,10 @@ type ManagedClusterAgentPoolProfileProperties struct { // Whether to enable auto-scaler EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // When set to true, AKS deploys a daemonset and host services to sync custom certificate authorities from a user-provided + // config map into node trust stores. Defaults to false. + EnableCustomCATrust *bool `json:"enableCustomCATrust,omitempty"` + // This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` @@ -758,6 +992,11 @@ type ManagedClusterAgentPoolProfileProperties struct { // The maximum number of pods that can run on a node. MaxPods *int32 `json:"maxPods,omitempty"` + // A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of + // the day for Linux nodes. It must not be specified for Windows nodes. It must be a + // static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // The minimum number of nodes for auto-scaling MinCount *int32 `json:"minCount,omitempty"` @@ -783,20 +1022,21 @@ type ManagedClusterAgentPoolProfileProperties struct { // see Ephemeral OS [https://docs.microsoft.com/azure/aks/cluster-configuration#ephemeral-os]. OSDiskType *OSDiskType `json:"osDiskType,omitempty"` - // Specifies the OS SKU used by the agent pool. The default is Ubuntu if OSType is Linux. The default is Windows2019 when - // Kubernetes = 1.25 if OSType is Windows. + // Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if + // OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 + // after Windows2019 is deprecated. OSSKU *OSSKU `json:"osSKU,omitempty"` // The operating system type. The default is Linux. OSType *OSType `json:"osType,omitempty"` - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. As a best practice, - // you should upgrade all node pools in an AKS cluster to the same Kubernetes - // version. The node pool version must have the same major version as the control plane. The node pool minor version must - // be within two minor versions of the control plane version. The node pool version - // cannot be greater than the control plane version. For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. + // Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating + // the agent pool with the same once it has been created will not trigger an + // upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster + // to the same Kubernetes version. The node pool version must have the same + // major version as the control plane. The node pool minor version must be within two minor versions of the control plane + // version. The node pool version cannot be greater than the control plane version. + // For more information see upgrading a node pool [https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool]. OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` // If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: @@ -844,11 +1084,14 @@ type ManagedClusterAgentPoolProfileProperties struct { // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // The Windows agent pool's specific profile. + WindowsProfile *AgentPoolWindowsProfile `json:"windowsProfile,omitempty"` + // Determines the type of workload a node can run. WorkloadRuntime *WorkloadRuntime `json:"workloadRuntime,omitempty"` - // READ-ONLY; If orchestratorVersion is a fully specified version , this field will be exactly equal to it. If orchestratorVersion - // is , this field will contain the full version being used. + // READ-ONLY; If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion + // was , this field will contain the full version being used. CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty" azure:"ro"` // READ-ONLY; The version of node image @@ -864,6 +1107,31 @@ type ManagedClusterAutoUpgradeProfile struct { UpgradeChannel *UpgradeChannel `json:"upgradeChannel,omitempty"` } +// ManagedClusterAzureMonitorProfile - Prometheus addon profile for the container service cluster +type ManagedClusterAzureMonitorProfile struct { + // Metrics profile for the prometheus service addon + Metrics *ManagedClusterAzureMonitorProfileMetrics `json:"metrics,omitempty"` +} + +// ManagedClusterAzureMonitorProfileKubeStateMetrics - Kube State Metrics for prometheus addon profile for the container service +// cluster +type ManagedClusterAzureMonitorProfileKubeStateMetrics struct { + // Comma-separated list of additional Kubernetes label keys that will be used in the resource's labels metric. + MetricAnnotationsAllowList *string `json:"metricAnnotationsAllowList,omitempty"` + + // Comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. + MetricLabelsAllowlist *string `json:"metricLabelsAllowlist,omitempty"` +} + +// ManagedClusterAzureMonitorProfileMetrics - Metrics profile for the prometheus service addon +type ManagedClusterAzureMonitorProfileMetrics struct { + // REQUIRED; Whether to enable the Prometheus collector + Enabled *bool `json:"enabled,omitempty"` + + // Kube State Metrics for prometheus addon profile for the container service cluster + KubeStateMetrics *ManagedClusterAzureMonitorProfileKubeStateMetrics `json:"kubeStateMetrics,omitempty"` +} + // ManagedClusterHTTPProxyConfig - Cluster HTTP proxy configuration. type ManagedClusterHTTPProxyConfig struct { // The HTTP proxy server endpoint to use. @@ -877,6 +1145,10 @@ type ManagedClusterHTTPProxyConfig struct { // Alternative CA cert to use for connecting to proxy servers. TrustedCa *string `json:"trustedCa,omitempty"` + + // READ-ONLY; A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset + // of noProxy and values injected by AKS. + EffectiveNoProxy []*string `json:"effectiveNoProxy,omitempty" azure:"ro"` } // ManagedClusterIdentity - Identity for the managed cluster. @@ -894,6 +1166,21 @@ type ManagedClusterIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } +// ManagedClusterIngressProfile - Ingress profile for the container service cluster. +type ManagedClusterIngressProfile struct { + // Web App Routing settings for the ingress profile. + WebAppRouting *ManagedClusterIngressProfileWebAppRouting `json:"webAppRouting,omitempty"` +} + +// ManagedClusterIngressProfileWebAppRouting - Web App Routing settings for the ingress profile. +type ManagedClusterIngressProfileWebAppRouting struct { + // Resource ID of the DNS Zone to be associated with the web app. Used only when Web App Routing is enabled. + DNSZoneResourceID *string `json:"dnsZoneResourceId,omitempty"` + + // Whether to enable Web App Routing. + Enabled *bool `json:"enabled,omitempty"` +} + // ManagedClusterListResult - The response from the List Managed Clusters operation. type ManagedClusterListResult struct { // The list of managed clusters. @@ -909,6 +1196,9 @@ type ManagedClusterLoadBalancerProfile struct { // value is 0 which results in Azure dynamically allocating ports. AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // The type of the managed inbound Load Balancer BackendPool. + BackendPoolType *BackendPoolType `json:"backendPoolType,omitempty"` + // The effective outbound IP resources of the cluster load balancer. EffectiveOutboundIPs []*ResourceReference `json:"effectiveOutboundIPs,omitempty"` @@ -973,6 +1263,15 @@ type ManagedClusterNATGatewayProfile struct { ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` } +// ManagedClusterOIDCIssuerProfile - The OIDC issuer profile of the Managed Cluster. +type ManagedClusterOIDCIssuerProfile struct { + // Whether the OIDC issuer is enabled. + Enabled *bool `json:"enabled,omitempty"` + + // READ-ONLY; The OIDC issuer url of the Managed Cluster. + IssuerURL *string `json:"issuerURL,omitempty" azure:"ro"` +} + // ManagedClusterPodIdentity - Details about the pod identity assigned to the Managed Cluster. type ManagedClusterPodIdentity struct { // REQUIRED; The user assigned identity details. @@ -1095,6 +1394,12 @@ type ManagedClusterProperties struct { // The auto upgrade configuration. AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` + // Prometheus addon profile for the container service cluster + AzureMonitorProfile *ManagedClusterAzureMonitorProfile `json:"azureMonitorProfile,omitempty"` + + // CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // This cannot be updated once the Managed Cluster has been created. DNSPrefix *string `json:"dnsPrefix,omitempty"` @@ -1106,6 +1411,11 @@ type ManagedClusterProperties struct { // This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` + // The default value is false. It can be enabled/disabled on creation and updation of the managed cluster. See https://aka.ms/NamespaceARMResource + // [https://aka.ms/NamespaceARMResource] for more details + // on Namespace as a ARM Resource. + EnableNamespaceResources *bool `json:"enableNamespaceResources,omitempty"` + // (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, // 2020. Learn more at aka.ms/aks/azpodpolicy. EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` @@ -1116,19 +1426,22 @@ type ManagedClusterProperties struct { // This cannot be updated once the Managed Cluster has been created. FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` + // The guardrails profile holds all the guardrails information for a given cluster + GuardrailsProfile *GuardrailsProfile `json:"guardrailsProfile,omitempty"` + // Configurations for provisioning the cluster with HTTP proxy servers. HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` // Identities associated with the cluster. IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile,omitempty"` - // Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported GA patch version - // is chosen automatically. Updating the cluster with the same once it has been - // created (e.g. 1.14.x -> 1.14) will not trigger an upgrade, even if a newer patch version is available. When you upgrade - // a supported AKS cluster, Kubernetes minor versions cannot be skipped. All - // upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x - // -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading - // an AKS cluster [https://docs.microsoft.com/azure/aks/upgrade-cluster] for more details. + // Ingress profile for the managed cluster. + IngressProfile *ManagedClusterIngressProfile `json:"ingressProfile,omitempty"` + + // When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially + // by major version number. For example, upgrades between 1.14.x -> + // 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading an AKS cluster [https://docs.microsoft.com/azure/aks/upgrade-cluster] + // for more details. KubernetesVersion *string `json:"kubernetesVersion,omitempty"` // The profile for Linux VMs in the Managed Cluster. @@ -1140,6 +1453,9 @@ type ManagedClusterProperties struct { // The name of the resource group containing agent pool nodes. NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + // The OIDC issuer profile of the Managed Cluster. + OidcIssuerProfile *ManagedClusterOIDCIssuerProfile `json:"oidcIssuerProfile,omitempty"` + // See use AAD pod identity [https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity] for more details on AAD pod identity // integration. PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` @@ -1162,13 +1478,15 @@ type ManagedClusterProperties struct { // The profile for Windows VMs in the Managed Cluster. WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` + // Workload Auto-scaler profile for the container service cluster. + WorkloadAutoScalerProfile *ManagedClusterWorkloadAutoScalerProfile `json:"workloadAutoScalerProfile,omitempty"` + // READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, // which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, // allowing the Azure Portal to function properly. AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty" azure:"ro"` - // READ-ONLY; If kubernetesVersion was a fully specified version , this field will be exactly equal to it. If kubernetesVersion - // was , this field will contain the full version being used. + // READ-ONLY; The version of Kubernetes the Managed Cluster is running. CurrentKubernetesVersion *string `json:"currentKubernetesVersion,omitempty" azure:"ro"` // READ-ONLY; The FQDN of the master pool. @@ -1246,6 +1564,21 @@ type ManagedClusterPropertiesAutoScalerProfile struct { SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` } +// ManagedClusterPropertiesForSnapshot - managed cluster properties for snapshot, these properties are read only. +type ManagedClusterPropertiesForSnapshot struct { + // Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + EnableRbac *bool `json:"enableRbac,omitempty"` + + // The current kubernetes version. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + + // The current managed cluster sku. + SKU *ManagedClusterSKU `json:"sku,omitempty"` + + // READ-ONLY; The current network profile. + NetworkProfile *NetworkProfileForSnapshot `json:"networkProfile,omitempty" azure:"ro"` +} + // ManagedClusterSKU - The SKU of a Managed Cluster. type ManagedClusterSKU struct { // The name of a managed cluster SKU. @@ -1263,6 +1596,16 @@ type ManagedClusterSecurityProfile struct { // Microsoft Defender settings for the security profile. Defender *ManagedClusterSecurityProfileDefender `json:"defender,omitempty"` + + // ImageCleaner settings for the security profile. + ImageCleaner *ManagedClusterSecurityProfileImageCleaner `json:"imageCleaner,omitempty"` + + // Node Restriction [https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction] settings + // for the security profile. + NodeRestriction *ManagedClusterSecurityProfileNodeRestriction `json:"nodeRestriction,omitempty"` + + // Workload Identity [https://azure.github.io/azure-workload-identity/docs/] settings for the security profile. + WorkloadIdentity *ManagedClusterSecurityProfileWorkloadIdentity `json:"workloadIdentity,omitempty"` } // ManagedClusterSecurityProfileDefender - Microsoft Defender settings for the security profile. @@ -1282,6 +1625,28 @@ type ManagedClusterSecurityProfileDefenderSecurityMonitoring struct { Enabled *bool `json:"enabled,omitempty"` } +// ManagedClusterSecurityProfileImageCleaner - ImageCleaner removes unused images from nodes, freeing up disk space and helping +// to reduce attack surface area. Here are settings for the security profile. +type ManagedClusterSecurityProfileImageCleaner struct { + // Whether to enable ImageCleaner on AKS cluster. + Enabled *bool `json:"enabled,omitempty"` + + // ImageCleaner scanning interval. + IntervalHours *int32 `json:"intervalHours,omitempty"` +} + +// ManagedClusterSecurityProfileNodeRestriction - Node Restriction settings for the security profile. +type ManagedClusterSecurityProfileNodeRestriction struct { + // Whether to enable Node Restriction + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterSecurityProfileWorkloadIdentity - Workload Identity settings for the security profile. +type ManagedClusterSecurityProfileWorkloadIdentity struct { + // Whether to enable Workload Identity + Enabled *bool `json:"enabled,omitempty"` +} + // ManagedClusterServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating // Azure APIs. type ManagedClusterServicePrincipalProfile struct { @@ -1292,8 +1657,90 @@ type ManagedClusterServicePrincipalProfile struct { Secret *string `json:"secret,omitempty"` } +// ManagedClusterSnapshot - A managed cluster snapshot resource. +type ManagedClusterSnapshot struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Properties of a managed cluster snapshot. + Properties *ManagedClusterSnapshotProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ManagedClusterSnapshotListResult - The response from the List Managed Cluster Snapshots operation. +type ManagedClusterSnapshotListResult struct { + // The list of managed cluster snapshots. + Value []*ManagedClusterSnapshot `json:"value,omitempty"` + + // READ-ONLY; The URL to get the next set of managed cluster snapshot results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ManagedClusterSnapshotProperties - Properties for a managed cluster snapshot. +type ManagedClusterSnapshotProperties struct { + // CreationData to be used to specify the source resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + + // The type of a snapshot. The default is NodePool. + SnapshotType *SnapshotType `json:"snapshotType,omitempty"` + + // READ-ONLY; What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + ManagedClusterPropertiesReadOnly *ManagedClusterPropertiesForSnapshot `json:"managedClusterPropertiesReadOnly,omitempty" azure:"ro"` +} + +// ManagedClusterSnapshotsClientCreateOrUpdateOptions contains the optional parameters for the ManagedClusterSnapshotsClient.CreateOrUpdate +// method. +type ManagedClusterSnapshotsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientDeleteOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Delete +// method. +type ManagedClusterSnapshotsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientGetOptions contains the optional parameters for the ManagedClusterSnapshotsClient.Get method. +type ManagedClusterSnapshotsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientListByResourceGroupOptions contains the optional parameters for the ManagedClusterSnapshotsClient.ListByResourceGroup +// method. +type ManagedClusterSnapshotsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientListOptions contains the optional parameters for the ManagedClusterSnapshotsClient.List method. +type ManagedClusterSnapshotsClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedClusterSnapshotsClientUpdateTagsOptions contains the optional parameters for the ManagedClusterSnapshotsClient.UpdateTags +// method. +type ManagedClusterSnapshotsClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} + // ManagedClusterStorageProfile - Storage profile for the container service cluster. type ManagedClusterStorageProfile struct { + // AzureBlob CSI Driver settings for the storage profile. + BlobCSIDriver *ManagedClusterStorageProfileBlobCSIDriver `json:"blobCSIDriver,omitempty"` + // AzureDisk CSI Driver settings for the storage profile. DiskCSIDriver *ManagedClusterStorageProfileDiskCSIDriver `json:"diskCSIDriver,omitempty"` @@ -1304,10 +1751,19 @@ type ManagedClusterStorageProfile struct { SnapshotController *ManagedClusterStorageProfileSnapshotController `json:"snapshotController,omitempty"` } +// ManagedClusterStorageProfileBlobCSIDriver - AzureBlob CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileBlobCSIDriver struct { + // Whether to enable AzureBlob CSI Driver. The default value is false. + Enabled *bool `json:"enabled,omitempty"` +} + // ManagedClusterStorageProfileDiskCSIDriver - AzureDisk CSI Driver settings for the storage profile. type ManagedClusterStorageProfileDiskCSIDriver struct { // Whether to enable AzureDisk CSI Driver. The default value is true. Enabled *bool `json:"enabled,omitempty"` + + // The version of AzureDisk CSI Driver. The default value is v1. + Version *string `json:"version,omitempty"` } // ManagedClusterStorageProfileFileCSIDriver - AzureFile CSI Driver settings for the storage profile. @@ -1380,6 +1836,39 @@ type ManagedClusterWindowsProfile struct { LicenseType *LicenseType `json:"licenseType,omitempty"` } +// ManagedClusterWorkloadAutoScalerProfile - Workload Auto-scaler profile for the container service cluster. +type ManagedClusterWorkloadAutoScalerProfile struct { + // KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. + Keda *ManagedClusterWorkloadAutoScalerProfileKeda `json:"keda,omitempty"` + VerticalPodAutoscaler *ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler `json:"verticalPodAutoscaler,omitempty"` +} + +// ManagedClusterWorkloadAutoScalerProfileKeda - KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler +// profile. +type ManagedClusterWorkloadAutoScalerProfileKeda struct { + // REQUIRED; Whether to enable KEDA. + Enabled *bool `json:"enabled,omitempty"` +} + +type ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler struct { + // REQUIRED; Controls which resource value autoscaler will change. Default value is RequestsAndLimits. + ControlledValues *ControlledValues `json:"controlledValues,omitempty"` + + // REQUIRED; Whether to enable VPA. Default value is false. + Enabled *bool `json:"enabled,omitempty"` + + // REQUIRED; Each update mode level is a superset of the lower levels. Off 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRoleBindingsClientListResponse) (TrustedAccessRoleBindingsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TrustedAccessRoleBindingsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRoleBindingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *TrustedAccessRoleBindingsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRoleBindingsClient) listHandleResponse(resp *http.Response) (TrustedAccessRoleBindingsClientListResponse, error) { + result := TrustedAccessRoleBindingsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleBindingListResult); err != nil { + return TrustedAccessRoleBindingsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go new file mode 100644 index 000000000000..0254826b8d7e --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessrolebindings_client_example_test.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcontainerservice_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/TrustedAccessRoleBindings_List.json +func ExampleTrustedAccessRoleBindingsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewTrustedAccessRoleBindingsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("rg1", "clustername1", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/TrustedAccessRoleBindings_Get.json +func ExampleTrustedAccessRoleBindingsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewTrustedAccessRoleBindingsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "rg1", "clustername1", "binding1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/TrustedAccessRoleBindings_CreateOrUpdate.json +func ExampleTrustedAccessRoleBindingsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewTrustedAccessRoleBindingsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "rg1", "clustername1", "binding1", armcontainerservice.TrustedAccessRoleBinding{ + Properties: &armcontainerservice.TrustedAccessRoleBindingProperties{ + Roles: []*string{ + to.Ptr("Microsoft.MachineLearningServices/workspaces/reader"), + to.Ptr("Microsoft.MachineLearningServices/workspaces/writer")}, + SourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/b/providers/Microsoft.MachineLearningServices/workspaces/c"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/TrustedAccessRoleBindings_Delete.json +func ExampleTrustedAccessRoleBindingsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armcontainerservice.NewTrustedAccessRoleBindingsClient("subid1", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "rg1", "clustername1", "binding1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go new file mode 100644 index 000000000000..c69122428dd3 --- /dev/null +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcontainerservice + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TrustedAccessRolesClient contains the methods for the TrustedAccessRoles group. +// Don't use this type directly, use NewTrustedAccessRolesClient() instead. +type TrustedAccessRolesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewTrustedAccessRolesClient creates a new instance of TrustedAccessRolesClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewTrustedAccessRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrustedAccessRolesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TrustedAccessRolesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - List supported trusted access roles. +// Generated from API version 2022-08-02-preview +// location - The name of Azure region. +// options - TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.List method. +func (client *TrustedAccessRolesClient) NewListPager(location string, options *TrustedAccessRolesClientListOptions) *runtime.Pager[TrustedAccessRolesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TrustedAccessRolesClientListResponse]{ + More: func(page TrustedAccessRolesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TrustedAccessRolesClientListResponse) (TrustedAccessRolesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TrustedAccessRolesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *TrustedAccessRolesClient) listCreateRequest(ctx context.Context, location string, options *TrustedAccessRolesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-02-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TrustedAccessRolesClient) listHandleResponse(resp *http.Response) (TrustedAccessRolesClientListResponse, error) { + result := TrustedAccessRolesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TrustedAccessRoleListResult); err != nil { + return TrustedAccessRolesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go similarity index 65% rename from sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_operations_client_test.go rename to sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go index 4de2ac3b6189..becbe4985628 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/trustedaccessroles_client_example_test.go @@ -6,28 +6,28 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -package armdynatrace_test +package armcontainerservice_test import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/preview/2022-08-02-preview/examples/TrustedAccessRoles_List.json +func ExampleTrustedAccessRolesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armdynatrace.NewOperationsClient(cred, nil) + client, err := armcontainerservice.NewTrustedAccessRolesClient("subid1", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager(nil) + pager := client.NewListPager("westus2", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/CHANGELOG.md b/sdk/resourcemanager/dynatrace/armdynatrace/CHANGELOG.md index 8cd28011e82b..6179e8801d95 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/CHANGELOG.md +++ b/sdk/resourcemanager/dynatrace/armdynatrace/CHANGELOG.md @@ -1,5 +1,10 @@ # Release History +## 1.0.0 (2022-09-20) +### Other Changes + +- Release stable version. + ## 0.1.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.1.0, which contains breaking changes. diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/autorest.md b/sdk/resourcemanager/dynatrace/armdynatrace/autorest.md index 72b49bc83143..5906e3a4ef29 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/autorest.md +++ b/sdk/resourcemanager/dynatrace/armdynatrace/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/dynatrace/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/dynatrace/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/3751f321654db00858e70649291af5c81e94611e/specification/dynatrace/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3751f321654db00858e70649291af5c81e94611e/specification/dynatrace/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/build.go b/sdk/resourcemanager/dynatrace/armdynatrace/build.go index 401ac4aa3a62..0e4b463dccb8 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/build.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/dynatrace/armdynatrace +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/dynatrace/armdynatrace package armdynatrace diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_constants.go b/sdk/resourcemanager/dynatrace/armdynatrace/constants.go similarity index 99% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_constants.go rename to sdk/resourcemanager/dynatrace/armdynatrace/constants.go index 2c68940444ed..54685c6142ef 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_constants.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace const ( moduleName = "armdynatrace" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/go.mod b/sdk/resourcemanager/dynatrace/armdynatrace/go.mod index 58030a3f57d2..6219fee474ee 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/go.mod +++ b/sdk/resourcemanager/dynatrace/armdynatrace/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/go.sum b/sdk/resourcemanager/dynatrace/armdynatrace/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/go.sum +++ b/sdk/resourcemanager/dynatrace/armdynatrace/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models.go b/sdk/resourcemanager/dynatrace/armdynatrace/models.go similarity index 87% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models.go rename to sdk/resourcemanager/dynatrace/armdynatrace/models.go index 3e6249fbb411..bab5e7ad45da 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace @@ -63,10 +64,10 @@ type AppServiceInfo struct { // AppServiceListResponse - Response of a list App Services Operation. type AppServiceListResponse struct { - // REQUIRED; The link to the next page of items + // The link to the next page of items NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page + // The items on this page Value []*AppServiceInfo `json:"value,omitempty"` } @@ -100,40 +101,6 @@ type EnvironmentProperties struct { UserID *string `json:"userId,omitempty"` } -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` - - // READ-ONLY; The additional info type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error details. - Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The error target. - Target *string `json:"target,omitempty" azure:"ro"` -} - -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - // FilteringTag - The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them // from being monitored. type FilteringTag struct { @@ -277,11 +244,11 @@ type MonitorResource struct { // MonitorResourceListResult - The response of a MonitorResource list operation. type MonitorResourceListResult struct { - // REQUIRED; The link to the next page of items - NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page Value []*MonitorResource `json:"value,omitempty"` + + // The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` } // MonitorResourceUpdate - The updatable properties of the MonitorResource. @@ -325,10 +292,10 @@ type MonitoredResource struct { // MonitoredResourceListResponse - List of all the resources being monitored by Dynatrace monitor resource type MonitoredResourceListResponse struct { - // REQUIRED; The link to the next page of items + // The link to the next page of items NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page + // The items on this page Value []*MonitoredResource `json:"value,omitempty"` } @@ -485,31 +452,6 @@ type PlanData struct { UsageType *string `json:"usageType,omitempty"` } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // SSODetailsRequest - Request for getting sso details for a user type SSODetailsRequest struct { // user principal id of the user @@ -589,11 +531,11 @@ type SingleSignOnResource struct { // SingleSignOnResourceListResult - The response of a DynatraceSingleSignOnResource list operation. type SingleSignOnResourceListResult struct { - // REQUIRED; The link to the next page of items - NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page Value []*SingleSignOnResource `json:"value,omitempty"` + + // The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -637,11 +579,11 @@ type TagRule struct { // TagRuleListResult - The response of a TagRule list operation. type TagRuleListResult struct { - // REQUIRED; The link to the next page of items - NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page Value []*TagRule `json:"value,omitempty"` + + // The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` } // TagRuleUpdate - The updatable properties of the TagRule. @@ -680,25 +622,6 @@ type TagRulesClientUpdateOptions struct { // placeholder for future optional parameters } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // UserAssignedIdentity - A managed identity assigned by the user. type UserAssignedIdentity struct { // REQUIRED; The active directory client identifier for this principal. @@ -737,10 +660,10 @@ type VMExtensionPayload struct { // VMHostsListResponse - Response of a list VM Host Operation. type VMHostsListResponse struct { - // REQUIRED; The link to the next page of items + // The link to the next page of items NextLink *string `json:"nextLink,omitempty"` - // REQUIRED; The items on this page + // The items on this page Value []*VMInfo `json:"value,omitempty"` } diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/models_serde.go b/sdk/resourcemanager/dynatrace/armdynatrace/models_serde.go new file mode 100644 index 000000000000..5a3cfbf780b8 --- /dev/null +++ b/sdk/resourcemanager/dynatrace/armdynatrace/models_serde.go @@ -0,0 +1,1495 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armdynatrace + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AccountInfo. +func (a AccountInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "regionId", a.RegionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountInfo. +func (a *AccountInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "regionId": + err = unpopulate(val, "RegionID", &a.RegionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountInfoSecure. +func (a AccountInfoSecure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKey", a.APIKey) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "regionId", a.RegionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountInfoSecure. +func (a *AccountInfoSecure) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiKey": + err = unpopulate(val, "APIKey", &a.APIKey) + delete(rawMsg, key) + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "regionId": + err = unpopulate(val, "RegionID", &a.RegionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppServiceInfo. +func (a AppServiceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpdateSetting", a.AutoUpdateSetting) + populate(objectMap, "availabilityState", a.AvailabilityState) + populate(objectMap, "hostGroup", a.HostGroup) + populate(objectMap, "hostName", a.HostName) + populate(objectMap, "logModule", a.LogModule) + populate(objectMap, "monitoringType", a.MonitoringType) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "updateStatus", a.UpdateStatus) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppServiceInfo. +func (a *AppServiceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpdateSetting": + err = unpopulate(val, "AutoUpdateSetting", &a.AutoUpdateSetting) + delete(rawMsg, key) + case "availabilityState": + err = unpopulate(val, "AvailabilityState", &a.AvailabilityState) + delete(rawMsg, key) + case "hostGroup": + err = unpopulate(val, "HostGroup", &a.HostGroup) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &a.HostName) + delete(rawMsg, key) + case "logModule": + err = unpopulate(val, "LogModule", &a.LogModule) + delete(rawMsg, key) + case "monitoringType": + err = unpopulate(val, "MonitoringType", &a.MonitoringType) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + case "updateStatus": + err = unpopulate(val, "UpdateStatus", &a.UpdateStatus) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppServiceListResponse. +func (a AppServiceListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppServiceListResponse. +func (a *AppServiceListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentInfo. +func (e EnvironmentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "environmentId", e.EnvironmentID) + populate(objectMap, "ingestionKey", e.IngestionKey) + populate(objectMap, "landingURL", e.LandingURL) + populate(objectMap, "logsIngestionEndpoint", e.LogsIngestionEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentInfo. +func (e *EnvironmentInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentId": + err = unpopulate(val, "EnvironmentID", &e.EnvironmentID) + delete(rawMsg, key) + case "ingestionKey": + err = unpopulate(val, "IngestionKey", &e.IngestionKey) + delete(rawMsg, key) + case "landingURL": + err = unpopulate(val, "LandingURL", &e.LandingURL) + delete(rawMsg, key) + case "logsIngestionEndpoint": + err = unpopulate(val, "LogsIngestionEndpoint", &e.LogsIngestionEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentProperties. +func (e EnvironmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountInfo", e.AccountInfo) + populate(objectMap, "environmentInfo", e.EnvironmentInfo) + populate(objectMap, "singleSignOnProperties", e.SingleSignOnProperties) + populate(objectMap, "userId", e.UserID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentProperties. +func (e *EnvironmentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountInfo": + err = unpopulate(val, "AccountInfo", &e.AccountInfo) + delete(rawMsg, key) + case "environmentInfo": + err = unpopulate(val, "EnvironmentInfo", &e.EnvironmentInfo) + delete(rawMsg, key) + case "singleSignOnProperties": + err = unpopulate(val, "SingleSignOnProperties", &e.SingleSignOnProperties) + delete(rawMsg, key) + case "userId": + err = unpopulate(val, "UserID", &e.UserID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FilteringTag. +func (f FilteringTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", f.Action) + populate(objectMap, "name", f.Name) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilteringTag. +func (f *FilteringTag) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &f.Action) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. +func (i IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. +func (i *IdentityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkableEnvironmentListResponse. +func (l LinkableEnvironmentListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkableEnvironmentListResponse. +func (l *LinkableEnvironmentListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkableEnvironmentRequest. +func (l LinkableEnvironmentRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "region", l.Region) + populate(objectMap, "tenantId", l.TenantID) + populate(objectMap, "userPrincipal", l.UserPrincipal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkableEnvironmentRequest. +func (l *LinkableEnvironmentRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "region": + err = unpopulate(val, "Region", &l.Region) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &l.TenantID) + delete(rawMsg, key) + case "userPrincipal": + err = unpopulate(val, "UserPrincipal", &l.UserPrincipal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinkableEnvironmentResponse. +func (l LinkableEnvironmentResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "environmentId", l.EnvironmentID) + populate(objectMap, "environmentName", l.EnvironmentName) + populate(objectMap, "planData", l.PlanData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinkableEnvironmentResponse. +func (l *LinkableEnvironmentResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentId": + err = unpopulate(val, "EnvironmentID", &l.EnvironmentID) + delete(rawMsg, key) + case "environmentName": + err = unpopulate(val, "EnvironmentName", &l.EnvironmentName) + delete(rawMsg, key) + case "planData": + err = unpopulate(val, "PlanData", &l.PlanData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogRules. +func (l LogRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filteringTags", l.FilteringTags) + populate(objectMap, "sendAadLogs", l.SendAADLogs) + populate(objectMap, "sendActivityLogs", l.SendActivityLogs) + populate(objectMap, "sendSubscriptionLogs", l.SendSubscriptionLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogRules. +func (l *LogRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filteringTags": + err = unpopulate(val, "FilteringTags", &l.FilteringTags) + delete(rawMsg, key) + case "sendAadLogs": + err = unpopulate(val, "SendAADLogs", &l.SendAADLogs) + delete(rawMsg, key) + case "sendActivityLogs": + err = unpopulate(val, "SendActivityLogs", &l.SendActivityLogs) + delete(rawMsg, key) + case "sendSubscriptionLogs": + err = unpopulate(val, "SendSubscriptionLogs", &l.SendSubscriptionLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricRules. +func (m MetricRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filteringTags", m.FilteringTags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricRules. +func (m *MetricRules) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filteringTags": + err = unpopulate(val, "FilteringTags", &m.FilteringTags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorProperties. +func (m MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dynatraceEnvironmentProperties", m.DynatraceEnvironmentProperties) + populate(objectMap, "liftrResourceCategory", m.LiftrResourceCategory) + populate(objectMap, "liftrResourcePreference", m.LiftrResourcePreference) + populate(objectMap, "marketplaceSubscriptionStatus", m.MarketplaceSubscriptionStatus) + populate(objectMap, "monitoringStatus", m.MonitoringStatus) + populate(objectMap, "planData", m.PlanData) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "userInfo", m.UserInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorProperties. +func (m *MonitorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynatraceEnvironmentProperties": + err = unpopulate(val, "DynatraceEnvironmentProperties", &m.DynatraceEnvironmentProperties) + delete(rawMsg, key) + case "liftrResourceCategory": + err = unpopulate(val, "LiftrResourceCategory", &m.LiftrResourceCategory) + delete(rawMsg, key) + case "liftrResourcePreference": + err = unpopulate(val, "LiftrResourcePreference", &m.LiftrResourcePreference) + delete(rawMsg, key) + case "marketplaceSubscriptionStatus": + err = unpopulate(val, "MarketplaceSubscriptionStatus", &m.MarketplaceSubscriptionStatus) + delete(rawMsg, key) + case "monitoringStatus": + err = unpopulate(val, "MonitoringStatus", &m.MonitoringStatus) + delete(rawMsg, key) + case "planData": + err = unpopulate(val, "PlanData", &m.PlanData) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "userInfo": + err = unpopulate(val, "UserInfo", &m.UserInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResource. +func (m MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResource. +func (m *MonitorResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResourceListResult. +func (m MonitorResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResourceListResult. +func (m *MonitorResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorResourceUpdate. +func (m MonitorResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dynatraceEnvironmentProperties", m.DynatraceEnvironmentProperties) + populate(objectMap, "marketplaceSubscriptionStatus", m.MarketplaceSubscriptionStatus) + populate(objectMap, "monitoringStatus", m.MonitoringStatus) + populate(objectMap, "planData", m.PlanData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "userInfo", m.UserInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorResourceUpdate. +func (m *MonitorResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynatraceEnvironmentProperties": + err = unpopulate(val, "DynatraceEnvironmentProperties", &m.DynatraceEnvironmentProperties) + delete(rawMsg, key) + case "marketplaceSubscriptionStatus": + err = unpopulate(val, "MarketplaceSubscriptionStatus", &m.MarketplaceSubscriptionStatus) + delete(rawMsg, key) + case "monitoringStatus": + err = unpopulate(val, "MonitoringStatus", &m.MonitoringStatus) + delete(rawMsg, key) + case "planData": + err = unpopulate(val, "PlanData", &m.PlanData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "userInfo": + err = unpopulate(val, "UserInfo", &m.UserInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoredResource. +func (m MonitoredResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "reasonForLogsStatus", m.ReasonForLogsStatus) + populate(objectMap, "reasonForMetricsStatus", m.ReasonForMetricsStatus) + populate(objectMap, "sendingLogs", m.SendingLogs) + populate(objectMap, "sendingMetrics", m.SendingMetrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoredResource. +func (m *MonitoredResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "reasonForLogsStatus": + err = unpopulate(val, "ReasonForLogsStatus", &m.ReasonForLogsStatus) + delete(rawMsg, key) + case "reasonForMetricsStatus": + err = unpopulate(val, "ReasonForMetricsStatus", &m.ReasonForMetricsStatus) + delete(rawMsg, key) + case "sendingLogs": + err = unpopulate(val, "SendingLogs", &m.SendingLogs) + delete(rawMsg, key) + case "sendingMetrics": + err = unpopulate(val, "SendingMetrics", &m.SendingMetrics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoredResourceListResponse. +func (m MonitoredResourceListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoredResourceListResponse. +func (m *MonitoredResourceListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringTagRulesProperties. +func (m MonitoringTagRulesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logRules", m.LogRules) + populate(objectMap, "metricRules", m.MetricRules) + populate(objectMap, "provisioningState", m.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringTagRulesProperties. +func (m *MonitoringTagRulesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logRules": + err = unpopulate(val, "LogRules", &m.LogRules) + delete(rawMsg, key) + case "metricRules": + err = unpopulate(val, "MetricRules", &m.MetricRules) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlanData. +func (p PlanData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCycle", p.BillingCycle) + populateTimeRFC3339(objectMap, "effectiveDate", p.EffectiveDate) + populate(objectMap, "planDetails", p.PlanDetails) + populate(objectMap, "usageType", p.UsageType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanData. +func (p *PlanData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCycle": + err = unpopulate(val, "BillingCycle", &p.BillingCycle) + delete(rawMsg, key) + case "effectiveDate": + err = unpopulateTimeRFC3339(val, "EffectiveDate", &p.EffectiveDate) + delete(rawMsg, key) + case "planDetails": + err = unpopulate(val, "PlanDetails", &p.PlanDetails) + delete(rawMsg, key) + case "usageType": + err = unpopulate(val, "UsageType", &p.UsageType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSODetailsRequest. +func (s SSODetailsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "userPrincipal", s.UserPrincipal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSODetailsRequest. +func (s *SSODetailsRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "userPrincipal": + err = unpopulate(val, "UserPrincipal", &s.UserPrincipal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SSODetailsResponse. +func (s SSODetailsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadDomains", s.AADDomains) + populate(objectMap, "adminUsers", s.AdminUsers) + populate(objectMap, "isSsoEnabled", s.IsSsoEnabled) + populate(objectMap, "metadataUrl", s.MetadataURL) + populate(objectMap, "singleSignOnUrl", s.SingleSignOnURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSODetailsResponse. +func (s *SSODetailsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadDomains": + err = unpopulate(val, "AADDomains", &s.AADDomains) + delete(rawMsg, key) + case "adminUsers": + err = unpopulate(val, "AdminUsers", &s.AdminUsers) + delete(rawMsg, key) + case "isSsoEnabled": + err = unpopulate(val, "IsSsoEnabled", &s.IsSsoEnabled) + delete(rawMsg, key) + case "metadataUrl": + err = unpopulate(val, "MetadataURL", &s.MetadataURL) + delete(rawMsg, key) + case "singleSignOnUrl": + err = unpopulate(val, "SingleSignOnURL", &s.SingleSignOnURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleSignOnProperties. +func (s SingleSignOnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadDomains", s.AADDomains) + populate(objectMap, "enterpriseAppId", s.EnterpriseAppID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "singleSignOnState", s.SingleSignOnState) + populate(objectMap, "singleSignOnUrl", s.SingleSignOnURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleSignOnProperties. +func (s *SingleSignOnProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadDomains": + err = unpopulate(val, "AADDomains", &s.AADDomains) + delete(rawMsg, key) + case "enterpriseAppId": + err = unpopulate(val, "EnterpriseAppID", &s.EnterpriseAppID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "singleSignOnState": + err = unpopulate(val, "SingleSignOnState", &s.SingleSignOnState) + delete(rawMsg, key) + case "singleSignOnUrl": + err = unpopulate(val, "SingleSignOnURL", &s.SingleSignOnURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleSignOnResource. +func (s SingleSignOnResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleSignOnResource. +func (s *SingleSignOnResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleSignOnResourceListResult. +func (s SingleSignOnResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleSignOnResourceListResult. +func (s *SingleSignOnResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagRule. +func (t TagRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagRule. +func (t *TagRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagRuleListResult. +func (t TagRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagRuleListResult. +func (t *TagRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagRuleUpdate. +func (t TagRuleUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logRules", t.LogRules) + populate(objectMap, "metricRules", t.MetricRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagRuleUpdate. +func (t *TagRuleUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logRules": + err = unpopulate(val, "LogRules", &t.LogRules) + delete(rawMsg, key) + case "metricRules": + err = unpopulate(val, "MetricRules", &t.MetricRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserInfo. +func (u UserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "country", u.Country) + populate(objectMap, "emailAddress", u.EmailAddress) + populate(objectMap, "firstName", u.FirstName) + populate(objectMap, "lastName", u.LastName) + populate(objectMap, "phoneNumber", u.PhoneNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserInfo. +func (u *UserInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "country": + err = unpopulate(val, "Country", &u.Country) + delete(rawMsg, key) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &u.EmailAddress) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &u.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &u.LastName) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &u.PhoneNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMExtensionPayload. +func (v VMExtensionPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "environmentId", v.EnvironmentID) + populate(objectMap, "ingestionKey", v.IngestionKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMExtensionPayload. +func (v *VMExtensionPayload) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentId": + err = unpopulate(val, "EnvironmentID", &v.EnvironmentID) + delete(rawMsg, key) + case "ingestionKey": + err = unpopulate(val, "IngestionKey", &v.IngestionKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMHostsListResponse. +func (v VMHostsListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMHostsListResponse. +func (v *VMHostsListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInfo. +func (v VMInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoUpdateSetting", v.AutoUpdateSetting) + populate(objectMap, "availabilityState", v.AvailabilityState) + populate(objectMap, "hostGroup", v.HostGroup) + populate(objectMap, "hostName", v.HostName) + populate(objectMap, "logModule", v.LogModule) + populate(objectMap, "monitoringType", v.MonitoringType) + populate(objectMap, "resourceId", v.ResourceID) + populate(objectMap, "updateStatus", v.UpdateStatus) + populate(objectMap, "version", v.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInfo. +func (v *VMInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoUpdateSetting": + err = unpopulate(val, "AutoUpdateSetting", &v.AutoUpdateSetting) + delete(rawMsg, key) + case "availabilityState": + err = unpopulate(val, "AvailabilityState", &v.AvailabilityState) + delete(rawMsg, key) + case "hostGroup": + err = unpopulate(val, "HostGroup", &v.HostGroup) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &v.HostName) + delete(rawMsg, key) + case "logModule": + err = unpopulate(val, "LogModule", &v.LogModule) + delete(rawMsg, key) + case "monitoringType": + err = unpopulate(val, "MonitoringType", &v.MonitoringType) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &v.ResourceID) + delete(rawMsg, key) + case "updateStatus": + err = unpopulate(val, "UpdateStatus", &v.UpdateStatus) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &v.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_monitors_client.go b/sdk/resourcemanager/dynatrace/armdynatrace/monitors_client.go similarity index 95% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_monitors_client.go rename to sdk/resourcemanager/dynatrace/armdynatrace/monitors_client.go index bc078225df19..493c6fd45e3b 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_monitors_client.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/monitors_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace @@ -56,7 +57,7 @@ func NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // resource - Resource create parameters. @@ -78,7 +79,7 @@ func (client *MonitorsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 func (client *MonitorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResource, options *MonitorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, monitorName, resource, options) if err != nil { @@ -114,7 +115,7 @@ func (client *MonitorsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -122,7 +123,7 @@ func (client *MonitorsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. @@ -142,7 +143,7 @@ func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 func (client *MonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) if err != nil { @@ -178,7 +179,7 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +187,7 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. @@ -225,7 +226,7 @@ func (client *MonitorsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +243,7 @@ func (client *MonitorsClient) getHandleResponse(resp *http.Response) (MonitorsCl // GetAccountCredentials - Gets the user account credentials for a Monitor // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientGetAccountCredentialsOptions contains the optional parameters for the MonitorsClient.GetAccountCredentials @@ -282,7 +283,7 @@ func (client *MonitorsClient) getAccountCredentialsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,7 +300,7 @@ func (client *MonitorsClient) getAccountCredentialsHandleResponse(resp *http.Res // GetSSODetails - Gets the SSO configuration details from the partner. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientGetSSODetailsOptions contains the optional parameters for the MonitorsClient.GetSSODetails method. @@ -338,7 +339,7 @@ func (client *MonitorsClient) getSSODetailsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Request != nil { @@ -359,7 +360,7 @@ func (client *MonitorsClient) getSSODetailsHandleResponse(resp *http.Response) ( // GetVMHostPayload - Returns the payload that needs to be passed in the request body for installing Dynatrace agent on a // VM. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientGetVMHostPayloadOptions contains the optional parameters for the MonitorsClient.GetVMHostPayload @@ -399,7 +400,7 @@ func (client *MonitorsClient) getVMHostPayloadCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,8 +416,7 @@ func (client *MonitorsClient) getVMHostPayloadHandleResponse(resp *http.Response } // NewListAppServicesPager - Gets list of App Services with Dynatrace PaaS OneAgent enabled -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientListAppServicesOptions contains the optional parameters for the MonitorsClient.ListAppServices @@ -469,7 +469,7 @@ func (client *MonitorsClient) listAppServicesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -485,8 +485,7 @@ func (client *MonitorsClient) listAppServicesHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - List MonitorResource resources by resource group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // options - MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.ListByResourceGroup // method. @@ -534,7 +533,7 @@ func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -550,8 +549,7 @@ func (client *MonitorsClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListBySubscriptionIDPager - List all MonitorResource by subscriptionId -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // options - MonitorsClientListBySubscriptionIDOptions contains the optional parameters for the MonitorsClient.ListBySubscriptionID // method. func (client *MonitorsClient) NewListBySubscriptionIDPager(options *MonitorsClientListBySubscriptionIDOptions) *runtime.Pager[MonitorsClientListBySubscriptionIDResponse] { @@ -594,7 +592,7 @@ func (client *MonitorsClient) listBySubscriptionIDCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -610,8 +608,7 @@ func (client *MonitorsClient) listBySubscriptionIDHandleResponse(resp *http.Resp } // NewListHostsPager - List the compute resources currently being monitored by the Dynatrace resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientListHostsOptions contains the optional parameters for the MonitorsClient.ListHosts method. @@ -663,7 +660,7 @@ func (client *MonitorsClient) listHostsCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -679,8 +676,7 @@ func (client *MonitorsClient) listHostsHandleResponse(resp *http.Response) (Moni } // NewListLinkableEnvironmentsPager - Gets all the Dynatrace environments that a user can link a azure resource to -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // request - The details of the linkable environment request. @@ -734,7 +730,7 @@ func (client *MonitorsClient) listLinkableEnvironmentsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, request) @@ -750,8 +746,7 @@ func (client *MonitorsClient) listLinkableEnvironmentsHandleResponse(resp *http. } // NewListMonitoredResourcesPager - List the resources currently being monitored by the Dynatrace monitor resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - MonitorsClientListMonitoredResourcesOptions contains the optional parameters for the MonitorsClient.ListMonitoredResources @@ -804,7 +799,7 @@ func (client *MonitorsClient) listMonitoredResourcesCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -821,7 +816,7 @@ func (client *MonitorsClient) listMonitoredResourcesHandleResponse(resp *http.Re // Update - Update a MonitorResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // resource - The resource properties to be updated. @@ -861,7 +856,7 @@ func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/monitors_client_example_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/monitors_client_example_test.go new file mode 100644 index 000000000000..648aed9cdd89 --- /dev/null +++ b/sdk/resourcemanager/dynatrace/armdynatrace/monitors_client_example_test.go @@ -0,0 +1,652 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdynatrace_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetAccountCredentials_MaximumSet_Gen.json +func ExampleMonitorsClient_GetAccountCredentials_monitorsGetAccountCredentialsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetAccountCredentials(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetAccountCredentials_MinimumSet_Gen.json +func ExampleMonitorsClient_GetAccountCredentials_monitorsGetAccountCredentialsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetAccountCredentials(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListMonitoredResourcesPager_monitorsListMonitoredResourcesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMonitoredResourcesPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListMonitoredResourcesPager_monitorsListMonitoredResourcesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListMonitoredResourcesPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetVMHostPayload_MaximumSet_Gen.json +func ExampleMonitorsClient_GetVMHostPayload_monitorsGetVmHostPayloadMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetVMHostPayload(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetVMHostPayload_MinimumSet_Gen.json +func ExampleMonitorsClient_GetVMHostPayload_monitorsGetVmHostPayloadMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetVMHostPayload(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Get_MaximumSet_Gen.json +func ExampleMonitorsClient_Get_monitorsGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Get_MinimumSet_Gen.json +func ExampleMonitorsClient_Get_monitorsGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json +func ExampleMonitorsClient_BeginCreateOrUpdate_monitorsCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", armdynatrace.MonitorResource{ + Location: to.Ptr("West US 2"), + Tags: map[string]*string{ + "Environment": to.Ptr("Dev"), + }, + Identity: &armdynatrace.IdentityProperties{ + Type: to.Ptr(armdynatrace.ManagedIdentityTypeSystemAssigned), + }, + Properties: &armdynatrace.MonitorProperties{ + DynatraceEnvironmentProperties: &armdynatrace.EnvironmentProperties{ + AccountInfo: &armdynatrace.AccountInfo{}, + EnvironmentInfo: &armdynatrace.EnvironmentInfo{}, + SingleSignOnProperties: &armdynatrace.SingleSignOnProperties{}, + }, + LiftrResourceCategory: to.Ptr(armdynatrace.LiftrResourceCategoriesUnknown), + MarketplaceSubscriptionStatus: to.Ptr(armdynatrace.MarketplaceSubscriptionStatusActive), + MonitoringStatus: to.Ptr(armdynatrace.MonitoringStatusEnabled), + PlanData: &armdynatrace.PlanData{ + BillingCycle: to.Ptr("Monthly"), + EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-30T15:14:33+02:00"); return t }()), + PlanDetails: to.Ptr("dynatraceapitestplan"), + UsageType: to.Ptr("Committed"), + }, + ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), + UserInfo: &armdynatrace.UserInfo{ + Country: to.Ptr("westus2"), + EmailAddress: to.Ptr("alice@microsoft.com"), + FirstName: to.Ptr("Alice"), + LastName: to.Ptr("Bobab"), + PhoneNumber: to.Ptr("123456"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_CreateOrUpdate_MinimumSet_Gen.json +func ExampleMonitorsClient_BeginCreateOrUpdate_monitorsCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", armdynatrace.MonitorResource{ + Location: to.Ptr("West US 2"), + Properties: &armdynatrace.MonitorProperties{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Update_MaximumSet_Gen.json +func ExampleMonitorsClient_Update_monitorsUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "myResourceGroup", "myMonitor", armdynatrace.MonitorResourceUpdate{ + DynatraceEnvironmentProperties: &armdynatrace.EnvironmentProperties{ + AccountInfo: &armdynatrace.AccountInfo{}, + EnvironmentInfo: &armdynatrace.EnvironmentInfo{}, + SingleSignOnProperties: &armdynatrace.SingleSignOnProperties{}, + }, + MarketplaceSubscriptionStatus: to.Ptr(armdynatrace.MarketplaceSubscriptionStatusActive), + MonitoringStatus: to.Ptr(armdynatrace.MonitoringStatusEnabled), + PlanData: &armdynatrace.PlanData{ + BillingCycle: to.Ptr("Monthly"), + EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-30T15:14:33+02:00"); return t }()), + PlanDetails: to.Ptr("dynatraceapitestplan"), + UsageType: to.Ptr("Committed"), + }, + Tags: map[string]*string{ + "Environment": to.Ptr("Dev"), + }, + UserInfo: &armdynatrace.UserInfo{ + Country: to.Ptr("westus2"), + EmailAddress: to.Ptr("alice@microsoft.com"), + FirstName: to.Ptr("Alice"), + LastName: to.Ptr("Bobab"), + PhoneNumber: to.Ptr("123456"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Update_MinimumSet_Gen.json +func ExampleMonitorsClient_Update_monitorsUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "myResourceGroup", "myMonitor", armdynatrace.MonitorResourceUpdate{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Delete_MaximumSet_Gen.json +func ExampleMonitorsClient_BeginDelete_monitorsDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_Delete_MinimumSet_Gen.json +func ExampleMonitorsClient_BeginDelete_monitorsDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "myResourceGroup", "myMonitor", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListBySubscriptionId_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListBySubscriptionIDPager_monitorsListBySubscriptionIdMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListBySubscriptionIDPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListBySubscriptionId_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListBySubscriptionIDPager_monitorsListBySubscriptionIdMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListBySubscriptionIDPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListByResourceGroupPager_monitorsListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("myResourceGroup", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListByResourceGroup_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListByResourceGroupPager_monitorsListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("myResourceGroup", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListHosts_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListHostsPager_monitorsListHostsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListHostsPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListHosts_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListHostsPager_monitorsListHostsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListHostsPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListAppServices_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListAppServicesPager_monitorsListAppServicesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListAppServicesPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListAppServices_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListAppServicesPager_monitorsListAppServicesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListAppServicesPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetSSODetails_MaximumSet_Gen.json +func ExampleMonitorsClient_GetSSODetails_monitorsGetSsoDetailsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetSSODetails(ctx, "myResourceGroup", "myMonitor", &armdynatrace.MonitorsClientGetSSODetailsOptions{Request: &armdynatrace.SSODetailsRequest{ + UserPrincipal: to.Ptr("alice@microsoft.com"), + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_GetSSODetails_MinimumSet_Gen.json +func ExampleMonitorsClient_GetSSODetails_monitorsGetSsoDetailsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetSSODetails(ctx, "myResourceGroup", "myMonitor", &armdynatrace.MonitorsClientGetSSODetailsOptions{Request: &armdynatrace.SSODetailsRequest{}}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListLinkableEnvironments_MaximumSet_Gen.json +func ExampleMonitorsClient_NewListLinkableEnvironmentsPager_monitorsListLinkableEnvironmentsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListLinkableEnvironmentsPager("myResourceGroup", "myMonitor", armdynatrace.LinkableEnvironmentRequest{ + Region: to.Ptr("East US"), + TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + UserPrincipal: to.Ptr("alice@microsoft.com"), + }, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Monitors_ListLinkableEnvironments_MinimumSet_Gen.json +func ExampleMonitorsClient_NewListLinkableEnvironmentsPager_monitorsListLinkableEnvironmentsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListLinkableEnvironmentsPager("myResourceGroup", "myMonitor", armdynatrace.LinkableEnvironmentRequest{}, nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_operations_client.go b/sdk/resourcemanager/dynatrace/armdynatrace/operations_client.go similarity index 95% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_operations_client.go rename to sdk/resourcemanager/dynatrace/armdynatrace/operations_client.go index 3e8f48fdf75f..2ef6742e964c 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_operations_client.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/operations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - List the operations for Dynatrace.Observability -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_quotarequeststatus_client_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/operations_client_example_test.go similarity index 51% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_quotarequeststatus_client_test.go rename to sdk/resourcemanager/dynatrace/armdynatrace/operations_client_example_test.go index 56fa654f683f..9453788c33e7 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_quotarequeststatus_client_test.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/operations_client_example_test.go @@ -6,58 +6,52 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -package armreservations_test +package armdynatrace_test import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json -func ExampleQuotaRequestStatusClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) + client, err := armdynatrace.NewOperationsClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "00000000-0000-0000-0000-000000000000", - "Microsoft.Compute", - "eastus", - "2B5C8515-37D8-4B6A-879B-CD641A2CF605", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } } - // TODO: use response item - _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json -func ExampleQuotaRequestStatusClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) + client, err := armdynatrace.NewOperationsClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("3f75fdf7-977e-44ad-990d-99f14f0f299f", - "Microsoft.Compute", - "eastus", - &armreservations.QuotaRequestStatusClientListOptions{Filter: nil, - Top: nil, - Skiptoken: nil, - }) + pager := client.NewListPager(nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_response_types.go b/sdk/resourcemanager/dynatrace/armdynatrace/response_types.go similarity index 99% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_response_types.go rename to sdk/resourcemanager/dynatrace/armdynatrace/response_types.go index 0af2c6b5c144..dd886be0ecfd 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_response_types.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_singlesignon_client.go b/sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client.go similarity index 96% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_singlesignon_client.go rename to sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client.go index df5dd3d51f3a..5b3f36765718 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_singlesignon_client.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace @@ -56,7 +57,7 @@ func NewSingleSignOnClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Create a DynatraceSingleSignOnResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // configurationName - Single Sign On Configuration Name @@ -79,7 +80,7 @@ func (client *SingleSignOnClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Create a DynatraceSingleSignOnResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 func (client *SingleSignOnClient) createOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, resource SingleSignOnResource, options *SingleSignOnClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, monitorName, configurationName, resource, options) if err != nil { @@ -119,7 +120,7 @@ func (client *SingleSignOnClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -127,7 +128,7 @@ func (client *SingleSignOnClient) createOrUpdateCreateRequest(ctx context.Contex // Get - Get a DynatraceSingleSignOnResource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // configurationName - Single Sign On Configuration Name @@ -171,7 +172,7 @@ func (client *SingleSignOnClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,8 +188,7 @@ func (client *SingleSignOnClient) getHandleResponse(resp *http.Response) (Single } // NewListPager - List all DynatraceSingleSignOnResource by monitorName -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - SingleSignOnClientListOptions contains the optional parameters for the SingleSignOnClient.List method. @@ -240,7 +240,7 @@ func (client *SingleSignOnClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client_example_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client_example_test.go new file mode 100644 index 000000000000..5de8f1c6a3e3 --- /dev/null +++ b/sdk/resourcemanager/dynatrace/armdynatrace/singlesignon_client_example_test.go @@ -0,0 +1,165 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdynatrace_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_CreateOrUpdate_MaximumSet_Gen.json +func ExampleSingleSignOnClient_BeginCreateOrUpdate_singleSignOnCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.SingleSignOnResource{ + Properties: &armdynatrace.SingleSignOnProperties{ + AADDomains: []*string{ + to.Ptr("mpliftrdt20210811outlook.onmicrosoft.com")}, + EnterpriseAppID: to.Ptr("00000000-0000-0000-0000-000000000000"), + ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), + SingleSignOnState: to.Ptr(armdynatrace.SingleSignOnStatesEnable), + SingleSignOnURL: to.Ptr("https://www.dynatrace.io"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_CreateOrUpdate_MinimumSet_Gen.json +func ExampleSingleSignOnClient_BeginCreateOrUpdate_singleSignOnCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.SingleSignOnResource{ + Properties: &armdynatrace.SingleSignOnProperties{ + AADDomains: []*string{ + to.Ptr("mpliftrdt20210811outlook.onmicrosoft.com")}, + SingleSignOnURL: to.Ptr("https://www.dynatrace.io"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_Get_MaximumSet_Gen.json +func ExampleSingleSignOnClient_Get_singleSignOnGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_Get_MinimumSet_Gen.json +func ExampleSingleSignOnClient_Get_singleSignOnGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_List_MaximumSet_Gen.json +func ExampleSingleSignOnClient_NewListPager_singleSignOnListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/SingleSignOn_List_MinimumSet_Gen.json +func ExampleSingleSignOnClient_NewListPager_singleSignOnListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_tagrules_client.go b/sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client.go similarity index 96% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_tagrules_client.go rename to sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client.go index 7db538744d48..7656dc5b6656 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_tagrules_client.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace @@ -56,7 +57,7 @@ func NewTagRulesClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // ruleSetName - Monitor resource name @@ -79,7 +80,7 @@ func (client *TagRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 func (client *TagRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource TagRule, options *TagRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, monitorName, ruleSetName, resource, options) if err != nil { @@ -119,7 +120,7 @@ func (client *TagRulesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -127,7 +128,7 @@ func (client *TagRulesClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // ruleSetName - Monitor resource name @@ -148,7 +149,7 @@ func (client *TagRulesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 func (client *TagRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, options *TagRulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, ruleSetName, options) if err != nil { @@ -188,7 +189,7 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,7 +197,7 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // ruleSetName - Monitor resource name @@ -240,7 +241,7 @@ func (client *TagRulesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,8 +257,7 @@ func (client *TagRulesClient) getHandleResponse(resp *http.Response) (TagRulesCl } // NewListPager - List all TagRule by monitorName -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // options - TagRulesClientListOptions contains the optional parameters for the TagRulesClient.List method. @@ -309,7 +309,7 @@ func (client *TagRulesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +326,7 @@ func (client *TagRulesClient) listHandleResponse(resp *http.Response) (TagRulesC // Update - Update a TagRule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2021-09-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // monitorName - Monitor resource name // ruleSetName - Monitor resource name @@ -371,7 +371,7 @@ func (client *TagRulesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client_example_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client_example_test.go new file mode 100644 index 000000000000..a356acbf523f --- /dev/null +++ b/sdk/resourcemanager/dynatrace/armdynatrace/tagrules_client_example_test.go @@ -0,0 +1,285 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdynatrace_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Get_MaximumSet_Gen.json +func ExampleTagRulesClient_Get_tagRulesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Get_MinimumSet_Gen.json +func ExampleTagRulesClient_Get_tagRulesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json +func ExampleTagRulesClient_BeginCreateOrUpdate_tagRulesCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRule{ + Properties: &armdynatrace.MonitoringTagRulesProperties{ + LogRules: &armdynatrace.LogRules{ + FilteringTags: []*armdynatrace.FilteringTag{ + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionInclude), + Value: to.Ptr("Prod"), + }, + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionExclude), + Value: to.Ptr("Dev"), + }}, + SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled), + SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled), + SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled), + }, + MetricRules: &armdynatrace.MetricRules{ + FilteringTags: []*armdynatrace.FilteringTag{ + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionInclude), + Value: to.Ptr("Prod"), + }}, + }, + ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json +func ExampleTagRulesClient_BeginCreateOrUpdate_tagRulesCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRule{ + Properties: &armdynatrace.MonitoringTagRulesProperties{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Update_MaximumSet_Gen.json +func ExampleTagRulesClient_Update_tagRulesUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRuleUpdate{ + LogRules: &armdynatrace.LogRules{ + FilteringTags: []*armdynatrace.FilteringTag{ + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionInclude), + Value: to.Ptr("Prod"), + }, + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionExclude), + Value: to.Ptr("Dev"), + }}, + SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled), + SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled), + SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled), + }, + MetricRules: &armdynatrace.MetricRules{ + FilteringTags: []*armdynatrace.FilteringTag{ + { + Name: to.Ptr("Environment"), + Action: to.Ptr(armdynatrace.TagActionInclude), + Value: to.Ptr("Prod"), + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Update_MinimumSet_Gen.json +func ExampleTagRulesClient_Update_tagRulesUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "myResourceGroup", "myMonitor", "default", armdynatrace.TagRuleUpdate{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Delete_MaximumSet_Gen.json +func ExampleTagRulesClient_BeginDelete_tagRulesDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_Delete_MinimumSet_Gen.json +func ExampleTagRulesClient_BeginDelete_tagRulesDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "myResourceGroup", "myMonitor", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_List_MaximumSet_Gen.json +func ExampleTagRulesClient_NewListPager_tagRulesListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/stable/2021-09-01/examples/TagRules_List_MinimumSet_Gen.json +func ExampleTagRulesClient_NewListPager_tagRulesListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myResourceGroup", "myMonitor", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_time_rfc3339.go b/sdk/resourcemanager/dynatrace/armdynatrace/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/dynatrace/armdynatrace/time_rfc3339.go index 9513db08db4a..228a96d7c14f 100644 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/dynatrace/armdynatrace/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdynatrace diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_monitors_client_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_monitors_client_test.go deleted file mode 100644 index 83de5938fb28..000000000000 --- a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_monitors_client_test.go +++ /dev/null @@ -1,375 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdynatrace_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_GetAccountCredentials_MaximumSet_Gen.json -func ExampleMonitorsClient_GetAccountCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetAccountCredentials(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json -func ExampleMonitorsClient_NewListMonitoredResourcesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListMonitoredResourcesPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_GetVMHostPayload_MaximumSet_Gen.json -func ExampleMonitorsClient_GetVMHostPayload() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetVMHostPayload(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_Get_MaximumSet_Gen.json -func ExampleMonitorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json -func ExampleMonitorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myMonitor", - armdynatrace.MonitorResource{ - Location: to.Ptr("West US 2"), - Tags: map[string]*string{ - "Environment": to.Ptr("Dev"), - }, - Identity: &armdynatrace.IdentityProperties{ - Type: to.Ptr(armdynatrace.ManagedIdentityTypeSystemAssigned), - }, - Properties: &armdynatrace.MonitorProperties{ - DynatraceEnvironmentProperties: &armdynatrace.EnvironmentProperties{ - AccountInfo: &armdynatrace.AccountInfo{}, - EnvironmentInfo: &armdynatrace.EnvironmentInfo{}, - SingleSignOnProperties: &armdynatrace.SingleSignOnProperties{}, - }, - LiftrResourceCategory: to.Ptr(armdynatrace.LiftrResourceCategoriesUnknown), - MarketplaceSubscriptionStatus: to.Ptr(armdynatrace.MarketplaceSubscriptionStatusActive), - MonitoringStatus: to.Ptr(armdynatrace.MonitoringStatusEnabled), - PlanData: &armdynatrace.PlanData{ - BillingCycle: to.Ptr("Monthly"), - EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-30T15:14:33+02:00"); return t }()), - PlanDetails: to.Ptr("dynatraceapitestplan"), - UsageType: to.Ptr("Committed"), - }, - ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), - UserInfo: &armdynatrace.UserInfo{ - Country: to.Ptr("westus2"), - EmailAddress: to.Ptr("alice@microsoft.com"), - FirstName: to.Ptr("Alice"), - LastName: to.Ptr("Bobab"), - PhoneNumber: to.Ptr("123456"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_Update_MaximumSet_Gen.json -func ExampleMonitorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myResourceGroup", - "myMonitor", - armdynatrace.MonitorResourceUpdate{ - DynatraceEnvironmentProperties: &armdynatrace.EnvironmentProperties{ - AccountInfo: &armdynatrace.AccountInfo{}, - EnvironmentInfo: &armdynatrace.EnvironmentInfo{}, - SingleSignOnProperties: &armdynatrace.SingleSignOnProperties{}, - }, - MarketplaceSubscriptionStatus: to.Ptr(armdynatrace.MarketplaceSubscriptionStatusActive), - MonitoringStatus: to.Ptr(armdynatrace.MonitoringStatusEnabled), - PlanData: &armdynatrace.PlanData{ - BillingCycle: to.Ptr("Monthly"), - EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-30T15:14:33+02:00"); return t }()), - PlanDetails: to.Ptr("dynatraceapitestplan"), - UsageType: to.Ptr("Committed"), - }, - Tags: map[string]*string{ - "Environment": to.Ptr("Dev"), - }, - UserInfo: &armdynatrace.UserInfo{ - Country: to.Ptr("westus2"), - EmailAddress: to.Ptr("alice@microsoft.com"), - FirstName: to.Ptr("Alice"), - LastName: to.Ptr("Bobab"), - PhoneNumber: to.Ptr("123456"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json -func ExampleMonitorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myMonitor", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json -func ExampleMonitorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json -func ExampleMonitorsClient_NewListHostsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListHostsPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json -func ExampleMonitorsClient_NewListAppServicesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAppServicesPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_GetSSODetails_MaximumSet_Gen.json -func ExampleMonitorsClient_GetSSODetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSSODetails(ctx, - "myResourceGroup", - "myMonitor", - &armdynatrace.MonitorsClientGetSSODetailsOptions{Request: &armdynatrace.SSODetailsRequest{ - UserPrincipal: to.Ptr("alice@microsoft.com"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/Monitors_ListLinkableEnvironments_MaximumSet_Gen.json -func ExampleMonitorsClient_NewListLinkableEnvironmentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewMonitorsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListLinkableEnvironmentsPager("myResourceGroup", - "myMonitor", - armdynatrace.LinkableEnvironmentRequest{ - Region: to.Ptr("East US"), - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - UserPrincipal: to.Ptr("alice@microsoft.com"), - }, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_singlesignon_client_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_singlesignon_client_test.go deleted file mode 100644 index 2d7c25034a39..000000000000 --- a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_singlesignon_client_test.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdynatrace_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/SingleSignOn_CreateOrUpdate_MaximumSet_Gen.json -func ExampleSingleSignOnClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myMonitor", - "default", - armdynatrace.SingleSignOnResource{ - Properties: &armdynatrace.SingleSignOnProperties{ - AADDomains: []*string{ - to.Ptr("mpliftrdt20210811outlook.onmicrosoft.com")}, - EnterpriseAppID: to.Ptr("00000000-0000-0000-0000-000000000000"), - ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), - SingleSignOnState: to.Ptr(armdynatrace.SingleSignOnStatesEnable), - SingleSignOnURL: to.Ptr("https://www.dynatrace.io"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/SingleSignOn_Get_MaximumSet_Gen.json -func ExampleSingleSignOnClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMonitor", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/SingleSignOn_List_MaximumSet_Gen.json -func ExampleSingleSignOnClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewSingleSignOnClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_tagrules_client_test.go b/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_tagrules_client_test.go deleted file mode 100644 index bf8a86350668..000000000000 --- a/sdk/resourcemanager/dynatrace/armdynatrace/ze_generated_example_tagrules_client_test.go +++ /dev/null @@ -1,197 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdynatrace_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dynatrace/armdynatrace" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/TagRules_Get_MaximumSet_Gen.json -func ExampleTagRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMonitor", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json -func ExampleTagRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myMonitor", - "default", - armdynatrace.TagRule{ - Properties: &armdynatrace.MonitoringTagRulesProperties{ - LogRules: &armdynatrace.LogRules{ - FilteringTags: []*armdynatrace.FilteringTag{ - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionInclude), - Value: to.Ptr("Prod"), - }, - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionExclude), - Value: to.Ptr("Dev"), - }}, - SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled), - SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled), - SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled), - }, - MetricRules: &armdynatrace.MetricRules{ - FilteringTags: []*armdynatrace.FilteringTag{ - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionInclude), - Value: to.Ptr("Prod"), - }}, - }, - ProvisioningState: to.Ptr(armdynatrace.ProvisioningStateAccepted), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/TagRules_Update_MaximumSet_Gen.json -func ExampleTagRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myResourceGroup", - "myMonitor", - "default", - armdynatrace.TagRuleUpdate{ - LogRules: &armdynatrace.LogRules{ - FilteringTags: []*armdynatrace.FilteringTag{ - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionInclude), - Value: to.Ptr("Prod"), - }, - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionExclude), - Value: to.Ptr("Dev"), - }}, - SendAADLogs: to.Ptr(armdynatrace.SendAADLogsStatusEnabled), - SendActivityLogs: to.Ptr(armdynatrace.SendActivityLogsStatusEnabled), - SendSubscriptionLogs: to.Ptr(armdynatrace.SendSubscriptionLogsStatusEnabled), - }, - MetricRules: &armdynatrace.MetricRules{ - FilteringTags: []*armdynatrace.FilteringTag{ - { - Name: to.Ptr("Environment"), - Action: to.Ptr(armdynatrace.TagActionInclude), - Value: to.Ptr("Prod"), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json -func ExampleTagRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myMonitor", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dynatrace/resource-manager/Dynatrace.Observability/preview/2021-09-01-preview/examples/TagRules_List_MaximumSet_Gen.json -func ExampleTagRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdynatrace.NewTagRulesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMonitor", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models_serde.go b/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models_serde.go deleted file mode 100644 index a2219bdc3690..000000000000 --- a/sdk/resourcemanager/dynatrace/armdynatrace/zz_generated_models_serde.go +++ /dev/null @@ -1,205 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdynatrace - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. -func (i IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogRules. -func (l LogRules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filteringTags", l.FilteringTags) - populate(objectMap, "sendAadLogs", l.SendAADLogs) - populate(objectMap, "sendActivityLogs", l.SendActivityLogs) - populate(objectMap, "sendSubscriptionLogs", l.SendSubscriptionLogs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetricRules. -func (m MetricRules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filteringTags", m.FilteringTags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MonitorResource. -func (m MonitorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MonitorResourceUpdate. -func (m MonitorResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dynatraceEnvironmentProperties", m.DynatraceEnvironmentProperties) - populate(objectMap, "marketplaceSubscriptionStatus", m.MarketplaceSubscriptionStatus) - populate(objectMap, "monitoringStatus", m.MonitoringStatus) - populate(objectMap, "planData", m.PlanData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "userInfo", m.UserInfo) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PlanData. -func (p PlanData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingCycle", p.BillingCycle) - populateTimeRFC3339(objectMap, "effectiveDate", p.EffectiveDate) - populate(objectMap, "planDetails", p.PlanDetails) - populate(objectMap, "usageType", p.UsageType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlanData. -func (p *PlanData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "billingCycle": - err = unpopulate(val, "BillingCycle", &p.BillingCycle) - delete(rawMsg, key) - case "effectiveDate": - err = unpopulateTimeRFC3339(val, "EffectiveDate", &p.EffectiveDate) - delete(rawMsg, key) - case "planDetails": - err = unpopulate(val, "PlanDetails", &p.PlanDetails) - delete(rawMsg, key) - case "usageType": - err = unpopulate(val, "UsageType", &p.UsageType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SingleSignOnProperties. -func (s SingleSignOnProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aadDomains", s.AADDomains) - populate(objectMap, "enterpriseAppId", s.EnterpriseAppID) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "singleSignOnState", s.SingleSignOnState) - populate(objectMap, "singleSignOnUrl", s.SingleSignOnURL) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagRuleUpdate. -func (t TagRuleUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logRules", t.LogRules) - populate(objectMap, "metricRules", t.MetricRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md index 446ec05db61a..0d6586f5ac9d 100644 --- a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md +++ b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md @@ -1,9 +1,52 @@ # Release History +## 1.1.0 (2022-09-15) +### Features Added + +- New const `AzureSKUNameStandardEC8AsV51TBPS` +- New const `AzureSKUNameStandardEC8AdsV5` +- New const `AzureSKUNameStandardL8AsV3` +- New const `AzureSKUNameStandardL8SV3` +- New const `AzureSKUNameStandardE8DV5` +- New const `AzureSKUNameStandardE16DV4` +- New const `AzureSKUNameStandardL16AsV3` +- New const `AzureSKUNameStandardEC16AsV54TBPS` +- New const `AzureSKUNameStandardEC16AsV53TBPS` +- New const `AzureSKUNameStandardE8DV4` +- New const `DatabaseShareOriginDirect` +- New const `AzureSKUNameStandardE2DV4` +- New const `AzureSKUNameStandardE2DV5` +- New const `AzureSKUNameStandardL16SV3` +- New const `DatabaseShareOriginDataShare` +- New const `AzureSKUNameStandardE16DV5` +- New const `CallerRoleAdmin` +- New const `DatabaseShareOriginOther` +- New const `AzureSKUNameStandardEC8AsV52TBPS` +- New const `AzureSKUNameStandardE4DV4` +- New const `AzureSKUNameStandardEC16AdsV5` +- New const `CallerRoleNone` +- New const `AzureSKUNameStandardE4DV5` +- New type alias `CallerRole` +- New type alias `DatabaseShareOrigin` +- New function `PossibleDatabaseShareOriginValues() []DatabaseShareOrigin` +- New function `PossibleCallerRoleValues() []CallerRole` +- New field `CallerRole` in struct `DatabasesClientBeginCreateOrUpdateOptions` +- New field `DatabaseShareOrigin` in struct `FollowerDatabaseDefinition` +- New field `TableLevelSharingProperties` in struct `FollowerDatabaseDefinition` +- New field `DatabaseNameOverride` in struct `AttachedDatabaseConfigurationProperties` +- New field `DatabaseNamePrefix` in struct `AttachedDatabaseConfigurationProperties` +- New field `OriginalDatabaseName` in struct `ReadOnlyFollowingDatabaseProperties` +- New field `TableLevelSharingProperties` in struct `ReadOnlyFollowingDatabaseProperties` +- New field `DatabaseShareOrigin` in struct `ReadOnlyFollowingDatabaseProperties` +- New field `RetrievalStartDate` in struct `IotHubConnectionProperties` +- New field `RetrievalStartDate` in struct `EventHubConnectionProperties` +- New field `CallerRole` in struct `DatabasesClientBeginUpdateOptions` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_attacheddatabaseconfigurations_client.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_attacheddatabaseconfigurations_client.go rename to sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go index 093240918da7..cd1507803254 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_attacheddatabaseconfigurations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewAttachedDatabaseConfigurationsClient(subscriptionID string, credential a // CheckNameAvailability - Checks that the attached database configuration resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // resourceName - The name of the resource. @@ -98,7 +99,7 @@ func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resourceName) @@ -115,7 +116,7 @@ func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityHandleR // BeginCreateOrUpdate - Creates or updates an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -136,7 +137,7 @@ func (client *AttachedDatabaseConfigurationsClient) BeginCreateOrUpdate(ctx cont // CreateOrUpdate - Creates or updates an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *AttachedDatabaseConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration, options *AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, parameters, options) if err != nil { @@ -176,7 +177,7 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -184,7 +185,7 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest( // BeginDelete - Deletes the attached database configuration with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -204,7 +205,7 @@ func (client *AttachedDatabaseConfigurationsClient) BeginDelete(ctx context.Cont // Delete - Deletes the attached database configuration with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *AttachedDatabaseConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, options) if err != nil { @@ -244,7 +245,7 @@ func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +253,7 @@ func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx cont // Get - Returns an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -297,7 +298,7 @@ func (client *AttachedDatabaseConfigurationsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +314,7 @@ func (client *AttachedDatabaseConfigurationsClient) getHandleResponse(resp *http } // NewListByClusterPager - Returns the list of attached database configurations of the given Kusto cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - AttachedDatabaseConfigurationsClientListByClusterOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.ListByCluster @@ -361,7 +361,7 @@ func (client *AttachedDatabaseConfigurationsClient) listByClusterCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_attacheddatabaseconfigurations_client_test.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go similarity index 68% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_attacheddatabaseconfigurations_client_test.go rename to sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go index 57600abc00f0..669f9f7bff79 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_attacheddatabaseconfigurations_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json func ExampleAttachedDatabaseConfigurationsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,10 @@ func ExampleAttachedDatabaseConfigurationsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - armkusto.AttachedDatabaseConfigurationsCheckNameRequest{ - Name: to.Ptr("adc1"), - Type: to.Ptr("Microsoft.Kusto/clusters/attachedDatabaseConfigurations"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.AttachedDatabaseConfigurationsCheckNameRequest{ + Name: to.Ptr("adc1"), + Type: to.Ptr("Microsoft.Kusto/clusters/attachedDatabaseConfigurations"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -43,7 +39,7 @@ func ExampleAttachedDatabaseConfigurationsClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoAttachedDatabaseConfigurationsListByCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoAttachedDatabaseConfigurationsListByCluster.json func ExampleAttachedDatabaseConfigurationsClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,9 +50,7 @@ func ExampleAttachedDatabaseConfigurationsClient_NewListByClusterPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByClusterPager("kustorptest", - "kustoCluster2", - nil) + pager := client.NewListByClusterPager("kustorptest", "kustoCluster2", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -69,7 +63,7 @@ func ExampleAttachedDatabaseConfigurationsClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoAttachedDatabaseConfigurationsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoAttachedDatabaseConfigurationsGet.json func ExampleAttachedDatabaseConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,11 +74,7 @@ func ExampleAttachedDatabaseConfigurationsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster2", - "attachedDatabaseConfigurationsTest", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster2", "attachedDatabaseConfigurationsTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -92,7 +82,7 @@ func ExampleAttachedDatabaseConfigurationsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,33 +93,29 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster2", - "attachedDatabaseConfigurationsTest", - armkusto.AttachedDatabaseConfiguration{ - Location: to.Ptr("westus"), - Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - DatabaseName: to.Ptr("kustodatabase"), - DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - ExternalTablesToExclude: []*string{ - to.Ptr("ExternalTable2")}, - ExternalTablesToInclude: []*string{ - to.Ptr("ExternalTable1")}, - MaterializedViewsToExclude: []*string{ - to.Ptr("MaterializedViewTable2")}, - MaterializedViewsToInclude: []*string{ - to.Ptr("MaterializedViewTable1")}, - TablesToExclude: []*string{ - to.Ptr("Table2")}, - TablesToInclude: []*string{ - to.Ptr("Table1")}, - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster2", "attachedDatabaseConfigurationsTest", armkusto.AttachedDatabaseConfiguration{ + Location: to.Ptr("westus"), + Properties: &armkusto.AttachedDatabaseConfigurationProperties{ + ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), + DatabaseName: to.Ptr("kustodatabase"), + DatabaseNameOverride: to.Ptr("overridekustodatabase"), + DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), + TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ + ExternalTablesToExclude: []*string{ + to.Ptr("ExternalTable2")}, + ExternalTablesToInclude: []*string{ + to.Ptr("ExternalTable1")}, + MaterializedViewsToExclude: []*string{ + to.Ptr("MaterializedViewTable2")}, + MaterializedViewsToInclude: []*string{ + to.Ptr("MaterializedViewTable1")}, + TablesToExclude: []*string{ + to.Ptr("Table2")}, + TablesToInclude: []*string{ + to.Ptr("Table1")}, }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -141,7 +127,7 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoAttachedDatabaseConfigurationsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoAttachedDatabaseConfigurationsDelete.json func ExampleAttachedDatabaseConfigurationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,11 +138,7 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "attachedDatabaseConfigurationsTest", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "attachedDatabaseConfigurationsTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/autorest.md b/sdk/resourcemanager/kusto/armkusto/autorest.md index 6eee797f12cd..58e093ec42f1 100644 --- a/sdk/resourcemanager/kusto/armkusto/autorest.md +++ b/sdk/resourcemanager/kusto/armkusto/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azure-kusto/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azure-kusto/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f70b7953f5d54889cc1825b37ad938342ca93a2e/specification/azure-kusto/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f70b7953f5d54889cc1825b37ad938342ca93a2e/specification/azure-kusto/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -``` \ No newline at end of file +module-version: 1.1.0 +``` diff --git a/sdk/resourcemanager/kusto/armkusto/build.go b/sdk/resourcemanager/kusto/armkusto/build.go index 2591582b8479..f854893b621d 100644 --- a/sdk/resourcemanager/kusto/armkusto/build.go +++ b/sdk/resourcemanager/kusto/armkusto/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/kusto/armkusto +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/kusto/armkusto package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_clusterprincipalassignments_client.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_clusterprincipalassignments_client.go rename to sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go index 429128af58fc..00ad4729bf3f 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_clusterprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewClusterPrincipalAssignmentsClient(subscriptionID string, credential azco // CheckNameAvailability - Checks that the principal assignment name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // principalAssignmentName - The name of the principal assignment. @@ -98,7 +99,7 @@ func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, principalAssignmentName) @@ -115,7 +116,7 @@ func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityHandleResp // BeginCreateOrUpdate - Create a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // principalAssignmentName - The name of the Kusto principalAssignment. @@ -136,7 +137,7 @@ func (client *ClusterPrincipalAssignmentsClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Create a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClusterPrincipalAssignmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment, options *ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, parameters, options) if err != nil { @@ -176,7 +177,7 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -184,7 +185,7 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // principalAssignmentName - The name of the Kusto principalAssignment. @@ -204,7 +205,7 @@ func (client *ClusterPrincipalAssignmentsClient) BeginDelete(ctx context.Context // Delete - Deletes a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClusterPrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, options) if err != nil { @@ -244,7 +245,7 @@ func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +253,7 @@ func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context // Get - Gets a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // principalAssignmentName - The name of the Kusto principalAssignment. @@ -297,7 +298,7 @@ func (client *ClusterPrincipalAssignmentsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +314,7 @@ func (client *ClusterPrincipalAssignmentsClient) getHandleResponse(resp *http.Re } // NewListPager - Lists all Kusto cluster principalAssignments. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClusterPrincipalAssignmentsClientListOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.List @@ -361,7 +361,7 @@ func (client *ClusterPrincipalAssignmentsClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusterprincipalassignments_client_test.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go similarity index 76% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusterprincipalassignments_client_test.go rename to sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go index 03d8f46450da..ab792e3e0cce 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusterprincipalassignments_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json func ExampleClusterPrincipalAssignmentsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,10 @@ func ExampleClusterPrincipalAssignmentsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - armkusto.ClusterPrincipalAssignmentCheckNameRequest{ - Name: to.Ptr("kustoprincipal1"), - Type: to.Ptr("Microsoft.Kusto/clusters/principalAssignments"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.ClusterPrincipalAssignmentCheckNameRequest{ + Name: to.Ptr("kustoprincipal1"), + Type: to.Ptr("Microsoft.Kusto/clusters/principalAssignments"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -43,7 +39,7 @@ func ExampleClusterPrincipalAssignmentsClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterPrincipalAssignmentsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterPrincipalAssignmentsGet.json func ExampleClusterPrincipalAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +50,7 @@ func ExampleClusterPrincipalAssignmentsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "kustoprincipal1", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +58,7 @@ func ExampleClusterPrincipalAssignmentsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json func ExampleClusterPrincipalAssignmentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,19 +69,14 @@ func ExampleClusterPrincipalAssignmentsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "kustoprincipal1", - armkusto.ClusterPrincipalAssignment{ - Properties: &armkusto.ClusterPrincipalProperties{ - PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), - TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", armkusto.ClusterPrincipalAssignment{ + Properties: &armkusto.ClusterPrincipalProperties{ + PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), + PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), + Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), + TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +88,7 @@ func ExampleClusterPrincipalAssignmentsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterPrincipalAssignmentsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterPrincipalAssignmentsDelete.json func ExampleClusterPrincipalAssignmentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,11 +99,7 @@ func ExampleClusterPrincipalAssignmentsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "kustoprincipal1", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -126,7 +109,7 @@ func ExampleClusterPrincipalAssignmentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterPrincipalAssignmentsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterPrincipalAssignmentsList.json func ExampleClusterPrincipalAssignmentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,9 +120,7 @@ func ExampleClusterPrincipalAssignmentsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_clusters_client.go b/sdk/resourcemanager/kusto/armkusto/clusters_client.go similarity index 96% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_clusters_client.go rename to sdk/resourcemanager/kusto/armkusto/clusters_client.go index cd4bc9e38ca1..e3ee7c907aad 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusters_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginAddLanguageExtensions - Add a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // languageExtensionsToAdd - The language extensions to add. @@ -77,7 +78,7 @@ func (client *ClustersClient) BeginAddLanguageExtensions(ctx context.Context, re // AddLanguageExtensions - Add a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) addLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList, options *ClustersClientBeginAddLanguageExtensionsOptions) (*http.Response, error) { req, err := client.addLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, languageExtensionsToAdd, options) if err != nil { @@ -113,7 +114,7 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, languageExtensionsToAdd) @@ -121,7 +122,7 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con // CheckNameAvailability - Checks that the cluster name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // location - Azure location (region) name. // clusterName - The name of the cluster. // options - ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability @@ -157,7 +158,7 @@ func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, clusterName) @@ -174,7 +175,7 @@ func (client *ClustersClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Create or update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // parameters - The Kusto cluster parameters supplied to the CreateOrUpdate operation. @@ -194,7 +195,7 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { @@ -230,7 +231,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -244,7 +245,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -262,7 +263,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -298,7 +299,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -306,7 +307,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // BeginDetachFollowerDatabases - Detaches all followers of a database owned by this cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // followerDatabaseToRemove - The follower databases properties to remove. @@ -326,7 +327,7 @@ func (client *ClustersClient) BeginDetachFollowerDatabases(ctx context.Context, // DetachFollowerDatabases - Detaches all followers of a database owned by this cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) detachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition, options *ClustersClientBeginDetachFollowerDatabasesOptions) (*http.Response, error) { req, err := client.detachFollowerDatabasesCreateRequest(ctx, resourceGroupName, clusterName, followerDatabaseToRemove, options) if err != nil { @@ -362,7 +363,7 @@ func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, followerDatabaseToRemove) @@ -371,7 +372,7 @@ func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.C // BeginDiagnoseVirtualNetwork - Diagnoses network connectivity status for external resources on which the service is dependent // on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientBeginDiagnoseVirtualNetworkOptions contains the optional parameters for the ClustersClient.BeginDiagnoseVirtualNetwork @@ -393,7 +394,7 @@ func (client *ClustersClient) BeginDiagnoseVirtualNetwork(ctx context.Context, r // DiagnoseVirtualNetwork - Diagnoses network connectivity status for external resources on which the service is dependent // on. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) diagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDiagnoseVirtualNetworkOptions) (*http.Response, error) { req, err := client.diagnoseVirtualNetworkCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -429,7 +430,7 @@ func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -437,7 +438,7 @@ func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Co // Get - Gets a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -476,7 +477,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -492,8 +493,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl } // NewListPager - Lists all Kusto clusters within a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // options - ClustersClientListOptions contains the optional parameters for the ClustersClient.List method. func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ @@ -529,7 +529,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -545,8 +545,7 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC } // NewListByResourceGroupPager - Lists all Kusto clusters within a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.ListByResourceGroup // method. @@ -588,7 +587,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -605,8 +604,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListFollowerDatabasesPager - Returns a list of databases that are owned by this cluster and were followed by another // cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientListFollowerDatabasesOptions contains the optional parameters for the ClustersClient.ListFollowerDatabases @@ -653,7 +651,7 @@ func (client *ClustersClient) listFollowerDatabasesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -669,8 +667,7 @@ func (client *ClustersClient) listFollowerDatabasesHandleResponse(resp *http.Res } // NewListLanguageExtensionsPager - Returns a list of language extensions that can run within KQL queries. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientListLanguageExtensionsOptions contains the optional parameters for the ClustersClient.ListLanguageExtensions @@ -717,7 +714,7 @@ func (client *ClustersClient) listLanguageExtensionsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -733,8 +730,7 @@ func (client *ClustersClient) listLanguageExtensionsHandleResponse(resp *http.Re } // NewListOutboundNetworkDependenciesEndpointsPager - Gets the network endpoints of all outbound dependencies of a Kusto cluster -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the ClustersClient.ListOutboundNetworkDependenciesEndpoints @@ -787,7 +783,7 @@ func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -803,8 +799,7 @@ func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsHandleResp } // NewListSKUsPager - Lists eligible SKUs for Kusto resource provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // options - ClustersClientListSKUsOptions contains the optional parameters for the ClustersClient.ListSKUs method. func (client *ClustersClient) NewListSKUsPager(options *ClustersClientListSKUsOptions) *runtime.Pager[ClustersClientListSKUsResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListSKUsResponse]{ @@ -840,7 +835,7 @@ func (client *ClustersClient) listSKUsCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -856,8 +851,7 @@ func (client *ClustersClient) listSKUsHandleResponse(resp *http.Response) (Clust } // NewListSKUsByResourcePager - Returns the SKUs available for the provided resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientListSKUsByResourceOptions contains the optional parameters for the ClustersClient.ListSKUsByResource @@ -904,7 +898,7 @@ func (client *ClustersClient) listSKUsByResourceCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -921,7 +915,7 @@ func (client *ClustersClient) listSKUsByResourceHandleResponse(resp *http.Respon // BeginRemoveLanguageExtensions - Remove a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // languageExtensionsToRemove - The language extensions to remove. @@ -941,7 +935,7 @@ func (client *ClustersClient) BeginRemoveLanguageExtensions(ctx context.Context, // RemoveLanguageExtensions - Remove a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) removeLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList, options *ClustersClientBeginRemoveLanguageExtensionsOptions) (*http.Response, error) { req, err := client.removeLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, languageExtensionsToRemove, options) if err != nil { @@ -977,7 +971,7 @@ func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, languageExtensionsToRemove) @@ -985,7 +979,7 @@ func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context. // BeginStart - Starts a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. @@ -1003,7 +997,7 @@ func (client *ClustersClient) BeginStart(ctx context.Context, resourceGroupName // Start - Starts a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -1039,7 +1033,7 @@ func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1047,7 +1041,7 @@ func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGr // BeginStop - Stops a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. @@ -1065,7 +1059,7 @@ func (client *ClustersClient) BeginStop(ctx context.Context, resourceGroupName s // Stop - Stops a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) stop(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -1101,7 +1095,7 @@ func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1109,7 +1103,7 @@ func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGro // BeginUpdate - Update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // parameters - The Kusto cluster parameters supplied to the Update operation. @@ -1128,7 +1122,7 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { @@ -1164,7 +1158,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusters_client_test.go b/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go similarity index 68% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusters_client_test.go rename to sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go index e25cbd946e47..b93747636454 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_clusters_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersGet.json func ExampleClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleClustersClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -39,7 +36,7 @@ func ExampleClustersClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersCreateOrUpdate.json func ExampleClustersClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,33 +47,29 @@ func ExampleClustersClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - armkusto.Cluster{ - Location: to.Ptr("westus"), - Identity: &armkusto.Identity{ - Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), - }, - Properties: &armkusto.ClusterProperties{ - AllowedIPRangeList: []*string{ - to.Ptr("0.0.0.0/0")}, - EnableAutoStop: to.Ptr(true), - EnableDoubleEncryption: to.Ptr(false), - EnablePurge: to.Ptr(true), - EnableStreamingIngest: to.Ptr(true), - PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), - PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - }, - SKU: &armkusto.AzureSKU{ - Name: to.Ptr(armkusto.AzureSKUNameStandardL8S), - Capacity: to.Ptr[int32](2), - Tier: to.Ptr(armkusto.AzureSKUTierStandard), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", armkusto.Cluster{ + Location: to.Ptr("westus"), + Identity: &armkusto.Identity{ + Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), + }, + Properties: &armkusto.ClusterProperties{ + AllowedIPRangeList: []*string{ + to.Ptr("0.0.0.0/0")}, + EnableAutoStop: to.Ptr(true), + EnableDoubleEncryption: to.Ptr(false), + EnablePurge: to.Ptr(true), + EnableStreamingIngest: to.Ptr(true), + PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), + PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), }, - &armkusto.ClustersClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + SKU: &armkusto.AzureSKU{ + Name: to.Ptr(armkusto.AzureSKUNameStandardL8S), + Capacity: to.Ptr[int32](2), + Tier: to.Ptr(armkusto.AzureSKUTierStandard), + }, + }, &armkusto.ClustersClientBeginCreateOrUpdateOptions{IfMatch: nil, + IfNoneMatch: nil, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -88,7 +81,7 @@ func ExampleClustersClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersUpdate.json func ExampleClustersClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -99,13 +92,9 @@ func ExampleClustersClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "kustorptest", - "kustoCluster2", - armkusto.ClusterUpdate{ - Location: to.Ptr("westus"), - }, - &armkusto.ClustersClientBeginUpdateOptions{IfMatch: to.Ptr("*")}) + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster2", armkusto.ClusterUpdate{ + Location: to.Ptr("westus"), + }, &armkusto.ClustersClientBeginUpdateOptions{IfMatch: to.Ptr("*")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -117,7 +106,7 @@ func ExampleClustersClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersDelete.json func ExampleClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -128,10 +117,7 @@ func ExampleClustersClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster2", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -141,7 +127,7 @@ func ExampleClustersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersStop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersStop.json func ExampleClustersClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,10 +138,7 @@ func ExampleClustersClient_BeginStop() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginStop(ctx, - "kustorptest", - "kustoCluster2", - nil) + poller, err := client.BeginStop(ctx, "kustorptest", "kustoCluster2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -165,7 +148,7 @@ func ExampleClustersClient_BeginStop() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersStart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersStart.json func ExampleClustersClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -176,10 +159,7 @@ func ExampleClustersClient_BeginStart() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginStart(ctx, - "kustorptest", - "kustoCluster2", - nil) + poller, err := client.BeginStart(ctx, "kustorptest", "kustoCluster2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -189,7 +169,7 @@ func ExampleClustersClient_BeginStart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterListFollowerDatabases.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterListFollowerDatabases.json func ExampleClustersClient_NewListFollowerDatabasesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -200,9 +180,7 @@ func ExampleClustersClient_NewListFollowerDatabasesPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListFollowerDatabasesPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListFollowerDatabasesPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -215,7 +193,7 @@ func ExampleClustersClient_NewListFollowerDatabasesPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterDetachFollowerDatabases.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterDetachFollowerDatabases.json func ExampleClustersClient_BeginDetachFollowerDatabases() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -226,14 +204,10 @@ func ExampleClustersClient_BeginDetachFollowerDatabases() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDetachFollowerDatabases(ctx, - "kustorptest", - "kustoCluster", - armkusto.FollowerDatabaseDefinition{ - AttachedDatabaseConfigurationName: to.Ptr("attachedDatabaseConfigurationsTest"), - ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster2"), - }, - nil) + poller, err := client.BeginDetachFollowerDatabases(ctx, "kustorptest", "kustoCluster", armkusto.FollowerDatabaseDefinition{ + AttachedDatabaseConfigurationName: to.Ptr("attachedDatabaseConfigurationsTest"), + ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster2"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -243,7 +217,7 @@ func ExampleClustersClient_BeginDetachFollowerDatabases() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersDiagnoseVirtualNetwork.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersDiagnoseVirtualNetwork.json func ExampleClustersClient_BeginDiagnoseVirtualNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -254,10 +228,7 @@ func ExampleClustersClient_BeginDiagnoseVirtualNetwork() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDiagnoseVirtualNetwork(ctx, - "kustorptest", - "kustoCluster", - nil) + poller, err := client.BeginDiagnoseVirtualNetwork(ctx, "kustorptest", "kustoCluster", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -269,7 +240,7 @@ func ExampleClustersClient_BeginDiagnoseVirtualNetwork() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersListByResourceGroup.json func ExampleClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -280,8 +251,7 @@ func ExampleClustersClient_NewListByResourceGroupPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByResourceGroupPager("kustorptest", - nil) + pager := client.NewListByResourceGroupPager("kustorptest", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -294,7 +264,7 @@ func ExampleClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersList.json func ExampleClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -318,7 +288,31 @@ func ExampleClustersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClustersCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersListSkus.json +func ExampleClustersClient_NewListSKUsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewClustersClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListSKUsPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersCheckNameAvailability.json func ExampleClustersClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -329,13 +323,10 @@ func ExampleClustersClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "westus", - armkusto.ClusterCheckNameRequest{ - Name: to.Ptr("kustoCluster"), - Type: to.Ptr("Microsoft.Kusto/clusters"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "westus", armkusto.ClusterCheckNameRequest{ + Name: to.Ptr("kustoCluster"), + Type: to.Ptr("Microsoft.Kusto/clusters"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -343,7 +334,31 @@ func ExampleClustersClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoOutboundNetworkDependenciesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClustersListResourceSkus.json +func ExampleClustersClient_NewListSKUsByResourcePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewClustersClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListSKUsByResourcePager("kustorptest", "kustoCluster", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoOutboundNetworkDependenciesList.json func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -354,9 +369,7 @@ func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListOutboundNetworkDependenciesEndpointsPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListOutboundNetworkDependenciesEndpointsPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -369,7 +382,7 @@ func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterListLanguageExtensions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterListLanguageExtensions.json func ExampleClustersClient_NewListLanguageExtensionsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -380,9 +393,7 @@ func ExampleClustersClient_NewListLanguageExtensionsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListLanguageExtensionsPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListLanguageExtensionsPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -395,7 +406,7 @@ func ExampleClustersClient_NewListLanguageExtensionsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterAddLanguageExtensions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterAddLanguageExtensions.json func ExampleClustersClient_BeginAddLanguageExtensions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -406,19 +417,15 @@ func ExampleClustersClient_BeginAddLanguageExtensions() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginAddLanguageExtensions(ctx, - "kustorptest", - "kustoCluster", - armkusto.LanguageExtensionsList{ - Value: []*armkusto.LanguageExtension{ - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - }, - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, - }, - nil) + poller, err := client.BeginAddLanguageExtensions(ctx, "kustorptest", "kustoCluster", armkusto.LanguageExtensionsList{ + Value: []*armkusto.LanguageExtension{ + { + LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), + }, + { + LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), + }}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -428,7 +435,7 @@ func ExampleClustersClient_BeginAddLanguageExtensions() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoClusterRemoveLanguageExtensions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoClusterRemoveLanguageExtensions.json func ExampleClustersClient_BeginRemoveLanguageExtensions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -439,19 +446,15 @@ func ExampleClustersClient_BeginRemoveLanguageExtensions() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRemoveLanguageExtensions(ctx, - "kustorptest", - "kustoCluster", - armkusto.LanguageExtensionsList{ - Value: []*armkusto.LanguageExtension{ - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - }, - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, - }, - nil) + poller, err := client.BeginRemoveLanguageExtensions(ctx, "kustorptest", "kustoCluster", armkusto.LanguageExtensionsList{ + Value: []*armkusto.LanguageExtension{ + { + LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), + }, + { + LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), + }}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_constants.go b/sdk/resourcemanager/kusto/armkusto/constants.go similarity index 89% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_constants.go rename to sdk/resourcemanager/kusto/armkusto/constants.go index 17a471b9b5da..7cce5ba10834 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_constants.go +++ b/sdk/resourcemanager/kusto/armkusto/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto const ( moduleName = "armkusto" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // AzureSKUName - SKU name. @@ -36,14 +37,20 @@ const ( AzureSKUNameStandardE16AsV44TBPS AzureSKUName = "Standard_E16as_v4+4TB_PS" AzureSKUNameStandardE16AsV53TBPS AzureSKUName = "Standard_E16as_v5+3TB_PS" AzureSKUNameStandardE16AsV54TBPS AzureSKUName = "Standard_E16as_v5+4TB_PS" + AzureSKUNameStandardE16DV4 AzureSKUName = "Standard_E16d_v4" + AzureSKUNameStandardE16DV5 AzureSKUName = "Standard_E16d_v5" AzureSKUNameStandardE16SV43TBPS AzureSKUName = "Standard_E16s_v4+3TB_PS" AzureSKUNameStandardE16SV44TBPS AzureSKUName = "Standard_E16s_v4+4TB_PS" AzureSKUNameStandardE16SV53TBPS AzureSKUName = "Standard_E16s_v5+3TB_PS" AzureSKUNameStandardE16SV54TBPS AzureSKUName = "Standard_E16s_v5+4TB_PS" AzureSKUNameStandardE2AV4 AzureSKUName = "Standard_E2a_v4" AzureSKUNameStandardE2AdsV5 AzureSKUName = "Standard_E2ads_v5" + AzureSKUNameStandardE2DV4 AzureSKUName = "Standard_E2d_v4" + AzureSKUNameStandardE2DV5 AzureSKUName = "Standard_E2d_v5" AzureSKUNameStandardE4AV4 AzureSKUName = "Standard_E4a_v4" AzureSKUNameStandardE4AdsV5 AzureSKUName = "Standard_E4ads_v5" + AzureSKUNameStandardE4DV4 AzureSKUName = "Standard_E4d_v4" + AzureSKUNameStandardE4DV5 AzureSKUName = "Standard_E4d_v5" AzureSKUNameStandardE64IV3 AzureSKUName = "Standard_E64i_v3" AzureSKUNameStandardE80IDsV4 AzureSKUName = "Standard_E80ids_v4" AzureSKUNameStandardE8AV4 AzureSKUName = "Standard_E8a_v4" @@ -52,15 +59,27 @@ const ( AzureSKUNameStandardE8AsV42TBPS AzureSKUName = "Standard_E8as_v4+2TB_PS" AzureSKUNameStandardE8AsV51TBPS AzureSKUName = "Standard_E8as_v5+1TB_PS" AzureSKUNameStandardE8AsV52TBPS AzureSKUName = "Standard_E8as_v5+2TB_PS" + AzureSKUNameStandardE8DV4 AzureSKUName = "Standard_E8d_v4" + AzureSKUNameStandardE8DV5 AzureSKUName = "Standard_E8d_v5" AzureSKUNameStandardE8SV41TBPS AzureSKUName = "Standard_E8s_v4+1TB_PS" AzureSKUNameStandardE8SV42TBPS AzureSKUName = "Standard_E8s_v4+2TB_PS" AzureSKUNameStandardE8SV51TBPS AzureSKUName = "Standard_E8s_v5+1TB_PS" AzureSKUNameStandardE8SV52TBPS AzureSKUName = "Standard_E8s_v5+2TB_PS" + AzureSKUNameStandardEC16AdsV5 AzureSKUName = "Standard_EC16ads_v5" + AzureSKUNameStandardEC16AsV53TBPS AzureSKUName = "Standard_EC16as_v5+3TB_PS" + AzureSKUNameStandardEC16AsV54TBPS AzureSKUName = "Standard_EC16as_v5+4TB_PS" + AzureSKUNameStandardEC8AdsV5 AzureSKUName = "Standard_EC8ads_v5" + AzureSKUNameStandardEC8AsV51TBPS AzureSKUName = "Standard_EC8as_v5+1TB_PS" + AzureSKUNameStandardEC8AsV52TBPS AzureSKUName = "Standard_EC8as_v5+2TB_PS" + AzureSKUNameStandardL16AsV3 AzureSKUName = "Standard_L16as_v3" AzureSKUNameStandardL16S AzureSKUName = "Standard_L16s" AzureSKUNameStandardL16SV2 AzureSKUName = "Standard_L16s_v2" + AzureSKUNameStandardL16SV3 AzureSKUName = "Standard_L16s_v3" AzureSKUNameStandardL4S AzureSKUName = "Standard_L4s" + AzureSKUNameStandardL8AsV3 AzureSKUName = "Standard_L8as_v3" AzureSKUNameStandardL8S AzureSKUName = "Standard_L8s" AzureSKUNameStandardL8SV2 AzureSKUName = "Standard_L8s_v2" + AzureSKUNameStandardL8SV3 AzureSKUName = "Standard_L8s_v3" ) // PossibleAzureSKUNameValues returns the possible values for the AzureSKUName const type. @@ -85,14 +104,20 @@ func PossibleAzureSKUNameValues() []AzureSKUName { AzureSKUNameStandardE16AsV44TBPS, AzureSKUNameStandardE16AsV53TBPS, AzureSKUNameStandardE16AsV54TBPS, + AzureSKUNameStandardE16DV4, + AzureSKUNameStandardE16DV5, AzureSKUNameStandardE16SV43TBPS, AzureSKUNameStandardE16SV44TBPS, AzureSKUNameStandardE16SV53TBPS, AzureSKUNameStandardE16SV54TBPS, AzureSKUNameStandardE2AV4, AzureSKUNameStandardE2AdsV5, + AzureSKUNameStandardE2DV4, + AzureSKUNameStandardE2DV5, AzureSKUNameStandardE4AV4, AzureSKUNameStandardE4AdsV5, + AzureSKUNameStandardE4DV4, + AzureSKUNameStandardE4DV5, AzureSKUNameStandardE64IV3, AzureSKUNameStandardE80IDsV4, AzureSKUNameStandardE8AV4, @@ -101,15 +126,27 @@ func PossibleAzureSKUNameValues() []AzureSKUName { AzureSKUNameStandardE8AsV42TBPS, AzureSKUNameStandardE8AsV51TBPS, AzureSKUNameStandardE8AsV52TBPS, + AzureSKUNameStandardE8DV4, + AzureSKUNameStandardE8DV5, AzureSKUNameStandardE8SV41TBPS, AzureSKUNameStandardE8SV42TBPS, AzureSKUNameStandardE8SV51TBPS, AzureSKUNameStandardE8SV52TBPS, + AzureSKUNameStandardEC16AdsV5, + AzureSKUNameStandardEC16AsV53TBPS, + AzureSKUNameStandardEC16AsV54TBPS, + AzureSKUNameStandardEC8AdsV5, + AzureSKUNameStandardEC8AsV51TBPS, + AzureSKUNameStandardEC8AsV52TBPS, + AzureSKUNameStandardL16AsV3, AzureSKUNameStandardL16S, AzureSKUNameStandardL16SV2, + AzureSKUNameStandardL16SV3, AzureSKUNameStandardL4S, + AzureSKUNameStandardL8AsV3, AzureSKUNameStandardL8S, AzureSKUNameStandardL8SV2, + AzureSKUNameStandardL8SV3, } } @@ -163,6 +200,21 @@ func PossibleBlobStorageEventTypeValues() []BlobStorageEventType { } } +type CallerRole string + +const ( + CallerRoleAdmin CallerRole = "Admin" + CallerRoleNone CallerRole = "None" +) + +// PossibleCallerRoleValues returns the possible values for the CallerRole const type. +func PossibleCallerRoleValues() []CallerRole { + return []CallerRole{ + CallerRoleAdmin, + CallerRoleNone, + } +} + // ClusterNetworkAccessFlag - Whether or not to restrict outbound network access. Value is optional but if passed in, must // be 'Enabled' or 'Disabled' type ClusterNetworkAccessFlag string @@ -309,6 +361,24 @@ func PossibleDatabaseRoutingValues() []DatabaseRouting { } } +// DatabaseShareOrigin - The origin of the following setup. +type DatabaseShareOrigin string + +const ( + DatabaseShareOriginDataShare DatabaseShareOrigin = "DataShare" + DatabaseShareOriginDirect DatabaseShareOrigin = "Direct" + DatabaseShareOriginOther DatabaseShareOrigin = "Other" +) + +// PossibleDatabaseShareOriginValues returns the possible values for the DatabaseShareOrigin const type. +func PossibleDatabaseShareOriginValues() []DatabaseShareOrigin { + return []DatabaseShareOrigin{ + DatabaseShareOriginDataShare, + DatabaseShareOriginDirect, + DatabaseShareOriginOther, + } +} + // DefaultPrincipalsModificationKind - The default principals modification kind type DefaultPrincipalsModificationKind string diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_databaseprincipalassignments_client.go b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_databaseprincipalassignments_client.go rename to sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go index 73cf213e378c..5fec23d4d448 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_databaseprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewDatabasePrincipalAssignmentsClient(subscriptionID string, credential azc // CheckNameAvailability - Checks that the database principal assignment is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -103,7 +104,7 @@ func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, principalAssignmentName) @@ -120,7 +121,7 @@ func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityHandleRes // BeginCreateOrUpdate - Creates a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -142,7 +143,7 @@ func (client *DatabasePrincipalAssignmentsClient) BeginCreateOrUpdate(ctx contex // CreateOrUpdate - Creates a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DatabasePrincipalAssignmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment, options *DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, parameters, options) if err != nil { @@ -186,7 +187,7 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -194,7 +195,7 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ct // BeginDelete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -215,7 +216,7 @@ func (client *DatabasePrincipalAssignmentsClient) BeginDelete(ctx context.Contex // Delete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DatabasePrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, options) if err != nil { @@ -259,7 +260,7 @@ func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +268,7 @@ func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx contex // Get - Gets a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -317,7 +318,7 @@ func (client *DatabasePrincipalAssignmentsClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,8 +334,7 @@ func (client *DatabasePrincipalAssignmentsClient) getHandleResponse(resp *http.R } // NewListPager - Lists all Kusto cluster database principalAssignments. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -386,7 +386,7 @@ func (client *DatabasePrincipalAssignmentsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_databaseprincipalassignments_client_test.go b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go similarity index 75% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_databaseprincipalassignments_client_test.go rename to sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go index 2942301ec0e7..0d2e926ec06e 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_databaseprincipalassignments_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json func ExampleDatabasePrincipalAssignmentsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,15 +28,10 @@ func ExampleDatabasePrincipalAssignmentsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - "Kustodatabase8", - armkusto.DatabasePrincipalAssignmentCheckNameRequest{ - Name: to.Ptr("kustoprincipal1"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/principalAssignments"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", armkusto.DatabasePrincipalAssignmentCheckNameRequest{ + Name: to.Ptr("kustoprincipal1"), + Type: to.Ptr("Microsoft.Kusto/clusters/databases/principalAssignments"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -44,7 +39,7 @@ func ExampleDatabasePrincipalAssignmentsClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasePrincipalAssignmentsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasePrincipalAssignmentsGet.json func ExampleDatabasePrincipalAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,12 +50,7 @@ func ExampleDatabasePrincipalAssignmentsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "Kustodatabase8", - "kustoprincipal1", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +58,7 @@ func ExampleDatabasePrincipalAssignmentsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json func ExampleDatabasePrincipalAssignmentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,20 +69,14 @@ func ExampleDatabasePrincipalAssignmentsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "Kustodatabase8", - "kustoprincipal1", - armkusto.DatabasePrincipalAssignment{ - Properties: &armkusto.DatabasePrincipalProperties{ - PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", armkusto.DatabasePrincipalAssignment{ + Properties: &armkusto.DatabasePrincipalProperties{ + PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), + PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), + Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), + TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -104,7 +88,7 @@ func ExampleDatabasePrincipalAssignmentsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasePrincipalAssignmentsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasePrincipalAssignmentsDelete.json func ExampleDatabasePrincipalAssignmentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -115,12 +99,7 @@ func ExampleDatabasePrincipalAssignmentsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "Kustodatabase8", - "kustoprincipal1", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -130,7 +109,7 @@ func ExampleDatabasePrincipalAssignmentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasePrincipalAssignmentsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasePrincipalAssignmentsList.json func ExampleDatabasePrincipalAssignmentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -141,10 +120,7 @@ func ExampleDatabasePrincipalAssignmentsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("kustorptest", - "kustoCluster", - "Kustodatabase8", - nil) + pager := client.NewListPager("kustorptest", "kustoCluster", "Kustodatabase8", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_databases_client.go b/sdk/resourcemanager/kusto/armkusto/databases_client.go similarity index 96% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_databases_client.go rename to sdk/resourcemanager/kusto/armkusto/databases_client.go index 99e80377d2e8..d2e04eff9fbd 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_databases_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databases_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // AddPrincipals - Add Database principals permissions. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -102,7 +103,7 @@ func (client *DatabasesClient) addPrincipalsCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, databasePrincipalsToAdd) @@ -119,7 +120,7 @@ func (client *DatabasesClient) addPrincipalsHandleResponse(resp *http.Response) // CheckNameAvailability - Checks that the databases resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // resourceName - The name of the resource. @@ -160,7 +161,7 @@ func (client *DatabasesClient) checkNameAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resourceName) @@ -177,7 +178,7 @@ func (client *DatabasesClient) checkNameAvailabilityHandleResponse(resp *http.Re // BeginCreateOrUpdate - Creates or updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -198,7 +199,7 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -238,7 +239,10 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") + if options != nil && options.CallerRole != nil { + reqQP.Set("callerRole", string(*options.CallerRole)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -246,7 +250,7 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes the database with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -265,7 +269,7 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes the database with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { @@ -305,7 +309,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +317,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // Get - Returns a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -357,7 +361,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,8 +377,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases } // NewListByClusterPager - Returns the list of databases of the given Kusto cluster. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.ListByCluster method. @@ -420,7 +423,7 @@ func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -436,8 +439,7 @@ func (client *DatabasesClient) listByClusterHandleResponse(resp *http.Response) } // NewListPrincipalsPager - Returns a list of database principals of the given Kusto cluster and database. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -489,7 +491,7 @@ func (client *DatabasesClient) listPrincipalsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -506,7 +508,7 @@ func (client *DatabasesClient) listPrincipalsHandleResponse(resp *http.Response) // RemovePrincipals - Remove Database principals permissions. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -552,7 +554,7 @@ func (client *DatabasesClient) removePrincipalsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, databasePrincipalsToRemove) @@ -569,7 +571,7 @@ func (client *DatabasesClient) removePrincipalsHandleResponse(resp *http.Respons // BeginUpdate - Updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -589,7 +591,7 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -629,7 +631,10 @@ func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") + if options != nil && options.CallerRole != nil { + reqQP.Set("callerRole", string(*options.CallerRole)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_databases_client_test.go b/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go similarity index 57% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_databases_client_test.go rename to sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go index 729a8af69ecf..41d31e201f33 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_databases_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasesCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesCheckNameAvailability.json func ExampleDatabasesClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,10 @@ func ExampleDatabasesClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - armkusto.CheckNameRequest{ - Name: to.Ptr("database1"), - Type: to.Ptr(armkusto.TypeMicrosoftKustoClustersDatabases), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.CheckNameRequest{ + Name: to.Ptr("database1"), + Type: to.Ptr(armkusto.TypeMicrosoftKustoClustersDatabases), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -43,7 +39,7 @@ func ExampleDatabasesClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasesListByCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesListByCluster.json func ExampleDatabasesClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,9 +50,7 @@ func ExampleDatabasesClient_NewListByClusterPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByClusterPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListByClusterPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -69,7 +63,7 @@ func ExampleDatabasesClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesGet.json func ExampleDatabasesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,11 +74,7 @@ func ExampleDatabasesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -92,8 +82,8 @@ func ExampleDatabasesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabaseReadonlyUpdate.json -func ExampleDatabasesClient_BeginCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabaseReadonlyUpdate.json +func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadOnlyDatabaseUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -103,18 +93,42 @@ func ExampleDatabasesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "kustoReadOnlyDatabase", - &armkusto.ReadOnlyFollowingDatabase{ - Kind: to.Ptr(armkusto.KindReadOnlyFollowing), - Location: to.Ptr("westus"), - Properties: &armkusto.ReadOnlyFollowingDatabaseProperties{ - HotCachePeriod: to.Ptr("P1D"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "kustoReadOnlyDatabase", &armkusto.ReadOnlyFollowingDatabase{ + Kind: to.Ptr(armkusto.KindReadOnlyFollowing), + Location: to.Ptr("westus"), + Properties: &armkusto.ReadOnlyFollowingDatabaseProperties{ + HotCachePeriod: to.Ptr("P1D"), + }, + }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesCreateOrUpdate.json +func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadWriteDatabaseCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDatabasesClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", &armkusto.ReadWriteDatabase{ + Kind: to.Ptr(armkusto.KindReadWrite), + Location: to.Ptr("westus"), + Properties: &armkusto.ReadWriteDatabaseProperties{ + SoftDeletePeriod: to.Ptr("P1D"), }, - nil) + }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: to.Ptr(armkusto.CallerRoleAdmin)}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -126,7 +140,7 @@ func ExampleDatabasesClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasesUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesUpdate.json func ExampleDatabasesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,17 +151,12 @@ func ExampleDatabasesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - &armkusto.ReadWriteDatabase{ - Kind: to.Ptr(armkusto.KindReadWrite), - Properties: &armkusto.ReadWriteDatabaseProperties{ - HotCachePeriod: to.Ptr("P1D"), - }, + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", &armkusto.ReadWriteDatabase{ + Kind: to.Ptr(armkusto.KindReadWrite), + Properties: &armkusto.ReadWriteDatabaseProperties{ + HotCachePeriod: to.Ptr("P1D"), }, - nil) + }, &armkusto.DatabasesClientBeginUpdateOptions{CallerRole: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -159,7 +168,7 @@ func ExampleDatabasesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabasesDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabasesDelete.json func ExampleDatabasesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,11 +179,7 @@ func ExampleDatabasesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -184,7 +189,7 @@ func ExampleDatabasesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabaseListPrincipals.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabaseListPrincipals.json func ExampleDatabasesClient_NewListPrincipalsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -195,10 +200,7 @@ func ExampleDatabasesClient_NewListPrincipalsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPrincipalsPager("kustorptest", - "kustoCluster", - "KustoDatabase8", - nil) + pager := client.NewListPrincipalsPager("kustorptest", "kustoCluster", "KustoDatabase8", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -211,7 +213,7 @@ func ExampleDatabasesClient_NewListPrincipalsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabaseAddPrincipals.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabaseAddPrincipals.json func ExampleDatabasesClient_AddPrincipals() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -222,38 +224,33 @@ func ExampleDatabasesClient_AddPrincipals() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.AddPrincipals(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - armkusto.DatabasePrincipalListRequest{ - Value: []*armkusto.DatabasePrincipal{ - { - Name: to.Ptr("Some User"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - AppID: to.Ptr(""), - Email: to.Ptr("user@microsoft.com"), - Fqn: to.Ptr("aaduser=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }, - { - Name: to.Ptr("Kusto"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - AppID: to.Ptr(""), - Email: to.Ptr("kusto@microsoft.com"), - Fqn: to.Ptr("aadgroup=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - }, - { - Name: to.Ptr("SomeApp"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - AppID: to.Ptr("some_guid_app_id"), - Email: to.Ptr(""), - Fqn: to.Ptr("aadapp=some_guid_app_id"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }}, - }, - nil) + res, err := client.AddPrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ + Value: []*armkusto.DatabasePrincipal{ + { + Name: to.Ptr("Some User"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), + AppID: to.Ptr(""), + Email: to.Ptr("user@microsoft.com"), + Fqn: to.Ptr("aaduser=some_guid"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), + }, + { + Name: to.Ptr("Kusto"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), + AppID: to.Ptr(""), + Email: to.Ptr("kusto@microsoft.com"), + Fqn: to.Ptr("aadgroup=some_guid"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), + }, + { + Name: to.Ptr("SomeApp"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), + AppID: to.Ptr("some_guid_app_id"), + Email: to.Ptr(""), + Fqn: to.Ptr("aadapp=some_guid_app_id"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), + }}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -261,7 +258,7 @@ func ExampleDatabasesClient_AddPrincipals() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDatabaseRemovePrincipals.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDatabaseRemovePrincipals.json func ExampleDatabasesClient_RemovePrincipals() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -272,38 +269,33 @@ func ExampleDatabasesClient_RemovePrincipals() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.RemovePrincipals(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - armkusto.DatabasePrincipalListRequest{ - Value: []*armkusto.DatabasePrincipal{ - { - Name: to.Ptr("Some User"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - AppID: to.Ptr(""), - Email: to.Ptr("user@microsoft.com"), - Fqn: to.Ptr("aaduser=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }, - { - Name: to.Ptr("Kusto"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - AppID: to.Ptr(""), - Email: to.Ptr("kusto@microsoft.com"), - Fqn: to.Ptr("aadgroup=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - }, - { - Name: to.Ptr("SomeApp"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - AppID: to.Ptr("some_guid_app_id"), - Email: to.Ptr(""), - Fqn: to.Ptr("aadapp=some_guid_app_id"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }}, - }, - nil) + res, err := client.RemovePrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ + Value: []*armkusto.DatabasePrincipal{ + { + Name: to.Ptr("Some User"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), + AppID: to.Ptr(""), + Email: to.Ptr("user@microsoft.com"), + Fqn: to.Ptr("aaduser=some_guid"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), + }, + { + Name: to.Ptr("Kusto"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), + AppID: to.Ptr(""), + Email: to.Ptr("kusto@microsoft.com"), + Fqn: to.Ptr("aadgroup=some_guid"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), + }, + { + Name: to.Ptr("SomeApp"), + Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), + AppID: to.Ptr("some_guid_app_id"), + Email: to.Ptr(""), + Fqn: to.Ptr("aadapp=some_guid_app_id"), + Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), + }}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_dataconnections_client.go b/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_dataconnections_client.go rename to sdk/resourcemanager/kusto/armkusto/dataconnections_client.go index 95a211acfdf6..c8184118fdf9 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_dataconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewDataConnectionsClient(subscriptionID string, credential azcore.TokenCred // CheckNameAvailability - Checks that the data connection name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -103,7 +104,7 @@ func (client *DataConnectionsClient) checkNameAvailabilityCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataConnectionName) @@ -120,7 +121,7 @@ func (client *DataConnectionsClient) checkNameAvailabilityHandleResponse(resp *h // BeginCreateOrUpdate - Creates or updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -142,7 +143,7 @@ func (client *DataConnectionsClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DataConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters, options) if err != nil { @@ -186,7 +187,7 @@ func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -194,7 +195,7 @@ func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Con // BeginDataConnectionValidation - Checks that the data connection parameters are valid. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -217,7 +218,7 @@ func (client *DataConnectionsClient) BeginDataConnectionValidation(ctx context.C // DataConnectionValidation - Checks that the data connection parameters are valid. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DataConnectionsClient) dataConnectionValidation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation, options *DataConnectionsClientBeginDataConnectionValidationOptions) (*http.Response, error) { req, err := client.dataConnectionValidationCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -257,7 +258,7 @@ func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -265,7 +266,7 @@ func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx c // BeginDelete - Deletes the data connection with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -286,7 +287,7 @@ func (client *DataConnectionsClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes the data connection with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DataConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, options) if err != nil { @@ -330,7 +331,7 @@ func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,7 +339,7 @@ func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, re // Get - Returns a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -387,7 +388,7 @@ func (client *DataConnectionsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -403,8 +404,7 @@ func (client *DataConnectionsClient) getHandleResponse(resp *http.Response) (Dat } // NewListByDatabasePager - Returns the list of data connections of the given Kusto database. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -456,7 +456,7 @@ func (client *DataConnectionsClient) listByDatabaseCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -473,7 +473,7 @@ func (client *DataConnectionsClient) listByDatabaseHandleResponse(resp *http.Res // BeginUpdate - Updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -495,7 +495,7 @@ func (client *DataConnectionsClient) BeginUpdate(ctx context.Context, resourceGr // Update - Updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *DataConnectionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters, options) if err != nil { @@ -539,7 +539,7 @@ func (client *DataConnectionsClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go new file mode 100644 index 000000000000..bbb9fd34d938 --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go @@ -0,0 +1,341 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armkusto_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsListByDatabase.json +func ExampleDataConnectionsClient_NewListByDatabasePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByDatabasePager("kustorptest", "kustoCluster", "KustoDatabase8", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionEventGridValidationAsync.json +func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionEventGridValidation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDataConnectionValidation(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionValidation{ + DataConnectionName: to.Ptr("dataConnectionTest"), + Properties: &armkusto.EventGridDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), + Properties: &armkusto.EventGridConnectionProperties{ + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ConsumerGroup: to.Ptr("$Default"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + IgnoreFirstRecord: to.Ptr(false), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + MappingRuleName: to.Ptr("TestMapping"), + StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + TableName: to.Ptr("TestTable"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionValidationAsync.json +func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionValidation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDataConnectionValidation(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionValidation{ + DataConnectionName: to.Ptr("dataConnectionTest"), + Properties: &armkusto.EventHubDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventHub), + Properties: &armkusto.EventHubConnectionProperties{ + Compression: to.Ptr(armkusto.CompressionNone), + ConsumerGroup: to.Ptr("testConsumerGroup1"), + DataFormat: to.Ptr(armkusto.EventHubDataFormatJSON), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + MappingRuleName: to.Ptr("TestMapping"), + TableName: to.Ptr("TestTable"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsCheckNameAvailability.json +func ExampleDataConnectionsClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionCheckNameRequest{ + Name: to.Ptr("DataConnections8"), + Type: to.Ptr("Microsoft.Kusto/clusters/databases/dataConnections"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsEventGridGet.json +func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventGridGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsGet.json +func ExampleDataConnectionsClient_Get_kustoDataConnectionsGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsCreateOrUpdate.json +func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventHub), + Location: to.Ptr("westus"), + Properties: &armkusto.EventHubConnectionProperties{ + ConsumerGroup: to.Ptr("testConsumerGroup1"), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsEventGridCreateOrUpdate.json +func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventGridCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), + Location: to.Ptr("westus"), + Properties: &armkusto.EventGridConnectionProperties{ + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ConsumerGroup: to.Ptr("$Default"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + IgnoreFirstRecord: to.Ptr(false), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + MappingRuleName: to.Ptr("TestMapping"), + StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + TableName: to.Ptr("TestTable"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsEventGridUpdate.json +func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventGridUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), + Location: to.Ptr("westus"), + Properties: &armkusto.EventGridConnectionProperties{ + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ConsumerGroup: to.Ptr("$Default"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + IgnoreFirstRecord: to.Ptr(false), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + MappingRuleName: to.Ptr("TestMapping"), + StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + TableName: to.Ptr("TestTable"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsUpdate.json +func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnection{ + Kind: to.Ptr(armkusto.DataConnectionKindEventHub), + Location: to.Ptr("westus"), + Properties: &armkusto.EventHubConnectionProperties{ + ConsumerGroup: to.Ptr("testConsumerGroup1"), + EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoDataConnectionsDelete.json +func ExampleDataConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/kusto/armkusto/go.mod b/sdk/resourcemanager/kusto/armkusto/go.mod index 26d349535ff1..e0ab412ef86b 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.mod +++ b/sdk/resourcemanager/kusto/armkusto/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/kusto/armkusto/go.sum b/sdk/resourcemanager/kusto/armkusto/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.sum +++ b/sdk/resourcemanager/kusto/armkusto/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_managedprivateendpoints_client.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_managedprivateendpoints_client.go rename to sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go index 4f6b5148c271..cf168cd9b051 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_managedprivateendpoints_client.go +++ b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.T // CheckNameAvailability - Checks that the managed private endpoints resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // resourceName - The name of the resource. @@ -98,7 +99,7 @@ func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resourceName) @@ -115,7 +116,7 @@ func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityHandleResponse // BeginCreateOrUpdate - Creates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // managedPrivateEndpointName - The name of the managed private endpoint. @@ -136,7 +137,7 @@ func (client *ManagedPrivateEndpointsClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Creates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ManagedPrivateEndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters, options) if err != nil { @@ -176,7 +177,7 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -184,7 +185,7 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx con // BeginDelete - Deletes a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // managedPrivateEndpointName - The name of the managed private endpoint. @@ -204,7 +205,7 @@ func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, re // Delete - Deletes a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, options) if err != nil { @@ -244,7 +245,7 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +253,7 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con // Get - Gets a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // managedPrivateEndpointName - The name of the managed private endpoint. @@ -297,7 +298,7 @@ func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,8 +314,7 @@ func (client *ManagedPrivateEndpointsClient) getHandleResponse(resp *http.Respon } // NewListPager - Returns the list of managed private endpoints. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.List @@ -361,7 +361,7 @@ func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +378,7 @@ func (client *ManagedPrivateEndpointsClient) listHandleResponse(resp *http.Respo // BeginUpdate - Updates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // managedPrivateEndpointName - The name of the managed private endpoint. @@ -399,7 +399,7 @@ func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, re // Update - Updates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters, options) if err != nil { @@ -439,7 +439,7 @@ func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_managedprivateendpoints_client_test.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go similarity index 72% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_managedprivateendpoints_client_test.go rename to sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go index baf710b02e90..3953fd8a87db 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_managedprivateendpoints_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json func ExampleManagedPrivateEndpointsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,10 @@ func ExampleManagedPrivateEndpointsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - armkusto.ManagedPrivateEndpointsCheckNameRequest{ - Name: to.Ptr("pme1"), - Type: to.Ptr("Microsoft.Kusto/clusters/managedPrivateEndpoints"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.ManagedPrivateEndpointsCheckNameRequest{ + Name: to.Ptr("pme1"), + Type: to.Ptr("Microsoft.Kusto/clusters/managedPrivateEndpoints"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -43,7 +39,7 @@ func ExampleManagedPrivateEndpointsClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsList.json func ExampleManagedPrivateEndpointsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,9 +50,7 @@ func ExampleManagedPrivateEndpointsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -69,7 +63,7 @@ func ExampleManagedPrivateEndpointsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsGet.json func ExampleManagedPrivateEndpointsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,11 +74,7 @@ func ExampleManagedPrivateEndpointsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "managedPrivateEndpointTest", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -92,7 +82,7 @@ func ExampleManagedPrivateEndpointsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json func ExampleManagedPrivateEndpointsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,18 +93,13 @@ func ExampleManagedPrivateEndpointsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "managedPrivateEndpointTest", - armkusto.ManagedPrivateEndpoint{ - Properties: &armkusto.ManagedPrivateEndpointProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - RequestMessage: to.Ptr("Please Approve."), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", armkusto.ManagedPrivateEndpoint{ + Properties: &armkusto.ManagedPrivateEndpointProperties{ + GroupID: to.Ptr("blob"), + PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), + RequestMessage: to.Ptr("Please Approve."), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -126,7 +111,7 @@ func ExampleManagedPrivateEndpointsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsUpdate.json func ExampleManagedPrivateEndpointsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,18 +122,13 @@ func ExampleManagedPrivateEndpointsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "kustorptest", - "kustoCluster", - "managedPrivateEndpointTest", - armkusto.ManagedPrivateEndpoint{ - Properties: &armkusto.ManagedPrivateEndpointProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - RequestMessage: to.Ptr("Please Approve Managed Private Endpoint Request."), - }, + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", armkusto.ManagedPrivateEndpoint{ + Properties: &armkusto.ManagedPrivateEndpointProperties{ + GroupID: to.Ptr("blob"), + PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), + RequestMessage: to.Ptr("Please Approve Managed Private Endpoint Request."), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -160,7 +140,7 @@ func ExampleManagedPrivateEndpointsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoManagedPrivateEndpointsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoManagedPrivateEndpointsDelete.json func ExampleManagedPrivateEndpointsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,11 +151,7 @@ func ExampleManagedPrivateEndpointsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "managedPrivateEndpointTest", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_models.go b/sdk/resourcemanager/kusto/armkusto/models.go similarity index 95% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_models.go rename to sdk/resourcemanager/kusto/armkusto/models.go index 5e61674f33f8..7e74ffe8c0ef 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_models.go +++ b/sdk/resourcemanager/kusto/armkusto/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -52,6 +53,13 @@ type AttachedDatabaseConfigurationProperties struct { // REQUIRED; The default principals modification kind DefaultPrincipalsModificationKind *DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,omitempty"` + // Overrides the original database name. Relevant only when attaching to a specific database. + DatabaseNameOverride *string `json:"databaseNameOverride,omitempty"` + + // Adds a prefix to the attached databases name. When following an entire cluster, that prefix would be added to all of the + // databases original names from leader cluster. + DatabaseNamePrefix *string `json:"databaseNamePrefix,omitempty"` + // Table level sharing specifications TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty"` @@ -68,7 +76,8 @@ type AttachedDatabaseConfigurationsCheckNameRequest struct { // REQUIRED; Attached database resource name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. + // CONSTANT; The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. + // Field has constant value "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -167,27 +176,6 @@ type CheckNameResult struct { Reason *Reason `json:"reason,omitempty"` } -// CloudError - An error response from Kusto. -type CloudError struct { - // An error response from Kusto. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from Kusto. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for displaying in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} - // Cluster - Class representing a Kusto cluster. type Cluster struct { // REQUIRED; The geo-location where the resource lives @@ -229,7 +217,8 @@ type ClusterCheckNameRequest struct { // REQUIRED; Cluster name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.Kusto/clusters. + // CONSTANT; The type of resource, Microsoft.Kusto/clusters. + // Field has constant value "Microsoft.Kusto/clusters", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -259,7 +248,8 @@ type ClusterPrincipalAssignmentCheckNameRequest struct { // REQUIRED; Principal Assignment resource name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.Kusto/clusters/principalAssignments. + // CONSTANT; The type of resource, Microsoft.Kusto/clusters/principalAssignments. + // Field has constant value "Microsoft.Kusto/clusters/principalAssignments", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -592,7 +582,8 @@ type DataConnectionCheckNameRequest struct { // REQUIRED; Data Connection name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. + // CONSTANT; The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. + // Field has constant value "Microsoft.Kusto/clusters/databases/dataConnections", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -746,7 +737,8 @@ type DatabasePrincipalAssignmentCheckNameRequest struct { // REQUIRED; Principal Assignment resource name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. + // CONSTANT; The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. + // Field has constant value "Microsoft.Kusto/clusters/databases/principalAssignments", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -842,6 +834,9 @@ type DatabasesClientAddPrincipalsOptions struct { // DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate // method. type DatabasesClientBeginCreateOrUpdateOptions struct { + // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude + // the caller from Admins list. + CallerRole *CallerRole // Resumes the LRO from the provided token. ResumeToken string } @@ -854,6 +849,9 @@ type DatabasesClientBeginDeleteOptions struct { // DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. type DatabasesClientBeginUpdateOptions struct { + // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude + // the caller from Admins list. + CallerRole *CallerRole // Resumes the LRO from the provided token. ResumeToken string } @@ -930,8 +928,7 @@ type EventGridConnectionProperties struct { // A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file IgnoreFirstRecord *bool `json:"ignoreFirstRecord,omitempty"` - // Empty for non-managed identity based data connection. For system assigned identity, provide cluster resource Id. For user - // assigned identity (UAI) provide the UAI resource Id. + // The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub and storage account. ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` // The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. @@ -999,13 +996,16 @@ type EventHubConnectionProperties struct { // System properties of the event hub EventSystemProperties []*string `json:"eventSystemProperties,omitempty"` - // Empty for non-managed identity based data connection. For system assigned identity, provide cluster resource Id. For user - // assigned identity (UAI) provide the UAI resource Id. + // The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub. ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` // The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. MappingRuleName *string `json:"mappingRuleName,omitempty"` + // When defined, the data connection retrieves existing Event hub events created since the Retrieval start date. It can only + // retrieve events retained by the Event hub, based on its retention period. + RetrievalStartDate *time.Time `json:"retrievalStartDate,omitempty"` + // The table where the data should be ingested. Optionally the table information can be added to each message. TableName *string `json:"tableName,omitempty"` @@ -1058,6 +1058,12 @@ type FollowerDatabaseDefinition struct { // READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + + // READ-ONLY; The origin of the following setup. + DatabaseShareOrigin *DatabaseShareOrigin `json:"databaseShareOrigin,omitempty" azure:"ro"` + + // READ-ONLY; Table level sharing specifications + TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty" azure:"ro"` } // FollowerDatabaseListResult - The list Kusto database principals operation response. @@ -1108,6 +1114,10 @@ type IotHubConnectionProperties struct { // The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. MappingRuleName *string `json:"mappingRuleName,omitempty"` + // When defined, the data connection retrieves existing Event hub events created since the Retrieval start date. It can only + // retrieve events retained by the Event hub, based on its retention period. + RetrievalStartDate *time.Time `json:"retrievalStartDate,omitempty"` + // The table where the data should be ingested. Optionally the table information can be added to each message. TableName *string `json:"tableName,omitempty"` @@ -1227,7 +1237,8 @@ type ManagedPrivateEndpointsCheckNameRequest struct { // REQUIRED; Managed private endpoint resource name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. + // CONSTANT; The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. + // Field has constant value "Microsoft.Kusto/clusters/managedPrivateEndpoints", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -1558,19 +1569,6 @@ type PrivateLinkServiceConnectionStateProperty struct { ActionsRequired *string `json:"actionsRequired,omitempty" azure:"ro"` } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // ReadOnlyFollowingDatabase - Class representing a read only following database. type ReadOnlyFollowingDatabase struct { // REQUIRED; Kind of the database @@ -1611,9 +1609,15 @@ type ReadOnlyFollowingDatabaseProperties struct { // READ-ONLY; The name of the attached database configuration cluster AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty" azure:"ro"` + // READ-ONLY; The origin of the following setup. + DatabaseShareOrigin *DatabaseShareOrigin `json:"databaseShareOrigin,omitempty" azure:"ro"` + // READ-ONLY; The name of the leader cluster LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty" azure:"ro"` + // READ-ONLY; The original database name, before databaseNameOverride or databaseNamePrefix where applied. + OriginalDatabaseName *string `json:"originalDatabaseName,omitempty" azure:"ro"` + // READ-ONLY; The principals modification kind of the database PrincipalsModificationKind *PrincipalsModificationKind `json:"principalsModificationKind,omitempty" azure:"ro"` @@ -1625,6 +1629,9 @@ type ReadOnlyFollowingDatabaseProperties struct { // READ-ONLY; The statistics of the database. Statistics *DatabaseStatistics `json:"statistics,omitempty" azure:"ro"` + + // READ-ONLY; Table level sharing specifications + TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty" azure:"ro"` } // ReadWriteDatabase - Class representing a read write database. @@ -1677,18 +1684,6 @@ type ReadWriteDatabaseProperties struct { Statistics *DatabaseStatistics `json:"statistics,omitempty" azure:"ro"` } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // SKUDescription - The Kusto SKU description of given resource type type SKUDescription struct { // READ-ONLY; Locations and zones @@ -1748,7 +1743,8 @@ type ScriptCheckNameRequest struct { // REQUIRED; Script name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, Microsoft.Kusto/clusters/databases/scripts. + // CONSTANT; The type of resource, Microsoft.Kusto/clusters/databases/scripts. + // Field has constant value "Microsoft.Kusto/clusters/databases/scripts", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -1856,25 +1852,6 @@ type TableLevelSharingProperties struct { TablesToInclude []*string `json:"tablesToInclude,omitempty"` } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // TrustedExternalTenant - Represents a tenant ID that is trusted by the cluster. type TrustedExternalTenant struct { // GUID representing an external tenant. diff --git a/sdk/resourcemanager/kusto/armkusto/models_serde.go b/sdk/resourcemanager/kusto/armkusto/models_serde.go new file mode 100644 index 000000000000..cf67173e736a --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/models_serde.go @@ -0,0 +1,3492 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armkusto + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AcceptedAudiences. +func (a AcceptedAudiences) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AcceptedAudiences. +func (a *AcceptedAudiences) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfiguration. +func (a AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AttachedDatabaseConfiguration. +func (a *AttachedDatabaseConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfigurationListResult. +func (a AttachedDatabaseConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AttachedDatabaseConfigurationListResult. +func (a *AttachedDatabaseConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfigurationProperties. +func (a AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attachedDatabaseNames", a.AttachedDatabaseNames) + populate(objectMap, "clusterResourceId", a.ClusterResourceID) + populate(objectMap, "databaseName", a.DatabaseName) + populate(objectMap, "databaseNameOverride", a.DatabaseNameOverride) + populate(objectMap, "databaseNamePrefix", a.DatabaseNamePrefix) + populate(objectMap, "defaultPrincipalsModificationKind", a.DefaultPrincipalsModificationKind) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "tableLevelSharingProperties", a.TableLevelSharingProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AttachedDatabaseConfigurationProperties. +func (a *AttachedDatabaseConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attachedDatabaseNames": + err = unpopulate(val, "AttachedDatabaseNames", &a.AttachedDatabaseNames) + delete(rawMsg, key) + case "clusterResourceId": + err = unpopulate(val, "ClusterResourceID", &a.ClusterResourceID) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &a.DatabaseName) + delete(rawMsg, key) + case "databaseNameOverride": + err = unpopulate(val, "DatabaseNameOverride", &a.DatabaseNameOverride) + delete(rawMsg, key) + case "databaseNamePrefix": + err = unpopulate(val, "DatabaseNamePrefix", &a.DatabaseNamePrefix) + delete(rawMsg, key) + case "defaultPrincipalsModificationKind": + err = unpopulate(val, "DefaultPrincipalsModificationKind", &a.DefaultPrincipalsModificationKind) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "tableLevelSharingProperties": + err = unpopulate(val, "TableLevelSharingProperties", &a.TableLevelSharingProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfigurationsCheckNameRequest. +func (a AttachedDatabaseConfigurationsCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", a.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AttachedDatabaseConfigurationsCheckNameRequest. +func (a *AttachedDatabaseConfigurationsCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureCapacity. +func (a AzureCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "default", a.Default) + populate(objectMap, "maximum", a.Maximum) + populate(objectMap, "minimum", a.Minimum) + populate(objectMap, "scaleType", a.ScaleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCapacity. +func (a *AzureCapacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &a.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &a.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &a.Minimum) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &a.ScaleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResourceSKU. +func (a AzureResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", a.Capacity) + populate(objectMap, "resourceType", a.ResourceType) + populate(objectMap, "sku", a.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceSKU. +func (a *AzureResourceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &a.Capacity) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &a.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureSKU. +func (a AzureSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", a.Capacity) + populate(objectMap, "name", a.Name) + populate(objectMap, "tier", a.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSKU. +func (a *AzureSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &a.Capacity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameRequest. +func (c CheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameRequest. +func (c *CheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameResult. +func (c CheckNameResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "name", c.Name) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameResult. +func (c *CheckNameResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterCheckNameRequest. +func (c ClusterCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + objectMap["type"] = "Microsoft.Kusto/clusters" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterCheckNameRequest. +func (c *ClusterCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterListResult. +func (c ClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterListResult. +func (c *ClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPrincipalAssignment. +func (c ClusterPrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPrincipalAssignment. +func (c *ClusterPrincipalAssignment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPrincipalAssignmentCheckNameRequest. +func (c ClusterPrincipalAssignmentCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/principalAssignments" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPrincipalAssignmentCheckNameRequest. +func (c *ClusterPrincipalAssignmentCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPrincipalAssignmentListResult. +func (c ClusterPrincipalAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPrincipalAssignmentListResult. +func (c *ClusterPrincipalAssignmentListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPrincipalProperties. +func (c ClusterPrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadObjectId", c.AADObjectID) + populate(objectMap, "principalId", c.PrincipalID) + populate(objectMap, "principalName", c.PrincipalName) + populate(objectMap, "principalType", c.PrincipalType) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "role", c.Role) + populate(objectMap, "tenantId", c.TenantID) + populate(objectMap, "tenantName", c.TenantName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPrincipalProperties. +func (c *ClusterPrincipalProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadObjectId": + err = unpopulate(val, "AADObjectID", &c.AADObjectID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) + delete(rawMsg, key) + case "principalName": + err = unpopulate(val, "PrincipalName", &c.PrincipalName) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &c.PrincipalType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &c.Role) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + delete(rawMsg, key) + case "tenantName": + err = unpopulate(val, "TenantName", &c.TenantName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acceptedAudiences", c.AcceptedAudiences) + populate(objectMap, "allowedFqdnList", c.AllowedFqdnList) + populate(objectMap, "allowedIpRangeList", c.AllowedIPRangeList) + populate(objectMap, "dataIngestionUri", c.DataIngestionURI) + populate(objectMap, "enableAutoStop", c.EnableAutoStop) + populate(objectMap, "enableDiskEncryption", c.EnableDiskEncryption) + populate(objectMap, "enableDoubleEncryption", c.EnableDoubleEncryption) + populate(objectMap, "enablePurge", c.EnablePurge) + populate(objectMap, "enableStreamingIngest", c.EnableStreamingIngest) + populate(objectMap, "engineType", c.EngineType) + populate(objectMap, "keyVaultProperties", c.KeyVaultProperties) + populate(objectMap, "languageExtensions", c.LanguageExtensions) + populate(objectMap, "optimizedAutoscale", c.OptimizedAutoscale) + populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "publicIPType", c.PublicIPType) + populate(objectMap, "publicNetworkAccess", c.PublicNetworkAccess) + populate(objectMap, "restrictOutboundNetworkAccess", c.RestrictOutboundNetworkAccess) + populate(objectMap, "state", c.State) + populate(objectMap, "stateReason", c.StateReason) + populate(objectMap, "trustedExternalTenants", c.TrustedExternalTenants) + populate(objectMap, "uri", c.URI) + populate(objectMap, "virtualClusterGraduationProperties", c.VirtualClusterGraduationProperties) + populate(objectMap, "virtualNetworkConfiguration", c.VirtualNetworkConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "acceptedAudiences": + err = unpopulate(val, "AcceptedAudiences", &c.AcceptedAudiences) + delete(rawMsg, key) + case "allowedFqdnList": + err = unpopulate(val, "AllowedFqdnList", &c.AllowedFqdnList) + delete(rawMsg, key) + case "allowedIpRangeList": + err = unpopulate(val, "AllowedIPRangeList", &c.AllowedIPRangeList) + delete(rawMsg, key) + case "dataIngestionUri": + err = unpopulate(val, "DataIngestionURI", &c.DataIngestionURI) + delete(rawMsg, key) + case "enableAutoStop": + err = unpopulate(val, "EnableAutoStop", &c.EnableAutoStop) + delete(rawMsg, key) + case "enableDiskEncryption": + err = unpopulate(val, "EnableDiskEncryption", &c.EnableDiskEncryption) + delete(rawMsg, key) + case "enableDoubleEncryption": + err = unpopulate(val, "EnableDoubleEncryption", &c.EnableDoubleEncryption) + delete(rawMsg, key) + case "enablePurge": + err = unpopulate(val, "EnablePurge", &c.EnablePurge) + delete(rawMsg, key) + case "enableStreamingIngest": + err = unpopulate(val, "EnableStreamingIngest", &c.EnableStreamingIngest) + delete(rawMsg, key) + case "engineType": + err = unpopulate(val, "EngineType", &c.EngineType) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &c.KeyVaultProperties) + delete(rawMsg, key) + case "languageExtensions": + err = unpopulate(val, "LanguageExtensions", &c.LanguageExtensions) + delete(rawMsg, key) + case "optimizedAutoscale": + err = unpopulate(val, "OptimizedAutoscale", &c.OptimizedAutoscale) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &c.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "publicIPType": + err = unpopulate(val, "PublicIPType", &c.PublicIPType) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &c.PublicNetworkAccess) + delete(rawMsg, key) + case "restrictOutboundNetworkAccess": + err = unpopulate(val, "RestrictOutboundNetworkAccess", &c.RestrictOutboundNetworkAccess) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "stateReason": + err = unpopulate(val, "StateReason", &c.StateReason) + delete(rawMsg, key) + case "trustedExternalTenants": + err = unpopulate(val, "TrustedExternalTenants", &c.TrustedExternalTenants) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &c.URI) + delete(rawMsg, key) + case "virtualClusterGraduationProperties": + err = unpopulate(val, "VirtualClusterGraduationProperties", &c.VirtualClusterGraduationProperties) + delete(rawMsg, key) + case "virtualNetworkConfiguration": + err = unpopulate(val, "VirtualNetworkConfiguration", &c.VirtualNetworkConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterUpdate. +func (c ClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterUpdate. +func (c *ClusterUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "principalId", c.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c *ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnection. +func (d DataConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + objectMap["kind"] = d.Kind + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnection. +func (d *DataConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionCheckNameRequest. +func (d DataConnectionCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/databases/dataConnections" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionCheckNameRequest. +func (d *DataConnectionCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionListResult. +func (d DataConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionListResult. +func (d *DataConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + d.Value, err = unmarshalDataConnectionClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionValidation. +func (d DataConnectionValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataConnectionName", d.DataConnectionName) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionValidation. +func (d *DataConnectionValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataConnectionName": + err = unpopulate(val, "DataConnectionName", &d.DataConnectionName) + delete(rawMsg, key) + case "properties": + d.Properties, err = unmarshalDataConnectionClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionValidationListResult. +func (d DataConnectionValidationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionValidationListResult. +func (d *DataConnectionValidationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionValidationResult. +func (d DataConnectionValidationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessage", d.ErrorMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionValidationResult. +func (d *DataConnectionValidationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &d.ErrorMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Database. +func (d Database) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + objectMap["kind"] = d.Kind + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Database. +func (d *Database) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseListResult. +func (d DatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseListResult. +func (d *DatabaseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + d.Value, err = unmarshalDatabaseClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipal. +func (d DatabasePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appId", d.AppID) + populate(objectMap, "email", d.Email) + populate(objectMap, "fqn", d.Fqn) + populate(objectMap, "name", d.Name) + populate(objectMap, "role", d.Role) + populate(objectMap, "tenantName", d.TenantName) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipal. +func (d *DatabasePrincipal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &d.AppID) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &d.Email) + delete(rawMsg, key) + case "fqn": + err = unpopulate(val, "Fqn", &d.Fqn) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &d.Role) + delete(rawMsg, key) + case "tenantName": + err = unpopulate(val, "TenantName", &d.TenantName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalAssignment. +func (d DatabasePrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalAssignment. +func (d *DatabasePrincipalAssignment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalAssignmentCheckNameRequest. +func (d DatabasePrincipalAssignmentCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/databases/principalAssignments" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalAssignmentCheckNameRequest. +func (d *DatabasePrincipalAssignmentCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalAssignmentListResult. +func (d DatabasePrincipalAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalAssignmentListResult. +func (d *DatabasePrincipalAssignmentListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalListRequest. +func (d DatabasePrincipalListRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalListRequest. +func (d *DatabasePrincipalListRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalListResult. +func (d DatabasePrincipalListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalListResult. +func (d *DatabasePrincipalListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalProperties. +func (d DatabasePrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadObjectId", d.AADObjectID) + populate(objectMap, "principalId", d.PrincipalID) + populate(objectMap, "principalName", d.PrincipalName) + populate(objectMap, "principalType", d.PrincipalType) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "role", d.Role) + populate(objectMap, "tenantId", d.TenantID) + populate(objectMap, "tenantName", d.TenantName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasePrincipalProperties. +func (d *DatabasePrincipalProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadObjectId": + err = unpopulate(val, "AADObjectID", &d.AADObjectID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + case "principalName": + err = unpopulate(val, "PrincipalName", &d.PrincipalName) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &d.PrincipalType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &d.Role) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) + delete(rawMsg, key) + case "tenantName": + err = unpopulate(val, "TenantName", &d.TenantName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseStatistics. +func (d DatabaseStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "size", d.Size) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseStatistics. +func (d *DatabaseStatistics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "size": + err = unpopulate(val, "Size", &d.Size) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnoseVirtualNetworkResult. +func (d DiagnoseVirtualNetworkResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "findings", d.Findings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnoseVirtualNetworkResult. +func (d *DiagnoseVirtualNetworkResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "findings": + err = unpopulate(val, "Findings", &d.Findings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", e.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventGridConnectionProperties. +func (e EventGridConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobStorageEventType", e.BlobStorageEventType) + populate(objectMap, "consumerGroup", e.ConsumerGroup) + populate(objectMap, "dataFormat", e.DataFormat) + populate(objectMap, "databaseRouting", e.DatabaseRouting) + populate(objectMap, "eventGridResourceId", e.EventGridResourceID) + populate(objectMap, "eventHubResourceId", e.EventHubResourceID) + populate(objectMap, "ignoreFirstRecord", e.IgnoreFirstRecord) + populate(objectMap, "managedIdentityObjectId", e.ManagedIdentityObjectID) + populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) + populate(objectMap, "mappingRuleName", e.MappingRuleName) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "storageAccountResourceId", e.StorageAccountResourceID) + populate(objectMap, "tableName", e.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridConnectionProperties. +func (e *EventGridConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobStorageEventType": + err = unpopulate(val, "BlobStorageEventType", &e.BlobStorageEventType) + delete(rawMsg, key) + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &e.DataFormat) + delete(rawMsg, key) + case "databaseRouting": + err = unpopulate(val, "DatabaseRouting", &e.DatabaseRouting) + delete(rawMsg, key) + case "eventGridResourceId": + err = unpopulate(val, "EventGridResourceID", &e.EventGridResourceID) + delete(rawMsg, key) + case "eventHubResourceId": + err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) + delete(rawMsg, key) + case "ignoreFirstRecord": + err = unpopulate(val, "IgnoreFirstRecord", &e.IgnoreFirstRecord) + delete(rawMsg, key) + case "managedIdentityObjectId": + err = unpopulate(val, "ManagedIdentityObjectID", &e.ManagedIdentityObjectID) + delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &e.ManagedIdentityResourceID) + delete(rawMsg, key) + case "mappingRuleName": + err = unpopulate(val, "MappingRuleName", &e.MappingRuleName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "storageAccountResourceId": + err = unpopulate(val, "StorageAccountResourceID", &e.StorageAccountResourceID) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &e.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventGridDataConnection. +func (e EventGridDataConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + objectMap["kind"] = DataConnectionKindEventGrid + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridDataConnection. +func (e *EventGridDataConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConnectionProperties. +func (e EventHubConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "compression", e.Compression) + populate(objectMap, "consumerGroup", e.ConsumerGroup) + populate(objectMap, "dataFormat", e.DataFormat) + populate(objectMap, "databaseRouting", e.DatabaseRouting) + populate(objectMap, "eventHubResourceId", e.EventHubResourceID) + populate(objectMap, "eventSystemProperties", e.EventSystemProperties) + populate(objectMap, "managedIdentityObjectId", e.ManagedIdentityObjectID) + populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) + populate(objectMap, "mappingRuleName", e.MappingRuleName) + populate(objectMap, "provisioningState", e.ProvisioningState) + populateTimeRFC3339(objectMap, "retrievalStartDate", e.RetrievalStartDate) + populate(objectMap, "tableName", e.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConnectionProperties. +func (e *EventHubConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "compression": + err = unpopulate(val, "Compression", &e.Compression) + delete(rawMsg, key) + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &e.DataFormat) + delete(rawMsg, key) + case "databaseRouting": + err = unpopulate(val, "DatabaseRouting", &e.DatabaseRouting) + delete(rawMsg, key) + case "eventHubResourceId": + err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) + delete(rawMsg, key) + case "eventSystemProperties": + err = unpopulate(val, "EventSystemProperties", &e.EventSystemProperties) + delete(rawMsg, key) + case "managedIdentityObjectId": + err = unpopulate(val, "ManagedIdentityObjectID", &e.ManagedIdentityObjectID) + delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &e.ManagedIdentityResourceID) + delete(rawMsg, key) + case "mappingRuleName": + err = unpopulate(val, "MappingRuleName", &e.MappingRuleName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "retrievalStartDate": + err = unpopulateTimeRFC3339(val, "RetrievalStartDate", &e.RetrievalStartDate) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &e.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubDataConnection. +func (e EventHubDataConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + objectMap["kind"] = DataConnectionKindEventHub + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDataConnection. +func (e *EventHubDataConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FollowerDatabaseDefinition. +func (f FollowerDatabaseDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attachedDatabaseConfigurationName", f.AttachedDatabaseConfigurationName) + populate(objectMap, "clusterResourceId", f.ClusterResourceID) + populate(objectMap, "databaseName", f.DatabaseName) + populate(objectMap, "databaseShareOrigin", f.DatabaseShareOrigin) + populate(objectMap, "tableLevelSharingProperties", f.TableLevelSharingProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FollowerDatabaseDefinition. +func (f *FollowerDatabaseDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attachedDatabaseConfigurationName": + err = unpopulate(val, "AttachedDatabaseConfigurationName", &f.AttachedDatabaseConfigurationName) + delete(rawMsg, key) + case "clusterResourceId": + err = unpopulate(val, "ClusterResourceID", &f.ClusterResourceID) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &f.DatabaseName) + delete(rawMsg, key) + case "databaseShareOrigin": + err = unpopulate(val, "DatabaseShareOrigin", &f.DatabaseShareOrigin) + delete(rawMsg, key) + case "tableLevelSharingProperties": + err = unpopulate(val, "TableLevelSharingProperties", &f.TableLevelSharingProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FollowerDatabaseListResult. +func (f FollowerDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FollowerDatabaseListResult. +func (f *FollowerDatabaseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IotHubConnectionProperties. +func (i IotHubConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consumerGroup", i.ConsumerGroup) + populate(objectMap, "dataFormat", i.DataFormat) + populate(objectMap, "databaseRouting", i.DatabaseRouting) + populate(objectMap, "eventSystemProperties", i.EventSystemProperties) + populate(objectMap, "iotHubResourceId", i.IotHubResourceID) + populate(objectMap, "mappingRuleName", i.MappingRuleName) + populate(objectMap, "provisioningState", i.ProvisioningState) + populateTimeRFC3339(objectMap, "retrievalStartDate", i.RetrievalStartDate) + populate(objectMap, "sharedAccessPolicyName", i.SharedAccessPolicyName) + populate(objectMap, "tableName", i.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IotHubConnectionProperties. +func (i *IotHubConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &i.ConsumerGroup) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &i.DataFormat) + delete(rawMsg, key) + case "databaseRouting": + err = unpopulate(val, "DatabaseRouting", &i.DatabaseRouting) + delete(rawMsg, key) + case "eventSystemProperties": + err = unpopulate(val, "EventSystemProperties", &i.EventSystemProperties) + delete(rawMsg, key) + case "iotHubResourceId": + err = unpopulate(val, "IotHubResourceID", &i.IotHubResourceID) + delete(rawMsg, key) + case "mappingRuleName": + err = unpopulate(val, "MappingRuleName", &i.MappingRuleName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "retrievalStartDate": + err = unpopulateTimeRFC3339(val, "RetrievalStartDate", &i.RetrievalStartDate) + delete(rawMsg, key) + case "sharedAccessPolicyName": + err = unpopulate(val, "SharedAccessPolicyName", &i.SharedAccessPolicyName) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &i.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IotHubDataConnection. +func (i IotHubDataConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + objectMap["kind"] = DataConnectionKindIotHub + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IotHubDataConnection. +func (i *IotHubDataConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "keyVersion", k.KeyVersion) + populate(objectMap, "userIdentity", k.UserIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) + delete(rawMsg, key) + case "userIdentity": + err = unpopulate(val, "UserIdentity", &k.UserIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LanguageExtension. +func (l LanguageExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "languageExtensionName", l.LanguageExtensionName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LanguageExtension. +func (l *LanguageExtension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "languageExtensionName": + err = unpopulate(val, "LanguageExtensionName", &l.LanguageExtensionName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LanguageExtensionsList. +func (l LanguageExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LanguageExtensionsList. +func (l *LanguageExtensionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListResourceSKUsResult. +func (l ListResourceSKUsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResourceSKUsResult. +func (l *ListResourceSKUsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpoint. +func (m ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedPrivateEndpoint. +func (m *ManagedPrivateEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpointListResult. +func (m ManagedPrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedPrivateEndpointListResult. +func (m *ManagedPrivateEndpointListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpointProperties. +func (m ManagedPrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", m.GroupID) + populate(objectMap, "privateLinkResourceId", m.PrivateLinkResourceID) + populate(objectMap, "privateLinkResourceRegion", m.PrivateLinkResourceRegion) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "requestMessage", m.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedPrivateEndpointProperties. +func (m *ManagedPrivateEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &m.GroupID) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &m.PrivateLinkResourceID) + delete(rawMsg, key) + case "privateLinkResourceRegion": + err = unpopulate(val, "PrivateLinkResourceRegion", &m.PrivateLinkResourceRegion) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &m.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpointsCheckNameRequest. +func (m ManagedPrivateEndpointsCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", m.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/managedPrivateEndpoints" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedPrivateEndpointsCheckNameRequest. +func (m *ManagedPrivateEndpointsCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", &o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResult. +func (o OperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "properties", o.Properties) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. +func (o *OperationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResultErrorProperties. +func (o OperationResultErrorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultErrorProperties. +func (o *OperationResultErrorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResultProperties. +func (o OperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationKind", o.OperationKind) + populate(objectMap, "operationState", o.OperationState) + populate(objectMap, "provisioningState", o.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultProperties. +func (o *OperationResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationKind": + err = unpopulate(val, "OperationKind", &o.OperationKind) + delete(rawMsg, key) + case "operationState": + err = unpopulate(val, "OperationState", &o.OperationState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OptimizedAutoscale. +func (o OptimizedAutoscale) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isEnabled", o.IsEnabled) + populate(objectMap, "maximum", o.Maximum) + populate(objectMap, "minimum", o.Minimum) + populate(objectMap, "version", o.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OptimizedAutoscale. +func (o *OptimizedAutoscale) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isEnabled": + err = unpopulate(val, "IsEnabled", &o.IsEnabled) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &o.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &o.Minimum) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &o.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundNetworkDependenciesEndpoint. +func (o OutboundNetworkDependenciesEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundNetworkDependenciesEndpoint. +func (o *OutboundNetworkDependenciesEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundNetworkDependenciesEndpointListResult. +func (o OutboundNetworkDependenciesEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundNetworkDependenciesEndpointListResult. +func (o *OutboundNetworkDependenciesEndpointListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundNetworkDependenciesEndpointProperties. +func (o OutboundNetworkDependenciesEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) + populate(objectMap, "provisioningState", o.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundNetworkDependenciesEndpointProperties. +func (o *OutboundNetworkDependenciesEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. +func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. +func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReadOnlyFollowingDatabase. +func (r ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + objectMap["kind"] = KindReadOnlyFollowing + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReadOnlyFollowingDatabase. +func (r *ReadOnlyFollowingDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReadOnlyFollowingDatabaseProperties. +func (r ReadOnlyFollowingDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "attachedDatabaseConfigurationName", r.AttachedDatabaseConfigurationName) + populate(objectMap, "databaseShareOrigin", r.DatabaseShareOrigin) + populate(objectMap, "hotCachePeriod", r.HotCachePeriod) + populate(objectMap, "leaderClusterResourceId", r.LeaderClusterResourceID) + populate(objectMap, "originalDatabaseName", r.OriginalDatabaseName) + populate(objectMap, "principalsModificationKind", r.PrincipalsModificationKind) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "softDeletePeriod", r.SoftDeletePeriod) + populate(objectMap, "statistics", r.Statistics) + populate(objectMap, "tableLevelSharingProperties", r.TableLevelSharingProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReadOnlyFollowingDatabaseProperties. +func (r *ReadOnlyFollowingDatabaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "attachedDatabaseConfigurationName": + err = unpopulate(val, "AttachedDatabaseConfigurationName", &r.AttachedDatabaseConfigurationName) + delete(rawMsg, key) + case "databaseShareOrigin": + err = unpopulate(val, "DatabaseShareOrigin", &r.DatabaseShareOrigin) + delete(rawMsg, key) + case "hotCachePeriod": + err = unpopulate(val, "HotCachePeriod", &r.HotCachePeriod) + delete(rawMsg, key) + case "leaderClusterResourceId": + err = unpopulate(val, "LeaderClusterResourceID", &r.LeaderClusterResourceID) + delete(rawMsg, key) + case "originalDatabaseName": + err = unpopulate(val, "OriginalDatabaseName", &r.OriginalDatabaseName) + delete(rawMsg, key) + case "principalsModificationKind": + err = unpopulate(val, "PrincipalsModificationKind", &r.PrincipalsModificationKind) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "softDeletePeriod": + err = unpopulate(val, "SoftDeletePeriod", &r.SoftDeletePeriod) + delete(rawMsg, key) + case "statistics": + err = unpopulate(val, "Statistics", &r.Statistics) + delete(rawMsg, key) + case "tableLevelSharingProperties": + err = unpopulate(val, "TableLevelSharingProperties", &r.TableLevelSharingProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReadWriteDatabase. +func (r ReadWriteDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + objectMap["kind"] = KindReadWrite + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReadWriteDatabase. +func (r *ReadWriteDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReadWriteDatabaseProperties. +func (r ReadWriteDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hotCachePeriod", r.HotCachePeriod) + populate(objectMap, "isFollowed", r.IsFollowed) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "softDeletePeriod", r.SoftDeletePeriod) + populate(objectMap, "statistics", r.Statistics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReadWriteDatabaseProperties. +func (r *ReadWriteDatabaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hotCachePeriod": + err = unpopulate(val, "HotCachePeriod", &r.HotCachePeriod) + delete(rawMsg, key) + case "isFollowed": + err = unpopulate(val, "IsFollowed", &r.IsFollowed) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "softDeletePeriod": + err = unpopulate(val, "SoftDeletePeriod", &r.SoftDeletePeriod) + delete(rawMsg, key) + case "statistics": + err = unpopulate(val, "Statistics", &r.Statistics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUDescription. +func (s SKUDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "locationInfo", s.LocationInfo) + populate(objectMap, "locations", s.Locations) + populate(objectMap, "name", s.Name) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "restrictions", s.Restrictions) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDescription. +func (s *SKUDescription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locationInfo": + err = unpopulate(val, "LocationInfo", &s.LocationInfo) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &s.Locations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &s.Restrictions) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUDescriptionList. +func (s SKUDescriptionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDescriptionList. +func (s *SKUDescriptionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKULocationInfoItem. +func (s SKULocationInfoItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", s.Location) + populate(objectMap, "zones", s.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKULocationInfoItem. +func (s *SKULocationInfoItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &s.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Script. +func (s Script) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Script. +func (s *Script) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptCheckNameRequest. +func (s ScriptCheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + objectMap["type"] = "Microsoft.Kusto/clusters/databases/scripts" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptCheckNameRequest. +func (s *ScriptCheckNameRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptListResult. +func (s ScriptListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptListResult. +func (s *ScriptListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptProperties. +func (s ScriptProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "continueOnErrors", s.ContinueOnErrors) + populate(objectMap, "forceUpdateTag", s.ForceUpdateTag) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "scriptContent", s.ScriptContent) + populate(objectMap, "scriptUrl", s.ScriptURL) + populate(objectMap, "scriptUrlSasToken", s.ScriptURLSasToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptProperties. +func (s *ScriptProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "continueOnErrors": + err = unpopulate(val, "ContinueOnErrors", &s.ContinueOnErrors) + delete(rawMsg, key) + case "forceUpdateTag": + err = unpopulate(val, "ForceUpdateTag", &s.ForceUpdateTag) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "scriptContent": + err = unpopulate(val, "ScriptContent", &s.ScriptContent) + delete(rawMsg, key) + case "scriptUrl": + err = unpopulate(val, "ScriptURL", &s.ScriptURL) + delete(rawMsg, key) + case "scriptUrlSasToken": + err = unpopulate(val, "ScriptURLSasToken", &s.ScriptURLSasToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TableLevelSharingProperties. +func (t TableLevelSharingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "externalTablesToExclude", t.ExternalTablesToExclude) + populate(objectMap, "externalTablesToInclude", t.ExternalTablesToInclude) + populate(objectMap, "materializedViewsToExclude", t.MaterializedViewsToExclude) + populate(objectMap, "materializedViewsToInclude", t.MaterializedViewsToInclude) + populate(objectMap, "tablesToExclude", t.TablesToExclude) + populate(objectMap, "tablesToInclude", t.TablesToInclude) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TableLevelSharingProperties. +func (t *TableLevelSharingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "externalTablesToExclude": + err = unpopulate(val, "ExternalTablesToExclude", &t.ExternalTablesToExclude) + delete(rawMsg, key) + case "externalTablesToInclude": + err = unpopulate(val, "ExternalTablesToInclude", &t.ExternalTablesToInclude) + delete(rawMsg, key) + case "materializedViewsToExclude": + err = unpopulate(val, "MaterializedViewsToExclude", &t.MaterializedViewsToExclude) + delete(rawMsg, key) + case "materializedViewsToInclude": + err = unpopulate(val, "MaterializedViewsToInclude", &t.MaterializedViewsToInclude) + delete(rawMsg, key) + case "tablesToExclude": + err = unpopulate(val, "TablesToExclude", &t.TablesToExclude) + delete(rawMsg, key) + case "tablesToInclude": + err = unpopulate(val, "TablesToInclude", &t.TablesToInclude) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrustedExternalTenant. +func (t TrustedExternalTenant) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrustedExternalTenant. +func (t *TrustedExternalTenant) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkConfiguration. +func (v VirtualNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataManagementPublicIpId", v.DataManagementPublicIPID) + populate(objectMap, "enginePublicIpId", v.EnginePublicIPID) + populate(objectMap, "subnetId", v.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkConfiguration. +func (v *VirtualNetworkConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataManagementPublicIpId": + err = unpopulate(val, "DataManagementPublicIPID", &v.DataManagementPublicIPID) + delete(rawMsg, key) + case "enginePublicIpId": + err = unpopulate(val, "EnginePublicIPID", &v.EnginePublicIPID) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &v.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_operations_client.go b/sdk/resourcemanager/kusto/armkusto/operations_client.go similarity index 96% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_operations_client.go rename to sdk/resourcemanager/kusto/armkusto/operations_client.go index f17e6146d8fb..222dae3dfed2 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_operations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists available operations for the Microsoft.Kusto provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go similarity index 95% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_operations_client_test.go rename to sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go index 223dc8576200..3802aa9a81be 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoOperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoOperationsList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresults_client.go b/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresults_client.go rename to sdk/resourcemanager/kusto/armkusto/operationsresults_client.go index 58d7c34f544f..492bf6f19a0f 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresults_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewOperationsResultsClient(subscriptionID string, credential azcore.TokenCr // Get - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // location - Azure location (region) name. // operationID - The Guid of the operation ID // options - OperationsResultsClientGetOptions contains the optional parameters for the OperationsResultsClient.Get method. @@ -96,7 +97,7 @@ func (client *OperationsResultsClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresults_client_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go similarity index 88% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresults_client_test.go rename to sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go index 090b019a854e..a31dee940278 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresults_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoOperationResultsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoOperationResultsGet.json func ExampleOperationsResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleOperationsResultsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "westus", - "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", - nil) + res, err := client.Get(ctx, "westus", "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresultslocation_client.go b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresultslocation_client.go rename to sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go index 554a0ca8a009..cd609d632f1d 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_operationsresultslocation_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewOperationsResultsLocationClient(subscriptionID string, credential azcore // Get - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // location - Azure location (region) name. // operationID - The Guid of the operation ID // options - OperationsResultsLocationClientGetOptions contains the optional parameters for the OperationsResultsLocationClient.Get @@ -97,7 +98,7 @@ func (client *OperationsResultsLocationClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresultslocation_client_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go similarity index 88% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresultslocation_client_test.go rename to sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go index 60fdbc9c3bc0..64d4ddad84cd 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_operationsresultslocation_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoOperationResultsOperationResultResponseTypeGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoOperationResultsOperationResultResponseTypeGet.json func ExampleOperationsResultsLocationClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleOperationsResultsLocationClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Get(ctx, - "westus", - "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", - nil) + _, err = client.Get(ctx, "westus", "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go similarity index 99% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go index 8f3cce7c73a3..5a3fcf0c6a37 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go index 22d18174477b..10109982cf53 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -77,7 +78,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters, options) if err != nil { @@ -117,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -125,7 +126,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -145,7 +146,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) if err != nil { @@ -185,7 +186,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // privateEndpointConnectionName - The name of the private endpoint connection. @@ -238,7 +239,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +255,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListPager - Returns the list of private endpoint connections. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -302,7 +302,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go similarity index 79% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_privateendpointconnections_client_test.go rename to sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go index 818fb70f4cfa..97bcb8757876 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_privateendpointconnections_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateEndpointConnectionsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateEndpointConnectionsList.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateEndpointConnectionsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateEndpointConnectionsGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "privateEndpointTest", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,19 +71,14 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoclusterrptest4", - "privateEndpointTest", - armkusto.PrivateEndpointConnection{ - Properties: &armkusto.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoclusterrptest4", "privateEndpointTest", armkusto.PrivateEndpointConnection{ + Properties: &armkusto.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ + Description: to.Ptr("Approved by johndoe@contoso.com"), + Status: to.Ptr("Approved"), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +90,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateEndpointConnectionsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateEndpointConnectionsDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,11 +101,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "privateEndpointTest", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go index 5df3cb88a2e0..ba57c8b90a98 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets a private link resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // privateLinkResourceName - The name of the private link resource. @@ -102,7 +103,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,8 +119,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) } // NewListPager - Returns the list of private link resources. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -166,7 +166,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go similarity index 87% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_privatelinkresources_client_test.go rename to sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go index 980bcd286258..06de1ee9c92e 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_privatelinkresources_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateLinkResourcesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateLinkResourcesList.json func ExamplePrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,9 +27,7 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("kustorptest", - "kustoCluster", - nil) + pager := client.NewListPager("kustorptest", "kustoCluster", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,7 +40,7 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoPrivateLinkResourcesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoPrivateLinkResourcesGet.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,11 +51,7 @@ func ExamplePrivateLinkResourcesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "cluster", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "cluster", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_response_types.go b/sdk/resourcemanager/kusto/armkusto/response_types.go similarity index 99% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_response_types.go rename to sdk/resourcemanager/kusto/armkusto/response_types.go index 35e84b8aa6ab..94941215874a 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_response_types.go +++ b/sdk/resourcemanager/kusto/armkusto/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_scripts_client.go b/sdk/resourcemanager/kusto/armkusto/scripts_client.go similarity index 97% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_scripts_client.go rename to sdk/resourcemanager/kusto/armkusto/scripts_client.go index 573b2b6797ce..f303d5e50b86 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_scripts_client.go +++ b/sdk/resourcemanager/kusto/armkusto/scripts_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto @@ -57,7 +58,7 @@ func NewScriptsClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks that the script name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -103,7 +104,7 @@ func (client *ScriptsClient) checkNameAvailabilityCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, scriptName) @@ -120,7 +121,7 @@ func (client *ScriptsClient) checkNameAvailabilityHandleResponse(resp *http.Resp // BeginCreateOrUpdate - Creates a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -142,7 +143,7 @@ func (client *ScriptsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Creates a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ScriptsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters, options) if err != nil { @@ -186,7 +187,7 @@ func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -194,7 +195,7 @@ func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -214,7 +215,7 @@ func (client *ScriptsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ScriptsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, options) if err != nil { @@ -258,7 +259,7 @@ func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +267,7 @@ func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets a Kusto cluster database script. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -315,7 +316,7 @@ func (client *ScriptsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,8 +332,7 @@ func (client *ScriptsClient) getHandleResponse(resp *http.Response) (ScriptsClie } // NewListByDatabasePager - Returns the list of database scripts for given database. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -383,7 +383,7 @@ func (client *ScriptsClient) listByDatabaseCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -400,7 +400,7 @@ func (client *ScriptsClient) listByDatabaseHandleResponse(resp *http.Response) ( // BeginUpdate - Updates a database script. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 // resourceGroupName - The name of the resource group containing the Kusto cluster. // clusterName - The name of the Kusto cluster. // databaseName - The name of the database in the Kusto cluster. @@ -421,7 +421,7 @@ func (client *ScriptsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a database script. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-02-01 +// Generated from API version 2022-07-07 func (client *ScriptsClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters, options) if err != nil { @@ -465,7 +465,7 @@ func (client *ScriptsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-02-01") + reqQP.Set("api-version", "2022-07-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_scripts_client_test.go b/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go similarity index 69% rename from sdk/resourcemanager/kusto/armkusto/ze_generated_example_scripts_client_test.go rename to sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go index 5da36345975b..4139234e0846 100644 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_scripts_client_test.go +++ b/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsListByDatabase.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsListByDatabase.json func ExampleScriptsClient_NewListByDatabasePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleScriptsClient_NewListByDatabasePager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByDatabasePager("kustorptest", - "kustoCluster", - "Kustodatabase8", - nil) + pager := client.NewListByDatabasePager("kustorptest", "kustoCluster", "Kustodatabase8", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,7 +41,7 @@ func ExampleScriptsClient_NewListByDatabasePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsGet.json func ExampleScriptsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,12 +52,7 @@ func ExampleScriptsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "Kustodatabase8", - "kustoScript", - nil) + res, err := client.Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoScript", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +60,7 @@ func ExampleScriptsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsCreateOrUpdate.json func ExampleScriptsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,20 +71,14 @@ func ExampleScriptsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "kustoScript", - armkusto.Script{ - Properties: &armkusto.ScriptProperties{ - ContinueOnErrors: to.Ptr(true), - ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", armkusto.Script{ + Properties: &armkusto.ScriptProperties{ + ContinueOnErrors: to.Ptr(true), + ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), + ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), + ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -104,7 +90,7 @@ func ExampleScriptsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsUpdate.json func ExampleScriptsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -115,20 +101,14 @@ func ExampleScriptsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "kustoScript", - armkusto.Script{ - Properties: &armkusto.ScriptProperties{ - ContinueOnErrors: to.Ptr(true), - ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), - }, + poller, err := client.BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", armkusto.Script{ + Properties: &armkusto.ScriptProperties{ + ContinueOnErrors: to.Ptr(true), + ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), + ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), + ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -140,7 +120,7 @@ func ExampleScriptsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsDelete.json func ExampleScriptsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -151,12 +131,7 @@ func ExampleScriptsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "kustoScript", - nil) + poller, err := client.BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -166,7 +141,7 @@ func ExampleScriptsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoScriptsCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-07-07/examples/KustoScriptsCheckNameAvailability.json func ExampleScriptsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -177,15 +152,10 @@ func ExampleScriptsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - "db", - armkusto.ScriptCheckNameRequest{ - Name: to.Ptr("kustoScriptName1"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/scripts"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "db", armkusto.ScriptCheckNameRequest{ + Name: to.Ptr("kustoScriptName1"), + Type: to.Ptr("Microsoft.Kusto/clusters/databases/scripts"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_time_rfc3339.go b/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/kusto/armkusto/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/kusto/armkusto/time_rfc3339.go index a1552d559cc7..7c93879d0f3d 100644 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_dataconnections_client_test.go b/sdk/resourcemanager/kusto/armkusto/ze_generated_example_dataconnections_client_test.go deleted file mode 100644 index 8db12eda9282..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/ze_generated_example_dataconnections_client_test.go +++ /dev/null @@ -1,250 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsListByDatabase.json -func ExampleDataConnectionsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDatabasePager("kustorptest", - "kustoCluster", - "KustoDatabase8", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionEventGridValidationAsync.json -func ExampleDataConnectionsClient_BeginDataConnectionValidation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDataConnectionValidation(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - armkusto.DataConnectionValidation{ - DataConnectionName: to.Ptr("dataConnectionTest"), - Properties: &armkusto.EventGridDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - IgnoreFirstRecord: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - TableName: to.Ptr("TestTable"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsCheckNameAvailability.json -func ExampleDataConnectionsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - armkusto.DataConnectionCheckNameRequest{ - Name: to.Ptr("DataConnections8"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/dataConnections"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsEventGridGet.json -func ExampleDataConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "dataConnectionTest", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "dataConnectionTest", - &armkusto.EventHubDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - Location: to.Ptr("westus"), - Properties: &armkusto.EventHubConnectionProperties{ - ConsumerGroup: to.Ptr("testConsumerGroup1"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsEventGridUpdate.json -func ExampleDataConnectionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "dataConnectionTest", - &armkusto.EventGridDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - Location: to.Ptr("westus"), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - IgnoreFirstRecord: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - TableName: to.Ptr("TestTable"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2022-02-01/examples/KustoDataConnectionsDelete.json -func ExampleDataConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armkusto.NewDataConnectionsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "kustorptest", - "kustoCluster", - "KustoDatabase8", - "dataConnectionTest", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/zz_generated_models_serde.go b/sdk/resourcemanager/kusto/armkusto/zz_generated_models_serde.go deleted file mode 100644 index 1db3a91a4c4f..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/zz_generated_models_serde.go +++ /dev/null @@ -1,652 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armkusto - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfigurationProperties. -func (a AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "attachedDatabaseNames", a.AttachedDatabaseNames) - populate(objectMap, "clusterResourceId", a.ClusterResourceID) - populate(objectMap, "databaseName", a.DatabaseName) - populate(objectMap, "defaultPrincipalsModificationKind", a.DefaultPrincipalsModificationKind) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "tableLevelSharingProperties", a.TableLevelSharingProperties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "sku", c.SKU) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - populate(objectMap, "zones", c.Zones) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. -func (c ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "acceptedAudiences", c.AcceptedAudiences) - populate(objectMap, "allowedFqdnList", c.AllowedFqdnList) - populate(objectMap, "allowedIpRangeList", c.AllowedIPRangeList) - populate(objectMap, "dataIngestionUri", c.DataIngestionURI) - populate(objectMap, "enableAutoStop", c.EnableAutoStop) - populate(objectMap, "enableDiskEncryption", c.EnableDiskEncryption) - populate(objectMap, "enableDoubleEncryption", c.EnableDoubleEncryption) - populate(objectMap, "enablePurge", c.EnablePurge) - populate(objectMap, "enableStreamingIngest", c.EnableStreamingIngest) - populate(objectMap, "engineType", c.EngineType) - populate(objectMap, "keyVaultProperties", c.KeyVaultProperties) - populate(objectMap, "languageExtensions", c.LanguageExtensions) - populate(objectMap, "optimizedAutoscale", c.OptimizedAutoscale) - populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "publicIPType", c.PublicIPType) - populate(objectMap, "publicNetworkAccess", c.PublicNetworkAccess) - populate(objectMap, "restrictOutboundNetworkAccess", c.RestrictOutboundNetworkAccess) - populate(objectMap, "state", c.State) - populate(objectMap, "stateReason", c.StateReason) - populate(objectMap, "trustedExternalTenants", c.TrustedExternalTenants) - populate(objectMap, "uri", c.URI) - populate(objectMap, "virtualClusterGraduationProperties", c.VirtualClusterGraduationProperties) - populate(objectMap, "virtualNetworkConfiguration", c.VirtualNetworkConfiguration) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterUpdate. -func (c ClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "sku", c.SKU) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataConnection. -func (d DataConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - objectMap["kind"] = d.Kind - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionListResult. -func (d *DataConnectionListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - d.Value, err = unmarshalDataConnectionClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataConnectionValidation. -func (d DataConnectionValidation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataConnectionName", d.DataConnectionName) - populate(objectMap, "properties", d.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionValidation. -func (d *DataConnectionValidation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataConnectionName": - err = unpopulate(val, "DataConnectionName", &d.DataConnectionName) - delete(rawMsg, key) - case "properties": - d.Properties, err = unmarshalDataConnectionClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - objectMap["kind"] = d.Kind - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseListResult. -func (d *DatabaseListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - d.Value, err = unmarshalDatabaseClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalListRequest. -func (d DatabasePrincipalListRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. -func (e EndpointDependency) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "domainName", e.DomainName) - populate(objectMap, "endpointDetails", e.EndpointDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EventGridDataConnection. -func (e EventGridDataConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - objectMap["kind"] = DataConnectionKindEventGrid - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridDataConnection. -func (e *EventGridDataConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubConnectionProperties. -func (e EventHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "compression", e.Compression) - populate(objectMap, "consumerGroup", e.ConsumerGroup) - populate(objectMap, "dataFormat", e.DataFormat) - populate(objectMap, "databaseRouting", e.DatabaseRouting) - populate(objectMap, "eventHubResourceId", e.EventHubResourceID) - populate(objectMap, "eventSystemProperties", e.EventSystemProperties) - populate(objectMap, "managedIdentityObjectId", e.ManagedIdentityObjectID) - populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) - populate(objectMap, "mappingRuleName", e.MappingRuleName) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "tableName", e.TableName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDataConnection. -func (e EventHubDataConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - objectMap["kind"] = DataConnectionKindEventHub - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDataConnection. -func (e *EventHubDataConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IotHubConnectionProperties. -func (i IotHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "consumerGroup", i.ConsumerGroup) - populate(objectMap, "dataFormat", i.DataFormat) - populate(objectMap, "databaseRouting", i.DatabaseRouting) - populate(objectMap, "eventSystemProperties", i.EventSystemProperties) - populate(objectMap, "iotHubResourceId", i.IotHubResourceID) - populate(objectMap, "mappingRuleName", i.MappingRuleName) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "sharedAccessPolicyName", i.SharedAccessPolicyName) - populate(objectMap, "tableName", i.TableName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IotHubDataConnection. -func (i IotHubDataConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - objectMap["kind"] = DataConnectionKindIotHub - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IotHubDataConnection. -func (i *IotHubDataConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &i.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LanguageExtensionsList. -func (l LanguageExtensionsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpoint. -func (m ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. -func (o *OperationResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &o.PercentComplete) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OutboundNetworkDependenciesEndpointProperties. -func (o OutboundNetworkDependenciesEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "category", o.Category) - populate(objectMap, "endpoints", o.Endpoints) - populate(objectMap, "provisioningState", o.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ReadOnlyFollowingDatabase. -func (r ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["kind"] = KindReadOnlyFollowing - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReadOnlyFollowingDatabase. -func (r *ReadOnlyFollowingDatabase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &r.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReadWriteDatabase. -func (r ReadWriteDatabase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["kind"] = KindReadWrite - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReadWriteDatabase. -func (r *ReadWriteDatabase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &r.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Script. -func (s Script) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TableLevelSharingProperties. -func (t TableLevelSharingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "externalTablesToExclude", t.ExternalTablesToExclude) - populate(objectMap, "externalTablesToInclude", t.ExternalTablesToInclude) - populate(objectMap, "materializedViewsToExclude", t.MaterializedViewsToExclude) - populate(objectMap, "materializedViewsToInclude", t.MaterializedViewsToInclude) - populate(objectMap, "tablesToExclude", t.TablesToExclude) - populate(objectMap, "tablesToInclude", t.TablesToInclude) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md index 8f7716a72995..d478f074ffeb 100644 --- a/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md +++ b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md @@ -1,5 +1,67 @@ # Release History +## 3.0.0 (2022-09-16) +### Breaking Changes + +- Type of `AccountEncryption.KeySource` has been changed from `*string` to `*KeySource` +- Field `Location` of struct `Vault` has been removed + +### Features Added + +- New const `KeyVaultStatusCreated` +- New const `IdentityTypeNone` +- New const `IdentityTypeUserAssigned` +- New const `IdentityTypeSystemAssigned` +- New const `RegionStorageToNetworkProximityDefault` +- New const `KeyVaultStatusUpdating` +- New const `KeyVaultStatusError` +- New const `RegionStorageToNetworkProximityT1AndT2` +- New const `KeySourceMicrosoftKeyVault` +- New const `SmbNonBrowsableDisabled` +- New const `SmbNonBrowsableEnabled` +- New const `RegionStorageToNetworkProximityT1` +- New const `SmbAccessBasedEnumerationDisabled` +- New const `SmbAccessBasedEnumerationEnabled` +- New const `KeySourceMicrosoftNetApp` +- New const `RegionStorageToNetworkProximityT2` +- New const `KeyVaultStatusDeleted` +- New const `KeyVaultStatusInUse` +- New const `IdentityTypeSystemAssignedUserAssigned` +- New type alias `SmbAccessBasedEnumeration` +- New type alias `SmbNonBrowsable` +- New type alias `KeySource` +- New type alias `KeyVaultStatus` +- New type alias `IdentityType` +- New type alias `RegionStorageToNetworkProximity` +- New function `PossibleIdentityTypeValues() []IdentityType` +- New function `PossibleKeySourceValues() []KeySource` +- New function `*ResourceClient.QueryRegionInfo(context.Context, string, *ResourceClientQueryRegionInfoOptions) (ResourceClientQueryRegionInfoResponse, error)` +- New function `PossibleSmbAccessBasedEnumerationValues() []SmbAccessBasedEnumeration` +- New function `PossibleSmbNonBrowsableValues() []SmbNonBrowsable` +- New function `*AccountsClient.BeginRenewCredentials(context.Context, string, string, *AccountsClientBeginRenewCredentialsOptions) (*runtime.Poller[AccountsClientRenewCredentialsResponse], error)` +- New function `PossibleRegionStorageToNetworkProximityValues() []RegionStorageToNetworkProximity` +- New function `PossibleKeyVaultStatusValues() []KeyVaultStatus` +- New struct `AccountsClientBeginRenewCredentialsOptions` +- New struct `AccountsClientRenewCredentialsResponse` +- New struct `EncryptionIdentity` +- New struct `Identity` +- New struct `KeyVaultProperties` +- New struct `RegionInfo` +- New struct `RegionInfoAvailabilityZoneMappingsItem` +- New struct `RelocateVolumeRequest` +- New struct `ResourceClientQueryRegionInfoOptions` +- New struct `ResourceClientQueryRegionInfoResponse` +- New struct `UserAssignedIdentity` +- New field `Body` in struct `VolumesClientBeginRelocateOptions` +- New field `SmbAccessBasedEnumeration` in struct `VolumeProperties` +- New field `SmbNonBrowsable` in struct `VolumeProperties` +- New field `DeleteBaseSnapshot` in struct `VolumeProperties` +- New field `Identity` in struct `Account` +- New field `Identity` in struct `AccountEncryption` +- New field `KeyVaultProperties` in struct `AccountEncryption` +- New field `DisableShowmount` in struct `AccountProperties` + + ## 2.1.0 (2022-07-21) ### Features Added @@ -92,4 +154,4 @@ The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/arm To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go index f3ea3a994ed7..3078a1366d49 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go @@ -58,7 +58,7 @@ func NewAccountBackupsClient(subscriptionID string, credential azcore.TokenCrede // BeginDelete - Delete the specified Backup for a Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupName - The name of the backup @@ -80,7 +80,7 @@ func (client *AccountBackupsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete the specified Backup for a Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *AccountBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupName, options) if err != nil { @@ -120,14 +120,14 @@ func (client *AccountBackupsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets the specified backup for a Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupName - The name of the backup @@ -171,7 +171,7 @@ func (client *AccountBackupsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,8 +187,7 @@ func (client *AccountBackupsClient) getHandleResponse(resp *http.Response) (Acco } // NewListPager - List all Backups for a Netapp Account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - AccountBackupsClientListOptions contains the optional parameters for the AccountBackupsClient.List method. @@ -234,7 +233,7 @@ func (client *AccountBackupsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go index 1d022638b27d..eafd6e6aff11 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go @@ -13,10 +13,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Account_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_List.json func ExampleAccountBackupsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,9 +27,7 @@ func ExampleAccountBackupsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - nil) + pager := client.NewListPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,7 +40,7 @@ func ExampleAccountBackupsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Account_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_Get.json func ExampleAccountBackupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,11 +51,7 @@ func ExampleAccountBackupsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "backup1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "backup1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -65,7 +59,7 @@ func ExampleAccountBackupsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Account_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Account_Delete.json func ExampleAccountBackupsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,11 +70,7 @@ func ExampleAccountBackupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "resourceGroup", - "accountName", - "backupName", - nil) + poller, err := client.BeginDelete(ctx, "resourceGroup", "accountName", "backupName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/accounts_client.go b/sdk/resourcemanager/netapp/armnetapp/accounts_client.go index ae21e0f158fc..d829d167f7e4 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accounts_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/accounts_client.go @@ -58,7 +58,7 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update the specified NetApp account within the resource group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // body - NetApp Account object supplied in the body of the operation. @@ -80,7 +80,7 @@ func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update the specified NetApp account within the resource group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, body Account, options *AccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, body, options) if err != nil { @@ -116,7 +116,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -124,7 +124,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -144,7 +144,7 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { @@ -180,14 +180,14 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get the NetApp account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -226,7 +226,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,8 +242,7 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl } // NewListPager - List and describe all NetApp accounts in the resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // options - AccountsClientListOptions contains the optional parameters for the AccountsClient.List method. func (client *AccountsClient) NewListPager(resourceGroupName string, options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { @@ -290,7 +289,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -306,8 +305,7 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC } // NewListBySubscriptionPager - List and describe all NetApp accounts in the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.ListBySubscription // method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { @@ -350,7 +348,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,9 +363,74 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon return result, nil } +// BeginRenewCredentials - Renew identity credentials that are used to authenticate to key vault, for customer-managed key +// encryption. If encryption.identity.principalId does not match identity.principalId, running this +// operation will fix it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// resourceGroupName - The name of the resource group. +// accountName - The name of the NetApp account +// options - AccountsClientBeginRenewCredentialsOptions contains the optional parameters for the AccountsClient.BeginRenewCredentials +// method. +func (client *AccountsClient) BeginRenewCredentials(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginRenewCredentialsOptions) (*runtime.Poller[AccountsClientRenewCredentialsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.renewCredentials(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AccountsClientRenewCredentialsResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[AccountsClientRenewCredentialsResponse](options.ResumeToken, client.pl, nil) + } +} + +// RenewCredentials - Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. +// If encryption.identity.principalId does not match identity.principalId, running this +// operation will fix it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +func (client *AccountsClient) renewCredentials(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginRenewCredentialsOptions) (*http.Response, error) { + req, err := client.renewCredentialsCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// renewCredentialsCreateRequest creates the RenewCredentials request. +func (client *AccountsClient) renewCredentialsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginRenewCredentialsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + return req, nil +} + // BeginUpdate - Patch the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // body - NetApp Account object supplied in the body of the operation. @@ -388,7 +451,7 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, body AccountPatch, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, body, options) if err != nil { @@ -424,7 +487,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go index ae3167290782..ee7c8d130371 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_List.json func ExampleAccountsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,32 +41,7 @@ func ExampleAccountsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_List.json -func ExampleAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armnetapp.NewAccountsClient("D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRG", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Get.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,10 +52,7 @@ func ExampleAccountsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - nil) + res, err := client.Get(ctx, "myRG", "account1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -88,7 +60,7 @@ func ExampleAccountsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_CreateOrUpdate.json func ExampleAccountsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -99,28 +71,24 @@ func ExampleAccountsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "myRG", - "account1", - armnetapp.Account{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.AccountProperties{ - ActiveDirectories: []*armnetapp.ActiveDirectory{ - { - AesEncryption: to.Ptr(true), - DNS: to.Ptr("10.10.10.3, 10.10.10.4"), - Domain: to.Ptr("10.10.10.3"), - LdapOverTLS: to.Ptr(false), - LdapSigning: to.Ptr(false), - OrganizationalUnit: to.Ptr("OU=Engineering"), - Password: to.Ptr("ad_password"), - Site: to.Ptr("SiteName"), - SmbServerName: to.Ptr("SMBServer"), - Username: to.Ptr("ad_user_name"), - }}, - }, + poller, err := client.BeginCreateOrUpdate(ctx, "myRG", "account1", armnetapp.Account{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.AccountProperties{ + ActiveDirectories: []*armnetapp.ActiveDirectory{ + { + AesEncryption: to.Ptr(true), + DNS: to.Ptr("10.10.10.3, 10.10.10.4"), + Domain: to.Ptr("10.10.10.3"), + LdapOverTLS: to.Ptr(false), + LdapSigning: to.Ptr(false), + OrganizationalUnit: to.Ptr("OU=Engineering"), + Password: to.Ptr("ad_password"), + Site: to.Ptr("SiteName"), + SmbServerName: to.Ptr("SMBServer"), + Username: to.Ptr("ad_user_name"), + }}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -132,7 +100,7 @@ func ExampleAccountsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Delete.json func ExampleAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -143,10 +111,7 @@ func ExampleAccountsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -156,7 +121,7 @@ func ExampleAccountsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Accounts_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_Update.json func ExampleAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -167,15 +132,11 @@ func ExampleAccountsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - armnetapp.AccountPatch{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, + poller, err := client.BeginUpdate(ctx, "myRG", "account1", armnetapp.AccountPatch{ + Tags: map[string]*string{ + "Tag1": to.Ptr("Value1"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -186,3 +147,24 @@ func ExampleAccountsClient_BeginUpdate() { // TODO: use response item _ = res } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Accounts_RenewCredentials.json +func ExampleAccountsClient_BeginRenewCredentials() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armnetapp.NewAccountsClient("D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRenewCredentials(ctx, "myRG", "account1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/netapp/armnetapp/autorest.md b/sdk/resourcemanager/netapp/armnetapp/autorest.md index c9c1ef59fdef..f9a4dc238fbe 100644 --- a/sdk/resourcemanager/netapp/armnetapp/autorest.md +++ b/sdk/resourcemanager/netapp/armnetapp/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/f705a46c74af9e4c096556e914d9a45c01c47b5e/specification/netapp/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/f705a46c74af9e4c096556e914d9a45c01c47b5e/specification/netapp/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/0507c3d410681049bb5cd9545b49a7578a91d3d0/specification/netapp/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/0507c3d410681049bb5cd9545b49a7578a91d3d0/specification/netapp/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.1.0 +module-version: 3.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go index 760a876b4597..9d3cd0911a66 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go @@ -58,7 +58,7 @@ func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCrede // BeginCreate - Create a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -81,7 +81,7 @@ func (client *BackupPoliciesClient) BeginCreate(ctx context.Context, resourceGro // Create - Create a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupPoliciesClient) create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy, options *BackupPoliciesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, body, options) if err != nil { @@ -121,7 +121,7 @@ func (client *BackupPoliciesClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,7 +129,7 @@ func (client *BackupPoliciesClient) createCreateRequest(ctx context.Context, res // BeginDelete - Delete backup policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -151,7 +151,7 @@ func (client *BackupPoliciesClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete backup policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, options) if err != nil { @@ -191,14 +191,14 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get a particular backup Policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -242,7 +242,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,8 +258,7 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back } // NewListPager - List backup policies for Netapp Account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.List method. @@ -305,7 +304,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +321,7 @@ func (client *BackupPoliciesClient) listHandleResponse(resp *http.Response) (Bac // BeginUpdate - Patch a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -345,7 +344,7 @@ func (client *BackupPoliciesClient) BeginUpdate(ctx context.Context, resourceGro // Update - Patch a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch, options *BackupPoliciesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, backupPolicyName, body, options) if err != nil { @@ -385,7 +384,7 @@ func (client *BackupPoliciesClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go index 657b3f72d8aa..67a879aa0cc7 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/BackupPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_List.json func ExampleBackupPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleBackupPoliciesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - nil) + pager := client.NewListPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleBackupPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/BackupPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Get.json func ExampleBackupPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleBackupPoliciesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "backupPolicyName", - nil) + res, err := client.Get(ctx, "myRG", "account1", "backupPolicyName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleBackupPoliciesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/BackupPolicies_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Create.json func ExampleBackupPoliciesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,20 +71,15 @@ func ExampleBackupPoliciesClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account1", - "backupPolicyName", - armnetapp.BackupPolicy{ - Location: to.Ptr("westus"), - Properties: &armnetapp.BackupPolicyProperties{ - DailyBackupsToKeep: to.Ptr[int32](10), - Enabled: to.Ptr(true), - MonthlyBackupsToKeep: to.Ptr[int32](10), - WeeklyBackupsToKeep: to.Ptr[int32](10), - }, + poller, err := client.BeginCreate(ctx, "myRG", "account1", "backupPolicyName", armnetapp.BackupPolicy{ + Location: to.Ptr("westus"), + Properties: &armnetapp.BackupPolicyProperties{ + DailyBackupsToKeep: to.Ptr[int32](10), + Enabled: to.Ptr(true), + MonthlyBackupsToKeep: to.Ptr[int32](10), + WeeklyBackupsToKeep: to.Ptr[int32](10), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -102,7 +91,7 @@ func ExampleBackupPoliciesClient_BeginCreate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/BackupPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Update.json func ExampleBackupPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -113,20 +102,15 @@ func ExampleBackupPoliciesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "backupPolicyName", - armnetapp.BackupPolicyPatch{ - Location: to.Ptr("westus"), - Properties: &armnetapp.BackupPolicyProperties{ - DailyBackupsToKeep: to.Ptr[int32](5), - Enabled: to.Ptr(false), - MonthlyBackupsToKeep: to.Ptr[int32](10), - WeeklyBackupsToKeep: to.Ptr[int32](10), - }, + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "backupPolicyName", armnetapp.BackupPolicyPatch{ + Location: to.Ptr("westus"), + Properties: &armnetapp.BackupPolicyProperties{ + DailyBackupsToKeep: to.Ptr[int32](5), + Enabled: to.Ptr(false), + MonthlyBackupsToKeep: to.Ptr[int32](10), + WeeklyBackupsToKeep: to.Ptr[int32](10), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -138,7 +122,7 @@ func ExampleBackupPoliciesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/BackupPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/BackupPolicies_Delete.json func ExampleBackupPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -149,11 +133,7 @@ func ExampleBackupPoliciesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "resourceGroup", - "accountName", - "backupPolicyName", - nil) + poller, err := client.BeginDelete(ctx, "resourceGroup", "accountName", "backupPolicyName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/backups_client.go b/sdk/resourcemanager/netapp/armnetapp/backups_client.go index 8d0ccfc10f3e..d6840deb7d98 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backups_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/backups_client.go @@ -58,7 +58,7 @@ func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create a backup for the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -82,7 +82,7 @@ func (client *BackupsClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create a backup for the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupsClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup, options *BackupsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body, options) if err != nil { @@ -130,7 +130,7 @@ func (client *BackupsClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -138,7 +138,7 @@ func (client *BackupsClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Delete a backup of the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -161,7 +161,7 @@ func (client *BackupsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a backup of the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, options *BackupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, options) if err != nil { @@ -209,14 +209,14 @@ func (client *BackupsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets the specified backup of the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -270,7 +270,7 @@ func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +287,7 @@ func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClie // GetStatus - Get the status of the backup for a volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -336,7 +336,7 @@ func (client *BackupsClient) getStatusCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -353,7 +353,7 @@ func (client *BackupsClient) getStatusHandleResponse(resp *http.Response) (Backu // GetVolumeRestoreStatus - Get the status of the restore for a volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -403,7 +403,7 @@ func (client *BackupsClient) getVolumeRestoreStatusCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -419,8 +419,7 @@ func (client *BackupsClient) getVolumeRestoreStatusHandleResponse(resp *http.Res } // NewListPager - List all backups for a volume -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -476,7 +475,7 @@ func (client *BackupsClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -493,7 +492,7 @@ func (client *BackupsClient) listHandleResponse(resp *http.Response) (BackupsCli // BeginUpdate - Patch a backup for the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -517,7 +516,7 @@ func (client *BackupsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch a backup for the volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *BackupsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body BackupPatch, options *BackupsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body, options) if err != nil { @@ -565,7 +564,7 @@ func (client *BackupsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go index f2d0d92bc980..0914c0c868a4 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_BackupStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_BackupStatus.json func ExampleBackupsClient_GetStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,12 +28,7 @@ func ExampleBackupsClient_GetStatus() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetStatus(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + res, err := client.GetStatus(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -41,7 +36,7 @@ func ExampleBackupsClient_GetStatus() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_RestoreStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_RestoreStatus.json func ExampleBackupsClient_GetVolumeRestoreStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,12 +47,7 @@ func ExampleBackupsClient_GetVolumeRestoreStatus() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetVolumeRestoreStatus(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + res, err := client.GetVolumeRestoreStatus(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -65,7 +55,7 @@ func ExampleBackupsClient_GetVolumeRestoreStatus() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_List.json func ExampleBackupsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,11 +66,7 @@ func ExampleBackupsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - "pool1", - "volume1", - nil) + pager := client.NewListPager("myRG", "account1", "pool1", "volume1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -93,7 +79,7 @@ func ExampleBackupsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Get.json func ExampleBackupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,13 +90,7 @@ func ExampleBackupsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "backup1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "pool1", "volume1", "backup1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -118,7 +98,7 @@ func ExampleBackupsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Create.json func ExampleBackupsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,19 +109,12 @@ func ExampleBackupsClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "backup1", - armnetapp.Backup{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.BackupProperties{ - Label: to.Ptr("myLabel"), - }, + poller, err := client.BeginCreate(ctx, "myRG", "account1", "pool1", "volume1", "backup1", armnetapp.Backup{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.BackupProperties{ + Label: to.Ptr("myLabel"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -153,7 +126,7 @@ func ExampleBackupsClient_BeginCreate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Update.json func ExampleBackupsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -164,14 +137,7 @@ func ExampleBackupsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "backup1", - armnetapp.BackupPatch{}, - nil) + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", "backup1", armnetapp.BackupPatch{}, &armnetapp.BackupsClientBeginUpdateOptions{}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -183,7 +149,7 @@ func ExampleBackupsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Backups_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Backups_Delete.json func ExampleBackupsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -194,13 +160,7 @@ func ExampleBackupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "resourceGroup", - "accountName", - "poolName", - "volumeName", - "backupName", - nil) + poller, err := client.BeginDelete(ctx, "resourceGroup", "accountName", "poolName", "volumeName", "backupName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/build.go b/sdk/resourcemanager/netapp/armnetapp/build.go index fa2b06886b82..4cbb57a5d81f 100644 --- a/sdk/resourcemanager/netapp/armnetapp/build.go +++ b/sdk/resourcemanager/netapp/armnetapp/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired resourcemanager/netapp/armnetapp +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/netapp/armnetapp package armnetapp diff --git a/sdk/resourcemanager/netapp/armnetapp/constants.go b/sdk/resourcemanager/netapp/armnetapp/constants.go index 2496c6f4fc06..5e83b7ebaff0 100644 --- a/sdk/resourcemanager/netapp/armnetapp/constants.go +++ b/sdk/resourcemanager/netapp/armnetapp/constants.go @@ -11,7 +11,7 @@ package armnetapp const ( moduleName = "armnetapp" - moduleVersion = "v2.1.0" + moduleVersion = "v3.0.0" ) // ActiveDirectoryStatus - Status of the Active Directory @@ -242,6 +242,26 @@ func PossibleEndpointTypeValues() []EndpointType { } } +// IdentityType - The identity type. +type IdentityType string + +const ( + IdentityTypeNone IdentityType = "None" + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeSystemAssigned, + IdentityTypeSystemAssignedUserAssigned, + IdentityTypeUserAssigned, + } +} + // InAvailabilityReasonType - Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists // indicates that the name is already in use and is therefore unavailable. type InAvailabilityReasonType string @@ -259,6 +279,51 @@ func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { } } +// KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault +type KeySource string + +const ( + // KeySourceMicrosoftKeyVault - Customer-managed key encryption + KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" + // KeySourceMicrosoftNetApp - Microsoft-managed key encryption + KeySourceMicrosoftNetApp KeySource = "Microsoft.NetApp" +) + +// PossibleKeySourceValues returns the possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{ + KeySourceMicrosoftKeyVault, + KeySourceMicrosoftNetApp, + } +} + +// KeyVaultStatus - Status of the KeyVault connection. +type KeyVaultStatus string + +const ( + // KeyVaultStatusCreated - KeyVault connection created but not in use + KeyVaultStatusCreated KeyVaultStatus = "Created" + // KeyVaultStatusDeleted - KeyVault connection Deleted + KeyVaultStatusDeleted KeyVaultStatus = "Deleted" + // KeyVaultStatusError - Error with the KeyVault connection + KeyVaultStatusError KeyVaultStatus = "Error" + // KeyVaultStatusInUse - KeyVault connection in use by SMB Volume + KeyVaultStatusInUse KeyVaultStatus = "InUse" + // KeyVaultStatusUpdating - KeyVault connection Updating + KeyVaultStatusUpdating KeyVaultStatus = "Updating" +) + +// PossibleKeyVaultStatusValues returns the possible values for the KeyVaultStatus const type. +func PossibleKeyVaultStatusValues() []KeyVaultStatus { + return []KeyVaultStatus{ + KeyVaultStatusCreated, + KeyVaultStatusDeleted, + KeyVaultStatusError, + KeyVaultStatusInUse, + KeyVaultStatusUpdating, + } +} + type MetricAggregationType string const ( @@ -352,6 +417,30 @@ func PossibleQosTypeValues() []QosType { } } +// RegionStorageToNetworkProximity - Provides storage to network proximity information in the region. +type RegionStorageToNetworkProximity string + +const ( + // RegionStorageToNetworkProximityDefault - Basic network connectivity. + RegionStorageToNetworkProximityDefault RegionStorageToNetworkProximity = "Default" + // RegionStorageToNetworkProximityT1 - Standard T1 network connectivity. + RegionStorageToNetworkProximityT1 RegionStorageToNetworkProximity = "T1" + // RegionStorageToNetworkProximityT1AndT2 - Standard T1 and T2 network connectivity. + RegionStorageToNetworkProximityT1AndT2 RegionStorageToNetworkProximity = "T1AndT2" + // RegionStorageToNetworkProximityT2 - Standard T2 network connectivity. + RegionStorageToNetworkProximityT2 RegionStorageToNetworkProximity = "T2" +) + +// PossibleRegionStorageToNetworkProximityValues returns the possible values for the RegionStorageToNetworkProximity const type. +func PossibleRegionStorageToNetworkProximityValues() []RegionStorageToNetworkProximity { + return []RegionStorageToNetworkProximity{ + RegionStorageToNetworkProximityDefault, + RegionStorageToNetworkProximityT1, + RegionStorageToNetworkProximityT1AndT2, + RegionStorageToNetworkProximityT2, + } +} + // RelationshipStatus - Status of the mirror relationship type RelationshipStatus string @@ -426,6 +515,43 @@ func PossibleServiceLevelValues() []ServiceLevel { } } +// SmbAccessBasedEnumeration - Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol +// volume +type SmbAccessBasedEnumeration string + +const ( + // SmbAccessBasedEnumerationDisabled - smbAccessBasedEnumeration share setting is disabled + SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" + // SmbAccessBasedEnumerationEnabled - smbAccessBasedEnumeration share setting is enabled + SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" +) + +// PossibleSmbAccessBasedEnumerationValues returns the possible values for the SmbAccessBasedEnumeration const type. +func PossibleSmbAccessBasedEnumerationValues() []SmbAccessBasedEnumeration { + return []SmbAccessBasedEnumeration{ + SmbAccessBasedEnumerationDisabled, + SmbAccessBasedEnumerationEnabled, + } +} + +// SmbNonBrowsable - Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume +type SmbNonBrowsable string + +const ( + // SmbNonBrowsableDisabled - smbNonBrowsable share setting is disabled + SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" + // SmbNonBrowsableEnabled - smbNonBrowsable share setting is enabled + SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" +) + +// PossibleSmbNonBrowsableValues returns the possible values for the SmbNonBrowsable const type. +func PossibleSmbNonBrowsableValues() []SmbNonBrowsable { + return []SmbNonBrowsable{ + SmbNonBrowsableDisabled, + SmbNonBrowsableEnabled, + } +} + // Type - Type of quota type Type string diff --git a/sdk/resourcemanager/netapp/armnetapp/go.mod b/sdk/resourcemanager/netapp/armnetapp/go.mod index a62603094173..c7e03a251b2a 100644 --- a/sdk/resourcemanager/netapp/armnetapp/go.mod +++ b/sdk/resourcemanager/netapp/armnetapp/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3 go 1.18 diff --git a/sdk/resourcemanager/netapp/armnetapp/models.go b/sdk/resourcemanager/netapp/armnetapp/models.go index 726aac007cf2..19c79426fbab 100644 --- a/sdk/resourcemanager/netapp/armnetapp/models.go +++ b/sdk/resourcemanager/netapp/armnetapp/models.go @@ -16,6 +16,9 @@ type Account struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` + // The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // NetApp Account properties Properties *AccountProperties `json:"properties,omitempty"` @@ -56,8 +59,14 @@ type AccountBackupsClientListOptions struct { // AccountEncryption - Encryption settings type AccountEncryption struct { - // Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - KeySource *string `json:"keySource,omitempty"` + // Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + Identity *EncryptionIdentity `json:"identity,omitempty"` + + // The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault + KeySource *KeySource `json:"keySource,omitempty"` + + // Properties provided by KeVault. Applicable if keySource is 'Microsoft.KeyVault'. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` } // AccountList - List of NetApp account resources @@ -98,6 +107,9 @@ type AccountProperties struct { // Encryption settings Encryption *AccountEncryption `json:"encryption,omitempty"` + // READ-ONLY; Shows the status of disableShowmount for all volumes under the subscription, null equals false + DisableShowmount *bool `json:"disableShowmount,omitempty" azure:"ro"` + // READ-ONLY; Azure lifecycle management ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } @@ -114,6 +126,13 @@ type AccountsClientBeginDeleteOptions struct { ResumeToken string } +// AccountsClientBeginRenewCredentialsOptions contains the optional parameters for the AccountsClient.BeginRenewCredentials +// method. +type AccountsClientBeginRenewCredentialsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. type AccountsClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. @@ -302,27 +321,6 @@ type BackupPolicy struct { Type *string `json:"type,omitempty" azure:"ro"` } -// BackupPolicyDetails - Backup policy properties -type BackupPolicyDetails struct { - // Resource location - Location *string `json:"location,omitempty"` - - // Backup policy Properties - Properties *BackupPolicyProperties `json:"properties,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type - Type *string `json:"type,omitempty" azure:"ro"` -} - // BackupPolicyPatch - Backup policy Details for create and update type BackupPolicyPatch struct { // Resource location @@ -551,21 +549,6 @@ type CheckAvailabilityResponse struct { Reason *InAvailabilityReasonType `json:"reason,omitempty"` } -// CloudError - An error response from the service. -type CloudError struct { - // Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` -} - // DailySchedule - Daily Schedule properties type DailySchedule struct { // Indicates which hour in UTC timezone a snapshot should be taken @@ -590,6 +573,16 @@ type Dimension struct { Name *string `json:"name,omitempty"` } +// EncryptionIdentity - Identity used to authenticate with key vault. +type EncryptionIdentity struct { + // The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type + // has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` + + // READ-ONLY; The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + // ExportPolicyRule - Volume Export Policy Rule type ExportPolicyRule struct { // Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names @@ -661,6 +654,41 @@ type HourlySchedule struct { UsedBytes *int64 `json:"usedBytes,omitempty"` } +// Identity for the resource. +type Identity struct { + // REQUIRED; The identity type. + Type *IdentityType `json:"type,omitempty"` + + // Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this storage + // account. The key is the ARM resource identifier of the identity. Only 1 + // User Assigned identity is permitted here. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// KeyVaultProperties - Properties of key vault. +type KeyVaultProperties struct { + // REQUIRED; The name of KeyVault key. + KeyName *string `json:"keyName,omitempty"` + + // REQUIRED; The resource ID of KeyVault. + KeyVaultResourceID *string `json:"keyVaultResourceId,omitempty"` + + // REQUIRED; The Uri of KeyVault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + + // READ-ONLY; UUID v4 used to identify the Azure Key Vault configuration + KeyVaultID *string `json:"keyVaultId,omitempty" azure:"ro"` + + // READ-ONLY; Status of the KeyVault connection. + Status *KeyVaultStatus `json:"status,omitempty" azure:"ro"` +} + // LdapSearchScopeOpt - LDAP search scope type LdapSearchScopeOpt struct { // This specifies the group DN, which overrides the base DN for group lookups. @@ -757,27 +785,6 @@ type MonthlySchedule struct { UsedBytes *int64 `json:"usedBytes,omitempty"` } -// MountTarget - Mount Target -type MountTarget struct { - // REQUIRED; Resource location - Location *string `json:"location,omitempty"` - - // REQUIRED; Mount Target Properties - Properties *MountTargetProperties `json:"properties,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type - Type *string `json:"type,omitempty" azure:"ro"` -} - // MountTargetProperties - Mount target properties type MountTargetProperties struct { // REQUIRED; UUID v4 used to identify the MountTarget @@ -927,22 +934,6 @@ type PoolsClientListOptions struct { // placeholder for future optional parameters } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // QuotaAvailabilityRequest - Quota availability request content. type QuotaAvailabilityRequest struct { // REQUIRED; Name of the resource to verify. @@ -961,6 +952,29 @@ type ReestablishReplicationRequest struct { SourceVolumeID *string `json:"sourceVolumeId,omitempty"` } +// RegionInfo - Provides region specific information. +type RegionInfo struct { + // Provides logical availability zone mappings for the subscription for a region. + AvailabilityZoneMappings []*RegionInfoAvailabilityZoneMappingsItem `json:"availabilityZoneMappings,omitempty"` + + // Provides storage to network proximity information in the region. + StorageToNetworkProximity *RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` +} + +type RegionInfoAvailabilityZoneMappingsItem struct { + // Logical availability zone. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + + // Available availability zone + IsAvailable *bool `json:"isAvailable,omitempty"` +} + +// RelocateVolumeRequest - Relocate volume request +type RelocateVolumeRequest struct { + // New creation token for the volume that controls the mount point name + CreationToken *string `json:"creationToken,omitempty"` +} + // Replication properties type Replication struct { // REQUIRED; The resource ID of the remote volume. @@ -1012,21 +1026,6 @@ type ReplicationStatus struct { TotalProgress *string `json:"totalProgress,omitempty"` } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // ResourceClientCheckFilePathAvailabilityOptions contains the optional parameters for the ResourceClient.CheckFilePathAvailability // method. type ResourceClientCheckFilePathAvailabilityOptions struct { @@ -1045,16 +1044,9 @@ type ResourceClientCheckQuotaAvailabilityOptions struct { // placeholder for future optional parameters } -// ResourceIdentity - Identity for the resource. -type ResourceIdentity struct { - // Type of Identity. Supported values are: 'None', 'SystemAssigned' - Type *string `json:"type,omitempty"` - - // READ-ONLY; Object id of the identity resource - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - - // READ-ONLY; The tenant id of the resource - TenantID *string `json:"tenantId,omitempty" azure:"ro"` +// ResourceClientQueryRegionInfoOptions contains the optional parameters for the ResourceClient.QueryRegionInfo method. +type ResourceClientQueryRegionInfoOptions struct { + // placeholder for future optional parameters } // ResourceNameAvailabilityRequest - Resource name availability request content. @@ -1192,27 +1184,6 @@ type SnapshotPolicy struct { Type *string `json:"type,omitempty" azure:"ro"` } -// SnapshotPolicyDetails - Snapshot policy properties -type SnapshotPolicyDetails struct { - // Resource location - Location *string `json:"location,omitempty"` - - // Snapshot policy Properties - Properties *SnapshotPolicyProperties `json:"properties,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type - Type *string `json:"type,omitempty" azure:"ro"` -} - // SnapshotPolicyPatch - Snapshot policy Details for create and update type SnapshotPolicyPatch struct { // Resource location @@ -1515,33 +1486,17 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +// UserAssignedIdentity for the resource. +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + // READ-ONLY; The principal ID of the identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` } // Vault information type Vault struct { - // REQUIRED; Resource location - Location *string `json:"location,omitempty"` - // REQUIRED; Vault Properties Properties *VaultProperties `json:"properties,omitempty"` @@ -1822,7 +1777,7 @@ type VolumePatchProperties struct { UnixPermissions *string `json:"unixPermissions,omitempty"` // Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is - // 100 GiB. Upper limit is 100TiB. Specified in bytes. + // 100 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. UsageThreshold *int64 `json:"usageThreshold,omitempty"` } @@ -1850,7 +1805,7 @@ type VolumeProperties struct { SubnetID *string `json:"subnetId,omitempty"` // REQUIRED; Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum - // size is 100 GiB. Upper limit is 100TiB. Specified in bytes. + // size is 500 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. UsageThreshold *int64 `json:"usageThreshold,omitempty"` // Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose @@ -1877,6 +1832,10 @@ type VolumeProperties struct { // Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + // If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation + // has finished. Defaults to false + DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` + // Flag indicating whether subvolume operations are enabled on the volume EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` @@ -1922,6 +1881,9 @@ type VolumeProperties struct { // The service level of the file system ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + // Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume + SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` + // Enables continuously available share property for smb volume. Only applicable for SMB volume SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` @@ -1929,6 +1891,9 @@ type VolumeProperties struct { // 2020-08-01 or later SmbEncryption *bool `json:"smbEncryption,omitempty"` + // Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume + SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` + // If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's // snapshots (default to true). SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` @@ -2090,18 +2055,6 @@ type VolumeQuotaRulesProperties struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// VolumeRelocationProperties - Volume relocation properties -type VolumeRelocationProperties struct { - // The id of the bare metal tenant owned by the existing volume - OldBareMetalTenantID *string `json:"oldBareMetalTenantId,omitempty"` - - // The id of the old volume that is being relocated - OldVolumeID *string `json:"oldVolumeId,omitempty"` - - // Has relocation been requested for this volume - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} - // VolumeRevert - revert a volume to the snapshot type VolumeRevert struct { // Resource id of the snapshot @@ -2180,6 +2133,8 @@ type VolumesClientBeginReestablishReplicationOptions struct { // VolumesClientBeginRelocateOptions contains the optional parameters for the VolumesClient.BeginRelocate method. type VolumesClientBeginRelocateOptions struct { + // Relocate volume request + Body *RelocateVolumeRequest // Resumes the LRO from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/netapp/armnetapp/models_serde.go b/sdk/resourcemanager/netapp/armnetapp/models_serde.go index bf99ae37da6f..5da0f392a859 100644 --- a/sdk/resourcemanager/netapp/armnetapp/models_serde.go +++ b/sdk/resourcemanager/netapp/armnetapp/models_serde.go @@ -21,6 +21,7 @@ func (a Account) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "etag", a.Etag) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -45,6 +46,9 @@ func (a *Account) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -74,7 +78,9 @@ func (a *Account) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AccountEncryption. func (a AccountEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "identity", a.Identity) populate(objectMap, "keySource", a.KeySource) + populate(objectMap, "keyVaultProperties", a.KeyVaultProperties) return json.Marshal(objectMap) } @@ -87,9 +93,15 @@ func (a *AccountEncryption) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "keySource": err = unpopulate(val, "KeySource", &a.KeySource) delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &a.KeyVaultProperties) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -180,6 +192,7 @@ func (a *AccountPatch) UnmarshalJSON(data []byte) error { func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "activeDirectories", a.ActiveDirectories) + populate(objectMap, "disableShowmount", a.DisableShowmount) populate(objectMap, "encryption", a.Encryption) populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) @@ -197,6 +210,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "activeDirectories": err = unpopulate(val, "ActiveDirectories", &a.ActiveDirectories) delete(rawMsg, key) + case "disableShowmount": + err = unpopulate(val, "DisableShowmount", &a.DisableShowmount) + delete(rawMsg, key) case "encryption": err = unpopulate(val, "Encryption", &a.Encryption) delete(rawMsg, key) @@ -505,53 +521,6 @@ func (b *BackupPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BackupPolicyDetails. -func (b BackupPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", b.ID) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPolicyDetails. -func (b *BackupPolicyDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &b.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &b.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type BackupPolicyPatch. func (b BackupPolicyPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -990,64 +959,6 @@ func (c *CheckAvailabilityResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. -func (c *CloudError) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &c.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "message", c.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. -func (c *CloudErrorBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &c.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type DailySchedule. func (d DailySchedule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1118,6 +1029,37 @@ func (d *Dimension) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EncryptionIdentity. +func (e EncryptionIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", e.PrincipalID) + populate(objectMap, "userAssignedIdentity", e.UserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionIdentity. +func (e *EncryptionIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &e.PrincipalID) + delete(rawMsg, key) + case "userAssignedIdentity": + err = unpopulate(val, "UserAssignedIdentity", &e.UserAssignedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExportPolicyRule. func (e ExportPolicyRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1267,6 +1209,88 @@ func (h *HourlySchedule) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultId", k.KeyVaultID) + populate(objectMap, "keyVaultResourceId", k.KeyVaultResourceID) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "status", k.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyVaultId": + err = unpopulate(val, "KeyVaultID", &k.KeyVaultID) + delete(rawMsg, key) + case "keyVaultResourceId": + err = unpopulate(val, "KeyVaultResourceID", &k.KeyVaultResourceID) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &k.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LdapSearchScopeOpt. func (l LdapSearchScopeOpt) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1490,53 +1514,6 @@ func (m *MonthlySchedule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MountTarget. -func (m MountTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MountTarget. -func (m *MountTarget) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type MountTargetProperties. func (m MountTargetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1860,45 +1837,6 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type QuotaAvailabilityRequest. func (q QuotaAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1961,6 +1899,95 @@ func (r *ReestablishReplicationRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RegionInfo. +func (r RegionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZoneMappings", r.AvailabilityZoneMappings) + populate(objectMap, "storageToNetworkProximity", r.StorageToNetworkProximity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionInfo. +func (r *RegionInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityZoneMappings": + err = unpopulate(val, "AvailabilityZoneMappings", &r.AvailabilityZoneMappings) + delete(rawMsg, key) + case "storageToNetworkProximity": + err = unpopulate(val, "StorageToNetworkProximity", &r.StorageToNetworkProximity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionInfoAvailabilityZoneMappingsItem. +func (r RegionInfoAvailabilityZoneMappingsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZone", r.AvailabilityZone) + populate(objectMap, "isAvailable", r.IsAvailable) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionInfoAvailabilityZoneMappingsItem. +func (r *RegionInfoAvailabilityZoneMappingsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &r.AvailabilityZone) + delete(rawMsg, key) + case "isAvailable": + err = unpopulate(val, "IsAvailable", &r.IsAvailable) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RelocateVolumeRequest. +func (r RelocateVolumeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "creationToken", r.CreationToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelocateVolumeRequest. +func (r *RelocateVolumeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationToken": + err = unpopulate(val, "CreationToken", &r.CreationToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Replication. func (r Replication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2086,80 +2113,6 @@ func (r *ReplicationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. -func (r ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. -func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ResourceNameAvailabilityRequest. func (r ResourceNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -2398,53 +2351,6 @@ func (s *SnapshotPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SnapshotPolicyDetails. -func (s SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SnapshotPolicyDetails. -func (s *SnapshotPolicyDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SnapshotPolicyPatch. func (s SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -3080,48 +2986,32 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil @@ -3131,7 +3021,6 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { func (v Vault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", v.ID) - populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "type", v.Type) @@ -3150,9 +3039,6 @@ func (v *Vault) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &v.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -3843,6 +3729,7 @@ func (v VolumeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "dataProtection", v.DataProtection) populate(objectMap, "defaultGroupQuotaInKiBs", v.DefaultGroupQuotaInKiBs) populate(objectMap, "defaultUserQuotaInKiBs", v.DefaultUserQuotaInKiBs) + populate(objectMap, "deleteBaseSnapshot", v.DeleteBaseSnapshot) populate(objectMap, "enableSubvolumes", v.EnableSubvolumes) populate(objectMap, "encrypted", v.Encrypted) populate(objectMap, "encryptionKeySource", v.EncryptionKeySource) @@ -3863,8 +3750,10 @@ func (v VolumeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "proximityPlacementGroup", v.ProximityPlacementGroup) populate(objectMap, "securityStyle", v.SecurityStyle) populate(objectMap, "serviceLevel", v.ServiceLevel) + populate(objectMap, "smbAccessBasedEnumeration", v.SmbAccessBasedEnumeration) populate(objectMap, "smbContinuouslyAvailable", v.SmbContinuouslyAvailable) populate(objectMap, "smbEncryption", v.SmbEncryption) + populate(objectMap, "smbNonBrowsable", v.SmbNonBrowsable) populate(objectMap, "snapshotDirectoryVisible", v.SnapshotDirectoryVisible) populate(objectMap, "snapshotId", v.SnapshotID) populate(objectMap, "storageToNetworkProximity", v.StorageToNetworkProximity) @@ -3921,6 +3810,9 @@ func (v *VolumeProperties) UnmarshalJSON(data []byte) error { case "defaultUserQuotaInKiBs": err = unpopulate(val, "DefaultUserQuotaInKiBs", &v.DefaultUserQuotaInKiBs) delete(rawMsg, key) + case "deleteBaseSnapshot": + err = unpopulate(val, "DeleteBaseSnapshot", &v.DeleteBaseSnapshot) + delete(rawMsg, key) case "enableSubvolumes": err = unpopulate(val, "EnableSubvolumes", &v.EnableSubvolumes) delete(rawMsg, key) @@ -3981,12 +3873,18 @@ func (v *VolumeProperties) UnmarshalJSON(data []byte) error { case "serviceLevel": err = unpopulate(val, "ServiceLevel", &v.ServiceLevel) delete(rawMsg, key) + case "smbAccessBasedEnumeration": + err = unpopulate(val, "SmbAccessBasedEnumeration", &v.SmbAccessBasedEnumeration) + delete(rawMsg, key) case "smbContinuouslyAvailable": err = unpopulate(val, "SmbContinuouslyAvailable", &v.SmbContinuouslyAvailable) delete(rawMsg, key) case "smbEncryption": err = unpopulate(val, "SmbEncryption", &v.SmbEncryption) delete(rawMsg, key) + case "smbNonBrowsable": + err = unpopulate(val, "SmbNonBrowsable", &v.SmbNonBrowsable) + delete(rawMsg, key) case "snapshotDirectoryVisible": err = unpopulate(val, "SnapshotDirectoryVisible", &v.SnapshotDirectoryVisible) delete(rawMsg, key) @@ -4234,41 +4132,6 @@ func (v *VolumeQuotaRulesProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VolumeRelocationProperties. -func (v VolumeRelocationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "oldBareMetalTenantId", v.OldBareMetalTenantID) - populate(objectMap, "oldVolumeId", v.OldVolumeID) - populate(objectMap, "relocationRequested", v.RelocationRequested) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeRelocationProperties. -func (v *VolumeRelocationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "oldBareMetalTenantId": - err = unpopulate(val, "OldBareMetalTenantID", &v.OldBareMetalTenantID) - delete(rawMsg, key) - case "oldVolumeId": - err = unpopulate(val, "OldVolumeID", &v.OldVolumeID) - delete(rawMsg, key) - case "relocationRequested": - err = unpopulate(val, "RelocationRequested", &v.RelocationRequested) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VolumeRevert. func (v VolumeRevert) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/netapp/armnetapp/operations_client.go b/sdk/resourcemanager/netapp/armnetapp/operations_client.go index befc70d40b46..915cc1716089 100644 --- a/sdk/resourcemanager/netapp/armnetapp/operations_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/operations_client.go @@ -50,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Microsoft.NetApp Rest API operations -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -83,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go index a9758f7b050c..6dd278df4e6e 100644 --- a/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go @@ -13,10 +13,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/OperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/OperationList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/pools_client.go b/sdk/resourcemanager/netapp/armnetapp/pools_client.go index a7a812b3feab..30214f4791f9 100644 --- a/sdk/resourcemanager/netapp/armnetapp/pools_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/pools_client.go @@ -58,7 +58,7 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Create or Update a capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -81,7 +81,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Create or Update a capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, poolName, body, options) if err != nil { @@ -121,7 +121,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,7 +129,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Delete the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -150,7 +150,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Delete the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, options) if err != nil { @@ -190,14 +190,14 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get details of the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -241,7 +241,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,8 +257,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe } // NewListPager - List all capacity pools in the NetApp Account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - PoolsClientListOptions contains the optional parameters for the PoolsClient.List method. @@ -310,7 +309,7 @@ func (client *PoolsClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +326,7 @@ func (client *PoolsClient) listHandleResponse(resp *http.Response) (PoolsClientL // BeginUpdate - Patch the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -349,7 +348,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Patch the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPoolPatch, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, body, options) if err != nil { @@ -389,7 +388,7 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go index 6b12f9a82fdd..79d77f12a576 100644 --- a/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Pools_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_List.json func ExamplePoolsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExamplePoolsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - nil) + pager := client.NewListPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExamplePoolsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Pools_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_Get.json func ExamplePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExamplePoolsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "pool1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "pool1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExamplePoolsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Pools_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_CreateOrUpdate.json func ExamplePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,19 +71,14 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "myRG", - "account1", - "pool1", - armnetapp.CapacityPool{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.PoolProperties{ - QosType: to.Ptr(armnetapp.QosTypeAuto), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - Size: to.Ptr[int64](4398046511104), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "myRG", "account1", "pool1", armnetapp.CapacityPool{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.PoolProperties{ + QosType: to.Ptr(armnetapp.QosTypeAuto), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + Size: to.Ptr[int64](4398046511104), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +90,7 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Pools_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_Update.json func ExamplePoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,12 +101,7 @@ func ExamplePoolsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "pool1", - armnetapp.CapacityPoolPatch{}, - nil) + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "pool1", armnetapp.CapacityPoolPatch{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -129,7 +113,7 @@ func ExamplePoolsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Pools_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Pools_Delete.json func ExamplePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,11 +124,7 @@ func ExamplePoolsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - "pool1", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account1", "pool1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/resource_client.go b/sdk/resourcemanager/netapp/armnetapp/resource_client.go index c41b61062fa4..657eac540863 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resource_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/resource_client.go @@ -58,7 +58,7 @@ func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, // CheckFilePathAvailability - Check if a file path is available. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // location - The location // body - File path availability request. // options - ResourceClientCheckFilePathAvailabilityOptions contains the optional parameters for the ResourceClient.CheckFilePathAvailability @@ -94,7 +94,7 @@ func (client *ResourceClient) checkFilePathAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -111,7 +111,7 @@ func (client *ResourceClient) checkFilePathAvailabilityHandleResponse(resp *http // CheckNameAvailability - Check if a resource name is available. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // location - The location // body - Name availability request. // options - ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability @@ -147,7 +147,7 @@ func (client *ResourceClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -164,7 +164,7 @@ func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Res // CheckQuotaAvailability - Check if a quota is available. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // location - The location // body - Quota availability request. // options - ResourceClientCheckQuotaAvailabilityOptions contains the optional parameters for the ResourceClient.CheckQuotaAvailability @@ -200,7 +200,7 @@ func (client *ResourceClient) checkQuotaAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -214,3 +214,55 @@ func (client *ResourceClient) checkQuotaAvailabilityHandleResponse(resp *http.Re } return result, nil } + +// QueryRegionInfo - Provides storage to network proximity and logical zone mapping information. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-05-01 +// location - The location +// options - ResourceClientQueryRegionInfoOptions contains the optional parameters for the ResourceClient.QueryRegionInfo +// method. +func (client *ResourceClient) QueryRegionInfo(ctx context.Context, location string, options *ResourceClientQueryRegionInfoOptions) (ResourceClientQueryRegionInfoResponse, error) { + req, err := client.queryRegionInfoCreateRequest(ctx, location, options) + if err != nil { + return ResourceClientQueryRegionInfoResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ResourceClientQueryRegionInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ResourceClientQueryRegionInfoResponse{}, runtime.NewResponseError(resp) + } + return client.queryRegionInfoHandleResponse(resp) +} + +// queryRegionInfoCreateRequest creates the QueryRegionInfo request. +func (client *ResourceClient) queryRegionInfoCreateRequest(ctx context.Context, location string, options *ResourceClientQueryRegionInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// queryRegionInfoHandleResponse handles the QueryRegionInfo response. +func (client *ResourceClient) queryRegionInfoHandleResponse(resp *http.Response) (ResourceClientQueryRegionInfoResponse, error) { + result := ResourceClientQueryRegionInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegionInfo); err != nil { + return ResourceClientQueryRegionInfoResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/netappresource_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go similarity index 58% rename from sdk/resourcemanager/netapp/armnetapp/netappresource_client_example_test.go rename to sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go index dfe945660234..23d98cd3c3ba 100644 --- a/sdk/resourcemanager/netapp/armnetapp/netappresource_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/CheckNameAvailability.json func ExampleResourceClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,11 @@ func ExampleResourceClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckNameAvailability(ctx, - "eastus", - armnetapp.ResourceNameAvailabilityRequest{ - Name: to.Ptr("accName"), - Type: to.Ptr(armnetapp.CheckNameResourceTypes("netAppAccount")), - ResourceGroup: to.Ptr("myRG"), - }, - nil) + res, err := client.CheckNameAvailability(ctx, "eastus", armnetapp.ResourceNameAvailabilityRequest{ + Name: to.Ptr("accName"), + Type: to.Ptr(armnetapp.CheckNameResourceTypes("netAppAccount")), + ResourceGroup: to.Ptr("myRG"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -43,7 +40,7 @@ func ExampleResourceClient_CheckNameAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/CheckFilePathAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/CheckFilePathAvailability.json func ExampleResourceClient_CheckFilePathAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,13 +51,10 @@ func ExampleResourceClient_CheckFilePathAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckFilePathAvailability(ctx, - "eastus", - armnetapp.FilePathAvailabilityRequest{ - Name: to.Ptr("my-exact-filepth"), - SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - }, - nil) + res, err := client.CheckFilePathAvailability(ctx, "eastus", armnetapp.FilePathAvailabilityRequest{ + Name: to.Ptr("my-exact-filepth"), + SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +62,7 @@ func ExampleResourceClient_CheckFilePathAvailability() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/CheckQuotaAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/CheckQuotaAvailability.json func ExampleResourceClient_CheckQuotaAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,14 +73,30 @@ func ExampleResourceClient_CheckQuotaAvailability() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CheckQuotaAvailability(ctx, - "eastus", - armnetapp.QuotaAvailabilityRequest{ - Name: to.Ptr("resource1"), - Type: to.Ptr(armnetapp.CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccounts), - ResourceGroup: to.Ptr("myRG"), - }, - nil) + res, err := client.CheckQuotaAvailability(ctx, "eastus", armnetapp.QuotaAvailabilityRequest{ + Name: to.Ptr("resource1"), + Type: to.Ptr(armnetapp.CheckQuotaNameResourceTypesMicrosoftNetAppNetAppAccounts), + ResourceGroup: to.Ptr("myRG"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/RegionInfo.json +func ExampleResourceClient_QueryRegionInfo() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armnetapp.NewResourceClient("D633CC2E-722B-4AE1-B636-BBD9E4C60ED9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.QueryRegionInfo(ctx, "eastus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go index e8e9dd703abe..6f7f5176d9cd 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go @@ -58,7 +58,7 @@ func NewResourceQuotaLimitsClient(subscriptionID string, credential azcore.Token // Get - Get the default and current subscription quota limit // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // location - The location // quotaLimitName - The name of the Quota Limit // options - ResourceQuotaLimitsClientGetOptions contains the optional parameters for the ResourceQuotaLimitsClient.Get method. @@ -97,7 +97,7 @@ func (client *ResourceQuotaLimitsClient) getCreateRequest(ctx context.Context, l return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,8 +113,7 @@ func (client *ResourceQuotaLimitsClient) getHandleResponse(resp *http.Response) } // NewListPager - Get the default and current limits for quotas -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // location - The location // options - ResourceQuotaLimitsClientListOptions contains the optional parameters for the ResourceQuotaLimitsClient.List // method. @@ -156,7 +155,7 @@ func (client *ResourceQuotaLimitsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/netappresourcequotalimits_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go similarity index 87% rename from sdk/resourcemanager/netapp/armnetapp/netappresourcequotalimits_client_example_test.go rename to sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go index a90eec2cf520..2897a1d6f831 100644 --- a/sdk/resourcemanager/netapp/armnetapp/netappresourcequotalimits_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go @@ -13,10 +13,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/QuotaLimits_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/QuotaLimits_List.json func ExampleResourceQuotaLimitsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,8 +27,7 @@ func ExampleResourceQuotaLimitsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("eastus", - nil) + pager := client.NewListPager("eastus", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -41,7 +40,7 @@ func ExampleResourceQuotaLimitsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/QuotaLimits_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/QuotaLimits_Get.json func ExampleResourceQuotaLimitsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,10 +51,7 @@ func ExampleResourceQuotaLimitsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "eastus", - "totalCoolAccessVolumesPerSubscription", - nil) + res, err := client.Get(ctx, "eastus", "totalCoolAccessVolumesPerSubscription", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/response_types.go b/sdk/resourcemanager/netapp/armnetapp/response_types.go index f1c3ee5236d3..22fab5888606 100644 --- a/sdk/resourcemanager/netapp/armnetapp/response_types.go +++ b/sdk/resourcemanager/netapp/armnetapp/response_types.go @@ -49,6 +49,11 @@ type AccountsClientListResponse struct { AccountList } +// AccountsClientRenewCredentialsResponse contains the response from method AccountsClient.RenewCredentials. +type AccountsClientRenewCredentialsResponse struct { + // placeholder for future response values +} + // AccountsClientUpdateResponse contains the response from method AccountsClient.Update. type AccountsClientUpdateResponse struct { Account @@ -159,6 +164,11 @@ type ResourceClientCheckQuotaAvailabilityResponse struct { CheckAvailabilityResponse } +// ResourceClientQueryRegionInfoResponse contains the response from method ResourceClient.QueryRegionInfo. +type ResourceClientQueryRegionInfoResponse struct { + RegionInfo +} + // ResourceQuotaLimitsClientGetResponse contains the response from method ResourceQuotaLimitsClient.Get. type ResourceQuotaLimitsClientGetResponse struct { SubscriptionQuotaItem diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go index c2f9ef071eb8..785465a8a8ab 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go @@ -58,7 +58,7 @@ func NewSnapshotPoliciesClient(subscriptionID string, credential azcore.TokenCre // Create - Create a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // snapshotPolicyName - The name of the snapshot policy @@ -103,7 +103,7 @@ func (client *SnapshotPoliciesClient) createCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -120,7 +120,7 @@ func (client *SnapshotPoliciesClient) createHandleResponse(resp *http.Response) // BeginDelete - Delete snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // snapshotPolicyName - The name of the snapshot policy @@ -142,7 +142,7 @@ func (client *SnapshotPoliciesClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, options) if err != nil { @@ -182,14 +182,14 @@ func (client *SnapshotPoliciesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get a snapshot Policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // snapshotPolicyName - The name of the snapshot policy @@ -233,7 +233,7 @@ func (client *SnapshotPoliciesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,8 +249,7 @@ func (client *SnapshotPoliciesClient) getHandleResponse(resp *http.Response) (Sn } // NewListPager - List snapshot policy -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - SnapshotPoliciesClientListOptions contains the optional parameters for the SnapshotPoliciesClient.List method. @@ -296,7 +295,7 @@ func (client *SnapshotPoliciesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +312,7 @@ func (client *SnapshotPoliciesClient) listHandleResponse(resp *http.Response) (S // ListVolumes - Get volumes associated with snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // snapshotPolicyName - The name of the snapshot policy @@ -358,7 +357,7 @@ func (client *SnapshotPoliciesClient) listVolumesCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -375,7 +374,7 @@ func (client *SnapshotPoliciesClient) listVolumesHandleResponse(resp *http.Respo // BeginUpdate - Patch a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // snapshotPolicyName - The name of the snapshot policy @@ -398,7 +397,7 @@ func (client *SnapshotPoliciesClient) BeginUpdate(ctx context.Context, resourceG // Update - Patch a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicyPatch, options *SnapshotPoliciesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, snapshotPolicyName, body, options) if err != nil { @@ -438,7 +437,7 @@ func (client *SnapshotPoliciesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go index ba9102064311..60f252ef2239 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_List.json func ExampleSnapshotPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleSnapshotPoliciesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - nil) + pager := client.NewListPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleSnapshotPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Get.json func ExampleSnapshotPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleSnapshotPoliciesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "snapshotPolicyName", - nil) + res, err := client.Get(ctx, "myRG", "account1", "snapshotPolicyName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleSnapshotPoliciesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Create.json func ExampleSnapshotPoliciesClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,38 +71,33 @@ func ExampleSnapshotPoliciesClient_Create() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, - "myRG", - "account1", - "snapshotPolicyName", - armnetapp.SnapshotPolicy{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.SnapshotPolicyProperties{ - DailySchedule: &armnetapp.DailySchedule{ - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](30), - SnapshotsToKeep: to.Ptr[int32](4), - }, - Enabled: to.Ptr(true), - HourlySchedule: &armnetapp.HourlySchedule{ - Minute: to.Ptr[int32](50), - SnapshotsToKeep: to.Ptr[int32](2), - }, - MonthlySchedule: &armnetapp.MonthlySchedule{ - DaysOfMonth: to.Ptr("10,11,12"), - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](15), - SnapshotsToKeep: to.Ptr[int32](5), - }, - WeeklySchedule: &armnetapp.WeeklySchedule{ - Day: to.Ptr("Wednesday"), - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](45), - SnapshotsToKeep: to.Ptr[int32](3), - }, + res, err := client.Create(ctx, "myRG", "account1", "snapshotPolicyName", armnetapp.SnapshotPolicy{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.SnapshotPolicyProperties{ + DailySchedule: &armnetapp.DailySchedule{ + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](30), + SnapshotsToKeep: to.Ptr[int32](4), + }, + Enabled: to.Ptr(true), + HourlySchedule: &armnetapp.HourlySchedule{ + Minute: to.Ptr[int32](50), + SnapshotsToKeep: to.Ptr[int32](2), + }, + MonthlySchedule: &armnetapp.MonthlySchedule{ + DaysOfMonth: to.Ptr("10,11,12"), + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](15), + SnapshotsToKeep: to.Ptr[int32](5), + }, + WeeklySchedule: &armnetapp.WeeklySchedule{ + Day: to.Ptr("Wednesday"), + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](45), + SnapshotsToKeep: to.Ptr[int32](3), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -116,7 +105,7 @@ func ExampleSnapshotPoliciesClient_Create() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Update.json func ExampleSnapshotPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -127,38 +116,33 @@ func ExampleSnapshotPoliciesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "snapshotPolicyName", - armnetapp.SnapshotPolicyPatch{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.SnapshotPolicyProperties{ - DailySchedule: &armnetapp.DailySchedule{ - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](30), - SnapshotsToKeep: to.Ptr[int32](4), - }, - Enabled: to.Ptr(true), - HourlySchedule: &armnetapp.HourlySchedule{ - Minute: to.Ptr[int32](50), - SnapshotsToKeep: to.Ptr[int32](2), - }, - MonthlySchedule: &armnetapp.MonthlySchedule{ - DaysOfMonth: to.Ptr("10,11,12"), - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](15), - SnapshotsToKeep: to.Ptr[int32](5), - }, - WeeklySchedule: &armnetapp.WeeklySchedule{ - Day: to.Ptr("Wednesday"), - Hour: to.Ptr[int32](14), - Minute: to.Ptr[int32](45), - SnapshotsToKeep: to.Ptr[int32](3), - }, + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "snapshotPolicyName", armnetapp.SnapshotPolicyPatch{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.SnapshotPolicyProperties{ + DailySchedule: &armnetapp.DailySchedule{ + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](30), + SnapshotsToKeep: to.Ptr[int32](4), + }, + Enabled: to.Ptr(true), + HourlySchedule: &armnetapp.HourlySchedule{ + Minute: to.Ptr[int32](50), + SnapshotsToKeep: to.Ptr[int32](2), + }, + MonthlySchedule: &armnetapp.MonthlySchedule{ + DaysOfMonth: to.Ptr("10,11,12"), + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](15), + SnapshotsToKeep: to.Ptr[int32](5), + }, + WeeklySchedule: &armnetapp.WeeklySchedule{ + Day: to.Ptr("Wednesday"), + Hour: to.Ptr[int32](14), + Minute: to.Ptr[int32](45), + SnapshotsToKeep: to.Ptr[int32](3), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -170,7 +154,7 @@ func ExampleSnapshotPoliciesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_Delete.json func ExampleSnapshotPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -181,11 +165,7 @@ func ExampleSnapshotPoliciesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "resourceGroup", - "accountName", - "snapshotPolicyName", - nil) + poller, err := client.BeginDelete(ctx, "resourceGroup", "accountName", "snapshotPolicyName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -195,7 +175,7 @@ func ExampleSnapshotPoliciesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/SnapshotPolicies_ListVolumes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/SnapshotPolicies_ListVolumes.json func ExampleSnapshotPoliciesClient_ListVolumes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -206,11 +186,7 @@ func ExampleSnapshotPoliciesClient_ListVolumes() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListVolumes(ctx, - "myRG", - "account1", - "snapshotPolicyName", - nil) + res, err := client.ListVolumes(ctx, "myRG", "account1", "snapshotPolicyName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go b/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go index ace2ad365121..fef3c845a58f 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go @@ -58,7 +58,7 @@ func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Create the specified snapshot within the given volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -82,7 +82,7 @@ func (client *SnapshotsClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Create the specified snapshot within the given volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotsClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body Snapshot, options *SnapshotsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) if err != nil { @@ -130,7 +130,7 @@ func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -138,7 +138,7 @@ func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Delete snapshot // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -161,7 +161,7 @@ func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Delete snapshot // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, options) if err != nil { @@ -209,14 +209,14 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get details of the specified snapshot // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -270,7 +270,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,8 +286,7 @@ func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (Snapshots } // NewListPager - List all snapshots associated with the volume -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -343,7 +342,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +359,7 @@ func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (Snapshot // BeginRestoreFiles - Restore the specified files from the specified snapshot to the active filesystem // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -383,7 +382,7 @@ func (client *SnapshotsClient) BeginRestoreFiles(ctx context.Context, resourceGr // RestoreFiles - Restore the specified files from the specified snapshot to the active filesystem // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotsClient) restoreFiles(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body SnapshotRestoreFiles, options *SnapshotsClientBeginRestoreFilesOptions) (*http.Response, error) { req, err := client.restoreFilesCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) if err != nil { @@ -431,14 +430,14 @@ func (client *SnapshotsClient) restoreFilesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, body) } // BeginUpdate - Patch a snapshot // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -462,7 +461,7 @@ func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Patch a snapshot // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body interface{}, options *SnapshotsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName, body, options) if err != nil { @@ -510,7 +509,7 @@ func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go index 9d083b01309d..5d008df17787 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_List.json func ExampleSnapshotsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,11 +28,7 @@ func ExampleSnapshotsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - "pool1", - "volume1", - nil) + pager := client.NewListPager("myRG", "account1", "pool1", "volume1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -45,7 +41,7 @@ func ExampleSnapshotsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Get.json func ExampleSnapshotsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,13 +52,7 @@ func ExampleSnapshotsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "snapshot1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "pool1", "volume1", "snapshot1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -70,7 +60,7 @@ func ExampleSnapshotsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Create.json func ExampleSnapshotsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,16 +71,9 @@ func ExampleSnapshotsClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "snapshot1", - armnetapp.Snapshot{ - Location: to.Ptr("eastus"), - }, - nil) + poller, err := client.BeginCreate(ctx, "myRG", "account1", "pool1", "volume1", "snapshot1", armnetapp.Snapshot{ + Location: to.Ptr("eastus"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -100,7 +83,7 @@ func ExampleSnapshotsClient_BeginCreate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Update.json func ExampleSnapshotsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,14 +94,7 @@ func ExampleSnapshotsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "snapshot1", - map[string]interface{}{}, - nil) + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", "snapshot1", map[string]interface{}{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -130,7 +106,7 @@ func ExampleSnapshotsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_Delete.json func ExampleSnapshotsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -141,13 +117,7 @@ func ExampleSnapshotsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "snapshot1", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account1", "pool1", "volume1", "snapshot1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -157,7 +127,7 @@ func ExampleSnapshotsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Snapshots_SingleFileRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Snapshots_SingleFileRestore.json func ExampleSnapshotsClient_BeginRestoreFiles() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -168,18 +138,11 @@ func ExampleSnapshotsClient_BeginRestoreFiles() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRestoreFiles(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "snapshot1", - armnetapp.SnapshotRestoreFiles{ - FilePaths: []*string{ - to.Ptr("/dir1/customer1.db"), - to.Ptr("/dir1/customer2.db")}, - }, - nil) + poller, err := client.BeginRestoreFiles(ctx, "myRG", "account1", "pool1", "volume1", "snapshot1", armnetapp.SnapshotRestoreFiles{ + FilePaths: []*string{ + to.Ptr("/dir1/customer1.db"), + to.Ptr("/dir1/customer2.db")}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go index de04b3449558..9cced2fc0128 100644 --- a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go @@ -58,7 +58,7 @@ func NewSubvolumesClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates a subvolume in the path or clones the subvolume mentioned in the parentPath // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -82,7 +82,7 @@ func (client *SubvolumesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a subvolume in the path or clones the subvolume mentioned in the parentPath // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SubvolumesClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, body SubvolumeInfo, options *SubvolumesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName, body, options) if err != nil { @@ -130,7 +130,7 @@ func (client *SubvolumesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -138,7 +138,7 @@ func (client *SubvolumesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Delete subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -161,7 +161,7 @@ func (client *SubvolumesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SubvolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, options *SubvolumesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName, options) if err != nil { @@ -209,14 +209,14 @@ func (client *SubvolumesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Returns the path associated with the subvolumeName provided // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -270,7 +270,7 @@ func (client *SubvolumesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +287,7 @@ func (client *SubvolumesClient) getHandleResponse(resp *http.Response) (Subvolum // BeginGetMetadata - Get details of the specified subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -311,7 +311,7 @@ func (client *SubvolumesClient) BeginGetMetadata(ctx context.Context, resourceGr // GetMetadata - Get details of the specified subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SubvolumesClient) getMetadata(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, options *SubvolumesClientBeginGetMetadataOptions) (*http.Response, error) { req, err := client.getMetadataCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName, options) if err != nil { @@ -359,15 +359,14 @@ func (client *SubvolumesClient) getMetadataCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // NewListByVolumePager - Returns a list of the subvolumes in the volume -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -429,7 +428,7 @@ func (client *SubvolumesClient) listByVolumeCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,7 +445,7 @@ func (client *SubvolumesClient) listByVolumeHandleResponse(resp *http.Response) // BeginUpdate - Patch a subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -470,7 +469,7 @@ func (client *SubvolumesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Patch a subvolume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *SubvolumesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, body SubvolumePatchRequest, options *SubvolumesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName, body, options) if err != nil { @@ -518,7 +517,7 @@ func (client *SubvolumesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go index 36213920f556..629a6c2fd149 100644 --- a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_List.json func ExampleSubvolumesClient_NewListByVolumePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,11 +28,7 @@ func ExampleSubvolumesClient_NewListByVolumePager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByVolumePager("myRG", - "account1", - "pool1", - "volume1", - nil) + pager := client.NewListByVolumePager("myRG", "account1", "pool1", "volume1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -45,7 +41,7 @@ func ExampleSubvolumesClient_NewListByVolumePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Get.json func ExampleSubvolumesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,13 +52,7 @@ func ExampleSubvolumesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "subvolume1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "pool1", "volume1", "subvolume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -70,7 +60,7 @@ func ExampleSubvolumesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Create.json func ExampleSubvolumesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,18 +71,11 @@ func ExampleSubvolumesClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "subvolume1", - armnetapp.SubvolumeInfo{ - Properties: &armnetapp.SubvolumeProperties{ - Path: to.Ptr("/subvolumePath"), - }, + poller, err := client.BeginCreate(ctx, "myRG", "account1", "pool1", "volume1", "subvolume1", armnetapp.SubvolumeInfo{ + Properties: &armnetapp.SubvolumeProperties{ + Path: to.Ptr("/subvolumePath"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -104,7 +87,7 @@ func ExampleSubvolumesClient_BeginCreate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Update.json func ExampleSubvolumesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -115,18 +98,11 @@ func ExampleSubvolumesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "subvolume1", - armnetapp.SubvolumePatchRequest{ - Properties: &armnetapp.SubvolumePatchParams{ - Path: to.Ptr("/subvolumePath"), - }, + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", "subvolume1", armnetapp.SubvolumePatchRequest{ + Properties: &armnetapp.SubvolumePatchParams{ + Path: to.Ptr("/subvolumePath"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -138,7 +114,7 @@ func ExampleSubvolumesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Delete.json func ExampleSubvolumesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -149,13 +125,7 @@ func ExampleSubvolumesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "subvolume1", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account1", "pool1", "volume1", "subvolume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -165,7 +135,7 @@ func ExampleSubvolumesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Subvolumes_Metadata.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Subvolumes_Metadata.json func ExampleSubvolumesClient_BeginGetMetadata() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -176,13 +146,7 @@ func ExampleSubvolumesClient_BeginGetMetadata() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginGetMetadata(ctx, - "myRG", - "account1", - "pool1", - "volume1", - "subvolume1", - nil) + poller, err := client.BeginGetMetadata(ctx, "myRG", "account1", "pool1", "volume1", "subvolume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/vaults_client.go b/sdk/resourcemanager/netapp/armnetapp/vaults_client.go index 997aaf42c29a..99128354a66c 100644 --- a/sdk/resourcemanager/netapp/armnetapp/vaults_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/vaults_client.go @@ -57,8 +57,7 @@ func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, o } // NewListPager - List vaults for a Netapp Account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - VaultsClientListOptions contains the optional parameters for the VaultsClient.List method. @@ -104,7 +103,7 @@ func (client *VaultsClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/vaults_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/vaults_client_example_test.go index 576e5e08985e..9ef6f8fdde9d 100644 --- a/sdk/resourcemanager/netapp/armnetapp/vaults_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/vaults_client_example_test.go @@ -13,10 +13,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Vaults_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Vaults_List.json func ExampleVaultsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,9 +27,7 @@ func ExampleVaultsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - nil) + pager := client.NewListPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go index 2bc7301f55c4..ea2512698938 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go @@ -58,7 +58,7 @@ func NewVolumeGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Create a volume group along with specified volumes // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // volumeGroupName - The name of the volumeGroup @@ -79,7 +79,7 @@ func (client *VolumeGroupsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Create a volume group along with specified volumes // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumeGroupsClient) create(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, body VolumeGroupDetails, options *VolumeGroupsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, volumeGroupName, body, options) if err != nil { @@ -119,7 +119,7 @@ func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -127,7 +127,7 @@ func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Delete the specified volume group only if there are no volumes under volume group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // volumeGroupName - The name of the volumeGroup @@ -147,7 +147,7 @@ func (client *VolumeGroupsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete the specified volume group only if there are no volumes under volume group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumeGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, volumeGroupName, options) if err != nil { @@ -187,14 +187,14 @@ func (client *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get details of the specified volume group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // volumeGroupName - The name of the volumeGroup @@ -238,7 +238,7 @@ func (client *VolumeGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +254,7 @@ func (client *VolumeGroupsClient) getHandleResponse(resp *http.Response) (Volume } // NewListByNetAppAccountPager - List all volume groups for given account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // options - VolumeGroupsClientListByNetAppAccountOptions contains the optional parameters for the VolumeGroupsClient.ListByNetAppAccount @@ -302,7 +301,7 @@ func (client *VolumeGroupsClient) listByNetAppAccountCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go index cd6cf624f606..7b8cceacaa36 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeGroups_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_List.json func ExampleVolumeGroupsClient_NewListByNetAppAccountPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleVolumeGroupsClient_NewListByNetAppAccountPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByNetAppAccountPager("myRG", - "account1", - nil) + pager := client.NewListByNetAppAccountPager("myRG", "account1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleVolumeGroupsClient_NewListByNetAppAccountPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeGroups_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Get.json func ExampleVolumeGroupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleVolumeGroupsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "group1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "group1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleVolumeGroupsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeGroups_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Create.json func ExampleVolumeGroupsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,62 +71,57 @@ func ExampleVolumeGroupsClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account1", - "group1", - armnetapp.VolumeGroupDetails{ - Location: to.Ptr("westus"), - Properties: &armnetapp.VolumeGroupProperties{ - GroupMetaData: &armnetapp.VolumeGroupMetaData{ - ApplicationIdentifier: to.Ptr("DEV"), - ApplicationType: to.Ptr(armnetapp.ApplicationTypeSAPHANA), - DeploymentSpecID: to.Ptr("fb04dbeb-005d-2703-197e-6208dfadb5d9"), - GroupDescription: to.Ptr("Volume group"), + poller, err := client.BeginCreate(ctx, "myRG", "account1", "group1", armnetapp.VolumeGroupDetails{ + Location: to.Ptr("westus"), + Properties: &armnetapp.VolumeGroupProperties{ + GroupMetaData: &armnetapp.VolumeGroupMetaData{ + ApplicationIdentifier: to.Ptr("DEV"), + ApplicationType: to.Ptr(armnetapp.ApplicationTypeSAPHANA), + DeploymentSpecID: to.Ptr("fb04dbeb-005d-2703-197e-6208dfadb5d9"), + GroupDescription: to.Ptr("Volume group"), + }, + Volumes: []*armnetapp.VolumeGroupVolumeProperties{ + { + Name: to.Ptr("testVol1"), + Properties: &armnetapp.VolumeProperties{ + CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), + CreationToken: to.Ptr("testVol1"), + ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + ThroughputMibps: to.Ptr[float32](10), + UsageThreshold: to.Ptr[int64](107374182400), + VolumeSpecName: to.Ptr("data"), + }, }, - Volumes: []*armnetapp.VolumeGroupVolumeProperties{ - { - Name: to.Ptr("testVol1"), - Properties: &armnetapp.VolumeProperties{ - CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), - CreationToken: to.Ptr("testVol1"), - ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - ThroughputMibps: to.Ptr[float32](10), - UsageThreshold: to.Ptr[int64](107374182400), - VolumeSpecName: to.Ptr("data"), - }, + { + Name: to.Ptr("testVol2"), + Properties: &armnetapp.VolumeProperties{ + CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), + CreationToken: to.Ptr("testVol2"), + ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + ThroughputMibps: to.Ptr[float32](10), + UsageThreshold: to.Ptr[int64](107374182400), + VolumeSpecName: to.Ptr("log"), }, - { - Name: to.Ptr("testVol2"), - Properties: &armnetapp.VolumeProperties{ - CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), - CreationToken: to.Ptr("testVol2"), - ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - ThroughputMibps: to.Ptr[float32](10), - UsageThreshold: to.Ptr[int64](107374182400), - VolumeSpecName: to.Ptr("log"), - }, + }, + { + Name: to.Ptr("testVol3"), + Properties: &armnetapp.VolumeProperties{ + CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), + CreationToken: to.Ptr("testVol3"), + ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + ThroughputMibps: to.Ptr[float32](10), + UsageThreshold: to.Ptr[int64](107374182400), + VolumeSpecName: to.Ptr("shared"), }, - { - Name: to.Ptr("testVol3"), - Properties: &armnetapp.VolumeProperties{ - CapacityPoolResourceID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), - CreationToken: to.Ptr("testVol3"), - ProximityPlacementGroup: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/cys_sjain_fcp_rg/providers/Microsoft.Compute/proximityPlacementGroups/svlqa_sjain_multivolume_ppg"), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - SubnetID: to.Ptr("/subscriptions/d633cc2e-722b-4ae1-b636-bbd9e4c60ed9/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - ThroughputMibps: to.Ptr[float32](10), - UsageThreshold: to.Ptr[int64](107374182400), - VolumeSpecName: to.Ptr("shared"), - }, - }}, - }, + }}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -142,7 +131,7 @@ func ExampleVolumeGroupsClient_BeginCreate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeGroups_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeGroups_Delete.json func ExampleVolumeGroupsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -153,11 +142,7 @@ func ExampleVolumeGroupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - "group1", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account1", "group1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go index 34a60848b434..2f4e51d26ae4 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go @@ -58,7 +58,7 @@ func NewVolumeQuotaRulesClient(subscriptionID string, credential azcore.TokenCre // BeginCreate - Create the specified quota rule within the given volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -83,7 +83,7 @@ func (client *VolumeQuotaRulesClient) BeginCreate(ctx context.Context, resourceG // Create - Create the specified quota rule within the given volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumeQuotaRulesClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, body VolumeQuotaRule, options *VolumeQuotaRulesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, body, options) if err != nil { @@ -131,7 +131,7 @@ func (client *VolumeQuotaRulesClient) createCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -139,7 +139,7 @@ func (client *VolumeQuotaRulesClient) createCreateRequest(ctx context.Context, r // BeginDelete - Delete quota rule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -163,7 +163,7 @@ func (client *VolumeQuotaRulesClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete quota rule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumeQuotaRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, options *VolumeQuotaRulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, options) if err != nil { @@ -211,14 +211,14 @@ func (client *VolumeQuotaRulesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get details of the specified quota rule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -272,7 +272,7 @@ func (client *VolumeQuotaRulesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -288,8 +288,7 @@ func (client *VolumeQuotaRulesClient) getHandleResponse(resp *http.Response) (Vo } // NewListByVolumePager - List all quota rules associated with the volume -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -346,7 +345,7 @@ func (client *VolumeQuotaRulesClient) listByVolumeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -363,7 +362,7 @@ func (client *VolumeQuotaRulesClient) listByVolumeHandleResponse(resp *http.Resp // BeginUpdate - Patch a quota rule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -388,7 +387,7 @@ func (client *VolumeQuotaRulesClient) BeginUpdate(ctx context.Context, resourceG // Update - Patch a quota rule // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumeQuotaRulesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, body VolumeQuotaRulePatch, options *VolumeQuotaRulesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, body, options) if err != nil { @@ -436,7 +435,7 @@ func (client *VolumeQuotaRulesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go index 478710e559d7..9927b5d40278 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeQuotaRules_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_List.json func ExampleVolumeQuotaRulesClient_NewListByVolumePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,11 +28,7 @@ func ExampleVolumeQuotaRulesClient_NewListByVolumePager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByVolumePager("myRG", - "account-9957", - "pool-5210", - "volume-6387", - nil) + pager := client.NewListByVolumePager("myRG", "account-9957", "pool-5210", "volume-6387", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -45,7 +41,7 @@ func ExampleVolumeQuotaRulesClient_NewListByVolumePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeQuotaRules_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Get.json func ExampleVolumeQuotaRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,13 +52,7 @@ func ExampleVolumeQuotaRulesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account-9957", - "pool-5210", - "volume-6387", - "rule-0004", - nil) + res, err := client.Get(ctx, "myRG", "account-9957", "pool-5210", "volume-6387", "rule-0004", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -70,7 +60,7 @@ func ExampleVolumeQuotaRulesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeQuotaRules_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Create.json func ExampleVolumeQuotaRulesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,21 +71,14 @@ func ExampleVolumeQuotaRulesClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreate(ctx, - "myRG", - "account-9957", - "pool-5210", - "volume-6387", - "rule-0004", - armnetapp.VolumeQuotaRule{ - Location: to.Ptr("westus"), - Properties: &armnetapp.VolumeQuotaRulesProperties{ - QuotaSizeInKiBs: to.Ptr[int64](100005), - QuotaTarget: to.Ptr("1821"), - QuotaType: to.Ptr(armnetapp.TypeIndividualUserQuota), - }, + poller, err := client.BeginCreate(ctx, "myRG", "account-9957", "pool-5210", "volume-6387", "rule-0004", armnetapp.VolumeQuotaRule{ + Location: to.Ptr("westus"), + Properties: &armnetapp.VolumeQuotaRulesProperties{ + QuotaSizeInKiBs: to.Ptr[int64](100005), + QuotaTarget: to.Ptr("1821"), + QuotaType: to.Ptr(armnetapp.TypeIndividualUserQuota), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -107,7 +90,7 @@ func ExampleVolumeQuotaRulesClient_BeginCreate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeQuotaRules_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Update.json func ExampleVolumeQuotaRulesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,18 +101,11 @@ func ExampleVolumeQuotaRulesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account-9957", - "pool-5210", - "volume-6387", - "rule-0004", - armnetapp.VolumeQuotaRulePatch{ - Properties: &armnetapp.VolumeQuotaRulesProperties{ - QuotaSizeInKiBs: to.Ptr[int64](100009), - }, + poller, err := client.BeginUpdate(ctx, "myRG", "account-9957", "pool-5210", "volume-6387", "rule-0004", armnetapp.VolumeQuotaRulePatch{ + Properties: &armnetapp.VolumeQuotaRulesProperties{ + QuotaSizeInKiBs: to.Ptr[int64](100009), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -141,7 +117,7 @@ func ExampleVolumeQuotaRulesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/VolumeQuotaRules_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/VolumeQuotaRules_Delete.json func ExampleVolumeQuotaRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,13 +128,7 @@ func ExampleVolumeQuotaRulesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account-9957", - "pool-5210", - "volume-6387", - "rule-0004", - nil) + poller, err := client.BeginDelete(ctx, "myRG", "account-9957", "pool-5210", "volume-6387", "rule-0004", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/netapp/armnetapp/volumes_client.go b/sdk/resourcemanager/netapp/armnetapp/volumes_client.go index 0284d596bebc..3424e1660335 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumes_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumes_client.go @@ -59,7 +59,7 @@ func NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, // BeginAuthorizeReplication - Authorize the replication connection on the source volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -83,7 +83,7 @@ func (client *VolumesClient) BeginAuthorizeReplication(ctx context.Context, reso // AuthorizeReplication - Authorize the replication connection on the source volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) authorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest, options *VolumesClientBeginAuthorizeReplicationOptions) (*http.Response, error) { req, err := client.authorizeReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -127,14 +127,14 @@ func (client *VolumesClient) authorizeReplicationCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, body) } // BeginBreakReplication - Break the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -157,7 +157,7 @@ func (client *VolumesClient) BeginBreakReplication(ctx context.Context, resource // BreakReplication - Break the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) breakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginBreakReplicationOptions) (*http.Response, error) { req, err := client.breakReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -201,7 +201,7 @@ func (client *VolumesClient) breakReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.Body != nil { return req, runtime.MarshalAsJSON(req, *options.Body) @@ -211,7 +211,7 @@ func (client *VolumesClient) breakReplicationCreateRequest(ctx context.Context, // BeginCreateOrUpdate - Create or update the specified volume within the capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -235,7 +235,7 @@ func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Create or update the specified volume within the capacity pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body Volume, options *VolumesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -279,7 +279,7 @@ func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -287,7 +287,7 @@ func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Delete the specified volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -309,7 +309,7 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete the specified volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -356,14 +356,14 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGr if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginDeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -386,7 +386,7 @@ func (client *VolumesClient) BeginDeleteReplication(ctx context.Context, resourc // DeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) deleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginDeleteReplicationOptions) (*http.Response, error) { req, err := client.deleteReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -430,14 +430,14 @@ func (client *VolumesClient) deleteReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginFinalizeRelocation - Finalizes the relocation of the volume and cleans up the old volume. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -458,7 +458,7 @@ func (client *VolumesClient) BeginFinalizeRelocation(ctx context.Context, resour // FinalizeRelocation - Finalizes the relocation of the volume and cleans up the old volume. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) finalizeRelocation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginFinalizeRelocationOptions) (*http.Response, error) { req, err := client.finalizeRelocationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -502,14 +502,14 @@ func (client *VolumesClient) finalizeRelocationCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Get the details of the specified volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -558,7 +558,7 @@ func (client *VolumesClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -574,8 +574,7 @@ func (client *VolumesClient) getHandleResponse(resp *http.Response) (VolumesClie } // NewListPager - List all volumes within the capacity pool -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -632,7 +631,7 @@ func (client *VolumesClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -648,8 +647,7 @@ func (client *VolumesClient) listHandleResponse(resp *http.Response) (VolumesCli } // NewListReplicationsPager - List all replications for a specified volume -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -706,7 +704,7 @@ func (client *VolumesClient) listReplicationsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -723,7 +721,7 @@ func (client *VolumesClient) listReplicationsHandleResponse(resp *http.Response) // BeginPoolChange - Moves volume to another pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -746,7 +744,7 @@ func (client *VolumesClient) BeginPoolChange(ctx context.Context, resourceGroupN // PoolChange - Moves volume to another pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) poolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest, options *VolumesClientBeginPoolChangeOptions) (*http.Response, error) { req, err := client.poolChangeCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -790,14 +788,14 @@ func (client *VolumesClient) poolChangeCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, body) } // BeginReInitializeReplication - Re-Initializes the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -820,7 +818,7 @@ func (client *VolumesClient) BeginReInitializeReplication(ctx context.Context, r // ReInitializeReplication - Re-Initializes the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) reInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginReInitializeReplicationOptions) (*http.Response, error) { req, err := client.reInitializeReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -864,7 +862,7 @@ func (client *VolumesClient) reInitializeReplicationCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -872,7 +870,7 @@ func (client *VolumesClient) reInitializeReplicationCreateRequest(ctx context.Co // BeginReestablishReplication - Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc // or policy-based snapshots // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -897,7 +895,7 @@ func (client *VolumesClient) BeginReestablishReplication(ctx context.Context, re // ReestablishReplication - Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based // snapshots // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) reestablishReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body ReestablishReplicationRequest, options *VolumesClientBeginReestablishReplicationOptions) (*http.Response, error) { req, err := client.reestablishReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -941,14 +939,14 @@ func (client *VolumesClient) reestablishReplicationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, body) } // BeginRelocate - Relocates volume to a new stamp // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -968,7 +966,7 @@ func (client *VolumesClient) BeginRelocate(ctx context.Context, resourceGroupNam // Relocate - Relocates volume to a new stamp // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) relocate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginRelocateOptions) (*http.Response, error) { req, err := client.relocateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -1012,14 +1010,17 @@ func (client *VolumesClient) relocateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } return req, nil } // ReplicationStatus - Get the status of the replication // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1069,7 +1070,7 @@ func (client *VolumesClient) replicationStatusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1086,7 +1087,7 @@ func (client *VolumesClient) replicationStatusHandleResponse(resp *http.Response // BeginResetCifsPassword - Reset cifs password from volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1107,7 +1108,7 @@ func (client *VolumesClient) BeginResetCifsPassword(ctx context.Context, resourc // ResetCifsPassword - Reset cifs password from volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) resetCifsPassword(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginResetCifsPasswordOptions) (*http.Response, error) { req, err := client.resetCifsPasswordCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -1151,7 +1152,7 @@ func (client *VolumesClient) resetCifsPasswordCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1159,7 +1160,7 @@ func (client *VolumesClient) resetCifsPasswordCreateRequest(ctx context.Context, // BeginResyncReplication - Resync the connection on the destination volume. If the operation is ran on the source volume // it will reverse-resync the connection and sync from destination to source. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1183,7 +1184,7 @@ func (client *VolumesClient) BeginResyncReplication(ctx context.Context, resourc // ResyncReplication - Resync the connection on the destination volume. If the operation is ran on the source volume it will // reverse-resync the connection and sync from destination to source. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) resyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginResyncReplicationOptions) (*http.Response, error) { req, err := client.resyncReplicationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -1227,14 +1228,14 @@ func (client *VolumesClient) resyncReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginRevert - Revert a volume to the snapshot specified in the body // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1257,7 +1258,7 @@ func (client *VolumesClient) BeginRevert(ctx context.Context, resourceGroupName // Revert - Revert a volume to the snapshot specified in the body // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert, options *VolumesClientBeginRevertOptions) (*http.Response, error) { req, err := client.revertCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -1301,7 +1302,7 @@ func (client *VolumesClient) revertCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, body) } @@ -1309,7 +1310,7 @@ func (client *VolumesClient) revertCreateRequest(ctx context.Context, resourceGr // BeginRevertRelocation - Reverts the volume relocation process, cleans up the new volume and starts using the former-existing // volume. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1331,7 +1332,7 @@ func (client *VolumesClient) BeginRevertRelocation(ctx context.Context, resource // RevertRelocation - Reverts the volume relocation process, cleans up the new volume and starts using the former-existing // volume. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) revertRelocation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginRevertRelocationOptions) (*http.Response, error) { req, err := client.revertRelocationCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) if err != nil { @@ -1375,14 +1376,14 @@ func (client *VolumesClient) revertRelocationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginUpdate - Patch the specified volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 // resourceGroupName - The name of the resource group. // accountName - The name of the NetApp account // poolName - The name of the capacity pool @@ -1405,7 +1406,7 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch the specified volume // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// Generated from API version 2022-05-01 func (client *VolumesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumePatch, options *VolumesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) if err != nil { @@ -1449,7 +1450,7 @@ func (client *VolumesClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go index 7a163b49df8d..bd928ef42d61 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go @@ -14,10 +14,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_List.json func ExampleVolumesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleVolumesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRG", - "account1", - "pool1", - nil) + pager := client.NewListPager("myRG", "account1", "pool1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,7 +41,7 @@ func ExampleVolumesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Get.json func ExampleVolumesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,12 +52,7 @@ func ExampleVolumesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + res, err := client.Get(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +60,7 @@ func ExampleVolumesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_CreateOrUpdate.json func ExampleVolumesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,23 +71,17 @@ func ExampleVolumesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.Volume{ - Location: to.Ptr("eastus"), - Properties: &armnetapp.VolumeProperties{ - CreationToken: to.Ptr("my-unique-file-path"), - EncryptionKeySource: to.Ptr(armnetapp.EncryptionKeySourceMicrosoftKeyVault), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - ThroughputMibps: to.Ptr[float32](128), - UsageThreshold: to.Ptr[int64](107374182400), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.Volume{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.VolumeProperties{ + CreationToken: to.Ptr("my-unique-file-path"), + EncryptionKeySource: to.Ptr(armnetapp.EncryptionKeySourceMicrosoftKeyVault), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + ThroughputMibps: to.Ptr[float32](128), + UsageThreshold: to.Ptr[int64](107374182400), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -107,7 +93,7 @@ func ExampleVolumesClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Update.json func ExampleVolumesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,13 +104,7 @@ func ExampleVolumesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.VolumePatch{}, - nil) + poller, err := client.BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.VolumePatch{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -136,7 +116,7 @@ func ExampleVolumesClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Delete.json func ExampleVolumesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -147,12 +127,7 @@ func ExampleVolumesClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "myRG", - "account1", - "pool1", - "volume1", - &armnetapp.VolumesClientBeginDeleteOptions{ForceDelete: nil}) + poller, err := client.BeginDelete(ctx, "myRG", "account1", "pool1", "volume1", &armnetapp.VolumesClientBeginDeleteOptions{ForceDelete: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -162,7 +137,7 @@ func ExampleVolumesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_Revert.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Revert.json func ExampleVolumesClient_BeginRevert() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -173,15 +148,9 @@ func ExampleVolumesClient_BeginRevert() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRevert(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.VolumeRevert{ - SnapshotID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1"), - }, - nil) + poller, err := client.BeginRevert(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.VolumeRevert{ + SnapshotID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -191,7 +160,7 @@ func ExampleVolumesClient_BeginRevert() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ResetCifsPassword.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ResetCifsPassword.json func ExampleVolumesClient_BeginResetCifsPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -202,12 +171,7 @@ func ExampleVolumesClient_BeginResetCifsPassword() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResetCifsPassword(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginResetCifsPassword(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -217,7 +181,7 @@ func ExampleVolumesClient_BeginResetCifsPassword() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_BreakReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_BreakReplication.json func ExampleVolumesClient_BeginBreakReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -228,15 +192,10 @@ func ExampleVolumesClient_BeginBreakReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginBreakReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - &armnetapp.VolumesClientBeginBreakReplicationOptions{Body: &armnetapp.BreakReplicationRequest{ - ForceBreakReplication: to.Ptr(false), - }, - }) + poller, err := client.BeginBreakReplication(ctx, "myRG", "account1", "pool1", "volume1", &armnetapp.VolumesClientBeginBreakReplicationOptions{Body: &armnetapp.BreakReplicationRequest{ + ForceBreakReplication: to.Ptr(false), + }, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -246,7 +205,7 @@ func ExampleVolumesClient_BeginBreakReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ReestablishReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReestablishReplication.json func ExampleVolumesClient_BeginReestablishReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -257,15 +216,9 @@ func ExampleVolumesClient_BeginReestablishReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginReestablishReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.ReestablishReplicationRequest{ - SourceVolumeID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/mySourceRG/providers/Microsoft.NetApp/netAppAccounts/sourceAccount1/capacityPools/sourcePool1/volumes/sourceVolume1"), - }, - nil) + poller, err := client.BeginReestablishReplication(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.ReestablishReplicationRequest{ + SourceVolumeID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/mySourceRG/providers/Microsoft.NetApp/netAppAccounts/sourceAccount1/capacityPools/sourcePool1/volumes/sourceVolume1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -275,7 +228,7 @@ func ExampleVolumesClient_BeginReestablishReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ReplicationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReplicationStatus.json func ExampleVolumesClient_ReplicationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -286,12 +239,7 @@ func ExampleVolumesClient_ReplicationStatus() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ReplicationStatus(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + res, err := client.ReplicationStatus(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -299,7 +247,7 @@ func ExampleVolumesClient_ReplicationStatus() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ListReplications.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ListReplications.json func ExampleVolumesClient_NewListReplicationsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -310,11 +258,7 @@ func ExampleVolumesClient_NewListReplicationsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListReplicationsPager("myRG", - "account1", - "pool1", - "volume1", - nil) + pager := client.NewListReplicationsPager("myRG", "account1", "pool1", "volume1", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -327,7 +271,7 @@ func ExampleVolumesClient_NewListReplicationsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ResyncReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ResyncReplication.json func ExampleVolumesClient_BeginResyncReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -338,12 +282,7 @@ func ExampleVolumesClient_BeginResyncReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginResyncReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginResyncReplication(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -353,7 +292,7 @@ func ExampleVolumesClient_BeginResyncReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_DeleteReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_DeleteReplication.json func ExampleVolumesClient_BeginDeleteReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -364,12 +303,7 @@ func ExampleVolumesClient_BeginDeleteReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDeleteReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginDeleteReplication(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -379,7 +313,7 @@ func ExampleVolumesClient_BeginDeleteReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_AuthorizeReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_AuthorizeReplication.json func ExampleVolumesClient_BeginAuthorizeReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -390,15 +324,9 @@ func ExampleVolumesClient_BeginAuthorizeReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginAuthorizeReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.AuthorizeRequest{ - RemoteVolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRemoteRG/providers/Microsoft.NetApp/netAppAccounts/remoteAccount1/capacityPools/remotePool1/volumes/remoteVolume1"), - }, - nil) + poller, err := client.BeginAuthorizeReplication(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.AuthorizeRequest{ + RemoteVolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRemoteRG/providers/Microsoft.NetApp/netAppAccounts/remoteAccount1/capacityPools/remotePool1/volumes/remoteVolume1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -408,7 +336,7 @@ func ExampleVolumesClient_BeginAuthorizeReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_ReInitializeReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_ReInitializeReplication.json func ExampleVolumesClient_BeginReInitializeReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -419,12 +347,7 @@ func ExampleVolumesClient_BeginReInitializeReplication() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginReInitializeReplication(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginReInitializeReplication(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -434,7 +357,7 @@ func ExampleVolumesClient_BeginReInitializeReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_PoolChange.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_PoolChange.json func ExampleVolumesClient_BeginPoolChange() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -445,15 +368,9 @@ func ExampleVolumesClient_BeginPoolChange() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPoolChange(ctx, - "myRG", - "account1", - "pool1", - "volume1", - armnetapp.PoolChangeRequest{ - NewPoolResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), - }, - nil) + poller, err := client.BeginPoolChange(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.PoolChangeRequest{ + NewPoolResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -463,7 +380,7 @@ func ExampleVolumesClient_BeginPoolChange() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_Relocate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Relocate.json func ExampleVolumesClient_BeginRelocate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -474,12 +391,7 @@ func ExampleVolumesClient_BeginRelocate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRelocate(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginRelocate(ctx, "myRG", "account1", "pool1", "volume1", &armnetapp.VolumesClientBeginRelocateOptions{Body: &armnetapp.RelocateVolumeRequest{}}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -489,7 +401,7 @@ func ExampleVolumesClient_BeginRelocate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_FinalizeRelocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_FinalizeRelocation.json func ExampleVolumesClient_BeginFinalizeRelocation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -500,12 +412,7 @@ func ExampleVolumesClient_BeginFinalizeRelocation() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginFinalizeRelocation(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginFinalizeRelocation(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -515,7 +422,7 @@ func ExampleVolumesClient_BeginFinalizeRelocation() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-03-01/examples/Volumes_RevertRelocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_RevertRelocation.json func ExampleVolumesClient_BeginRevertRelocation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -526,12 +433,7 @@ func ExampleVolumesClient_BeginRevertRelocation() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginRevertRelocation(ctx, - "myRG", - "account1", - "pool1", - "volume1", - nil) + poller, err := client.BeginRevertRelocation(ctx, "myRG", "account1", "pool1", "volume1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/reservations/armreservations/CHANGELOG.md b/sdk/resourcemanager/reservations/armreservations/CHANGELOG.md index c47ad513fc59..5ca7d6a3d111 100644 --- a/sdk/resourcemanager/reservations/armreservations/CHANGELOG.md +++ b/sdk/resourcemanager/reservations/armreservations/CHANGELOG.md @@ -1,5 +1,39 @@ # Release History +## 1.1.0 (2022-09-16) +### Features Added + +- New const `ErrorResponseCodeRefundLimitExceeded` +- New const `ErrorResponseCodeSelfServiceRefundNotSupported` +- New function `*ReservationClient.Archive(context.Context, string, string, *ReservationClientArchiveOptions) (ReservationClientArchiveResponse, error)` +- New function `NewCalculateRefundClient(azcore.TokenCredential, *arm.ClientOptions) (*CalculateRefundClient, error)` +- New function `*CalculateRefundClient.Post(context.Context, string, CalculateRefundRequest, *CalculateRefundClientPostOptions) (CalculateRefundClientPostResponse, error)` +- New function `*ReservationClient.Unarchive(context.Context, string, string, *ReservationClientUnarchiveOptions) (ReservationClientUnarchiveResponse, error)` +- New function `NewReturnClient(azcore.TokenCredential, *arm.ClientOptions) (*ReturnClient, error)` +- New function `*ReturnClient.Post(context.Context, string, RefundRequest, *ReturnClientPostOptions) (ReturnClientPostResponse, error)` +- New struct `CalculateRefundClient` +- New struct `CalculateRefundClientPostOptions` +- New struct `CalculateRefundClientPostResponse` +- New struct `CalculateRefundRequest` +- New struct `CalculateRefundRequestProperties` +- New struct `CalculateRefundResponse` +- New struct `RefundBillingInformation` +- New struct `RefundPolicyError` +- New struct `RefundPolicyResult` +- New struct `RefundPolicyResultProperty` +- New struct `RefundRequest` +- New struct `RefundRequestProperties` +- New struct `RefundResponse` +- New struct `RefundResponseProperties` +- New struct `ReservationClientArchiveOptions` +- New struct `ReservationClientArchiveResponse` +- New struct `ReservationClientUnarchiveOptions` +- New struct `ReservationClientUnarchiveResponse` +- New struct `ReturnClient` +- New struct `ReturnClientPostOptions` +- New struct `ReturnClientPostResponse` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/reservations/armreservations/autorest.md b/sdk/resourcemanager/reservations/armreservations/autorest.md index c4dfd5bfa804..618f8033fa82 100644 --- a/sdk/resourcemanager/reservations/armreservations/autorest.md +++ b/sdk/resourcemanager/reservations/armreservations/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/reservations/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/reservations/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/0507c3d410681049bb5cd9545b49a7578a91d3d0/specification/reservations/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/0507c3d410681049bb5cd9545b49a7578a91d3d0/specification/reservations/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_azurereservationapi_client.go b/sdk/resourcemanager/reservations/armreservations/azurereservationapi_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_azurereservationapi_client.go rename to sdk/resourcemanager/reservations/armreservations/azurereservationapi_client.go index 6da6bed59ee1..3f2e6950939e 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_azurereservationapi_client.go +++ b/sdk/resourcemanager/reservations/armreservations/azurereservationapi_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_azurereservationapi_client_test.go b/sdk/resourcemanager/reservations/armreservations/azurereservationapi_client_example_test.go similarity index 83% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_azurereservationapi_client_test.go rename to sdk/resourcemanager/reservations/armreservations/azurereservationapi_client_example_test.go index cb76cb7d2d03..b44945c929bf 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_azurereservationapi_client_test.go +++ b/sdk/resourcemanager/reservations/armreservations/azurereservationapi_client_example_test.go @@ -28,14 +28,12 @@ func ExampleAzureReservationAPIClient_GetCatalog() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetCatalog(ctx, - "23bc208b-083f-4901-ae85-4f98c0c3b4b6", - &armreservations.AzureReservationAPIClientGetCatalogOptions{ReservedResourceType: to.Ptr("VirtualMachines"), - Location: to.Ptr("eastus"), - PublisherID: nil, - OfferID: nil, - PlanID: nil, - }) + res, err := client.GetCatalog(ctx, "23bc208b-083f-4901-ae85-4f98c0c3b4b6", &armreservations.AzureReservationAPIClientGetCatalogOptions{ReservedResourceType: to.Ptr("VirtualMachines"), + Location: to.Ptr("eastus"), + PublisherID: nil, + OfferID: nil, + PlanID: nil, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -54,9 +52,7 @@ func ExampleAzureReservationAPIClient_GetAppliedReservationList() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetAppliedReservationList(ctx, - "23bc208b-083f-4901-ae85-4f98c0c3b4b6", - nil) + res, err := client.GetAppliedReservationList(ctx, "23bc208b-083f-4901-ae85-4f98c0c3b4b6", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_calculateexchange_client.go b/sdk/resourcemanager/reservations/armreservations/calculateexchange_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_calculateexchange_client.go rename to sdk/resourcemanager/reservations/armreservations/calculateexchange_client.go index 625bd89681ec..8bc2907980a0 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_calculateexchange_client.go +++ b/sdk/resourcemanager/reservations/armreservations/calculateexchange_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations diff --git a/sdk/resourcemanager/reservations/armreservations/calculateexchange_client_example_test.go b/sdk/resourcemanager/reservations/armreservations/calculateexchange_client_example_test.go new file mode 100644 index 000000000000..d3dbfd6bbf4e --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/calculateexchange_client_example_test.go @@ -0,0 +1,69 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armreservations_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateExchange.json +func ExampleCalculateExchangeClient_BeginPost() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewCalculateExchangeClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginPost(ctx, armreservations.CalculateExchangeRequest{ + Properties: &armreservations.CalculateExchangeRequestProperties{ + ReservationsToExchange: []*armreservations.ReservationToReturn{ + { + Quantity: to.Ptr[int32](1), + ReservationID: to.Ptr("/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6"), + }}, + ReservationsToPurchase: []*armreservations.PurchaseRequest{ + { + Location: to.Ptr("westus"), + Properties: &armreservations.PurchaseRequestProperties{ + AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), + BillingPlan: to.Ptr(armreservations.ReservationBillingPlanUpfront), + BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), + DisplayName: to.Ptr("testDisplayName"), + Quantity: to.Ptr[int32](1), + Renew: to.Ptr(false), + ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ + InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), + }, + ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), + Term: to.Ptr(armreservations.ReservationTermP1Y), + }, + SKU: &armreservations.SKUName{ + Name: to.Ptr("Standard_B1ls"), + }, + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/reservations/armreservations/calculaterefund_client.go b/sdk/resourcemanager/reservations/armreservations/calculaterefund_client.go new file mode 100644 index 000000000000..b095ae5fcb34 --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/calculaterefund_client.go @@ -0,0 +1,101 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armreservations + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CalculateRefundClient contains the methods for the CalculateRefund group. +// Don't use this type directly, use NewCalculateRefundClient() instead. +type CalculateRefundClient struct { + host string + pl runtime.Pipeline +} + +// NewCalculateRefundClient creates a new instance of CalculateRefundClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCalculateRefundClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CalculateRefundClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CalculateRefundClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// Post - Calculate price for returning Reservations if there are no policy errors. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-01 +// reservationOrderID - Order Id of the reservation +// body - Information needed for calculating refund of a reservation. +// options - CalculateRefundClientPostOptions contains the optional parameters for the CalculateRefundClient.Post method. +func (client *CalculateRefundClient) Post(ctx context.Context, reservationOrderID string, body CalculateRefundRequest, options *CalculateRefundClientPostOptions) (CalculateRefundClientPostResponse, error) { + req, err := client.postCreateRequest(ctx, reservationOrderID, body, options) + if err != nil { + return CalculateRefundClientPostResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CalculateRefundClientPostResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CalculateRefundClientPostResponse{}, runtime.NewResponseError(resp) + } + return client.postHandleResponse(resp) +} + +// postCreateRequest creates the Post request. +func (client *CalculateRefundClient) postCreateRequest(ctx context.Context, reservationOrderID string, body CalculateRefundRequest, options *CalculateRefundClientPostOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/calculateRefund" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, body) +} + +// postHandleResponse handles the Post response. +func (client *CalculateRefundClient) postHandleResponse(resp *http.Response) (CalculateRefundClientPostResponse, error) { + result := CalculateRefundClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CalculateRefundResponse); err != nil { + return CalculateRefundClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/reservations/armreservations/calculaterefund_client_example_test.go b/sdk/resourcemanager/reservations/armreservations/calculaterefund_client_example_test.go new file mode 100644 index 000000000000..752dd02e1daa --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/calculaterefund_client_example_test.go @@ -0,0 +1,46 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armreservations_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateRefund.json +func ExampleCalculateRefundClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewCalculateRefundClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", armreservations.CalculateRefundRequest{ + ID: to.Ptr("/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004"), + Properties: &armreservations.CalculateRefundRequestProperties{ + ReservationToReturn: &armreservations.ReservationToReturn{ + Quantity: to.Ptr[int32](1), + ReservationID: to.Ptr("/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000"), + }, + Scope: to.Ptr("Reservation"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_constants.go b/sdk/resourcemanager/reservations/armreservations/constants.go similarity index 98% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_constants.go rename to sdk/resourcemanager/reservations/armreservations/constants.go index 7b93946e5087..5c6ee01bc836 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_constants.go +++ b/sdk/resourcemanager/reservations/armreservations/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations const ( moduleName = "armreservations" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // AppliedScopeType - Type of the Applied Scope. @@ -144,6 +145,7 @@ const ( ErrorResponseCodePaymentInstrumentNotFound ErrorResponseCode = "PaymentInstrumentNotFound" ErrorResponseCodePurchaseError ErrorResponseCode = "PurchaseError" ErrorResponseCodeReRateOnlyAllowedForEA ErrorResponseCode = "ReRateOnlyAllowedForEA" + ErrorResponseCodeRefundLimitExceeded ErrorResponseCode = "RefundLimitExceeded" ErrorResponseCodeReservationIDNotInReservationOrder ErrorResponseCode = "ReservationIdNotInReservationOrder" ErrorResponseCodeReservationOrderCreationFailed ErrorResponseCode = "ReservationOrderCreationFailed" ErrorResponseCodeReservationOrderIDAlreadyExists ErrorResponseCode = "ReservationOrderIdAlreadyExists" @@ -151,6 +153,7 @@ const ( ErrorResponseCodeReservationOrderNotFound ErrorResponseCode = "ReservationOrderNotFound" ErrorResponseCodeRiskCheckFailed ErrorResponseCode = "RiskCheckFailed" ErrorResponseCodeRoleAssignmentCreationFailed ErrorResponseCode = "RoleAssignmentCreationFailed" + ErrorResponseCodeSelfServiceRefundNotSupported ErrorResponseCode = "SelfServiceRefundNotSupported" ErrorResponseCodeServerTimeout ErrorResponseCode = "ServerTimeout" ErrorResponseCodeUnauthenticatedRequestsThrottled ErrorResponseCode = "UnauthenticatedRequestsThrottled" ErrorResponseCodeUnsupportedReservationTerm ErrorResponseCode = "UnsupportedReservationTerm" @@ -205,6 +208,7 @@ func PossibleErrorResponseCodeValues() []ErrorResponseCode { ErrorResponseCodePaymentInstrumentNotFound, ErrorResponseCodePurchaseError, ErrorResponseCodeReRateOnlyAllowedForEA, + ErrorResponseCodeRefundLimitExceeded, ErrorResponseCodeReservationIDNotInReservationOrder, ErrorResponseCodeReservationOrderCreationFailed, ErrorResponseCodeReservationOrderIDAlreadyExists, @@ -212,6 +216,7 @@ func PossibleErrorResponseCodeValues() []ErrorResponseCode { ErrorResponseCodeReservationOrderNotFound, ErrorResponseCodeRiskCheckFailed, ErrorResponseCodeRoleAssignmentCreationFailed, + ErrorResponseCodeSelfServiceRefundNotSupported, ErrorResponseCodeServerTimeout, ErrorResponseCodeUnauthenticatedRequestsThrottled, ErrorResponseCodeUnsupportedReservationTerm, diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_date_type.go b/sdk/resourcemanager/reservations/armreservations/date_type.go similarity index 98% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_date_type.go rename to sdk/resourcemanager/reservations/armreservations/date_type.go index 89af3164c022..eb58bfe3d9e0 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_date_type.go +++ b/sdk/resourcemanager/reservations/armreservations/date_type.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_exchange_client.go b/sdk/resourcemanager/reservations/armreservations/exchange_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_exchange_client.go rename to sdk/resourcemanager/reservations/armreservations/exchange_client.go index fc3884140b66..cd1b8890cd3d 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_exchange_client.go +++ b/sdk/resourcemanager/reservations/armreservations/exchange_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_exchange_client_test.go b/sdk/resourcemanager/reservations/armreservations/exchange_client_example_test.go similarity index 86% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_exchange_client_test.go rename to sdk/resourcemanager/reservations/armreservations/exchange_client_example_test.go index 9fa93fc5e541..d508fad686a4 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_exchange_client_test.go +++ b/sdk/resourcemanager/reservations/armreservations/exchange_client_example_test.go @@ -28,13 +28,11 @@ func ExampleExchangeClient_BeginPost() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPost(ctx, - armreservations.ExchangeRequest{ - Properties: &armreservations.ExchangeRequestProperties{ - SessionID: to.Ptr("66e2ac8f-439e-4345-8235-6fef07608081"), - }, + poller, err := client.BeginPost(ctx, armreservations.ExchangeRequest{ + Properties: &armreservations.ExchangeRequestProperties{ + SessionID: to.Ptr("66e2ac8f-439e-4345-8235-6fef07608081"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/reservations/armreservations/go.mod b/sdk/resourcemanager/reservations/armreservations/go.mod index b6aba293d704..af4f14ce0411 100644 --- a/sdk/resourcemanager/reservations/armreservations/go.mod +++ b/sdk/resourcemanager/reservations/armreservations/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/reservations/armreservations/go.sum b/sdk/resourcemanager/reservations/armreservations/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/reservations/armreservations/go.sum +++ b/sdk/resourcemanager/reservations/armreservations/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_models.go b/sdk/resourcemanager/reservations/armreservations/models.go similarity index 92% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_models.go rename to sdk/resourcemanager/reservations/armreservations/models.go index 0766c18d2a30..00c9ee3c7684 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_models.go +++ b/sdk/resourcemanager/reservations/armreservations/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -190,6 +191,31 @@ type CalculatePriceResponsePropertiesPricingCurrencyTotal struct { CurrencyCode *string `json:"currencyCode,omitempty"` } +// CalculateRefundClientPostOptions contains the optional parameters for the CalculateRefundClient.Post method. +type CalculateRefundClientPostOptions struct { + // placeholder for future optional parameters +} + +type CalculateRefundRequest struct { + // Fully qualified identifier of the reservation order being returned + ID *string `json:"id,omitempty"` + Properties *CalculateRefundRequestProperties `json:"properties,omitempty"` +} + +type CalculateRefundRequestProperties struct { + // Reservation to return + ReservationToReturn *ReservationToReturn `json:"reservationToReturn,omitempty"` + + // The scope of the refund, e.g. Reservation + Scope *string `json:"scope,omitempty"` +} + +type CalculateRefundResponse struct { + // Fully qualified identifier of the reservation being returned + ID *string `json:"id,omitempty"` + Properties *RefundResponseProperties `json:"properties,omitempty"` +} + type Catalog struct { // The billing plan options available for this SKU. BillingPlans map[string][]*ReservationBillingPlan `json:"billingPlans,omitempty"` @@ -857,6 +883,83 @@ type QuotaRequestSubmitResponse201 struct { Type *string `json:"type,omitempty" azure:"ro"` } +// RefundBillingInformation - billing information +type RefundBillingInformation struct { + BillingCurrencyProratedAmount *Price `json:"billingCurrencyProratedAmount,omitempty"` + BillingCurrencyRemainingCommitmentAmount *Price `json:"billingCurrencyRemainingCommitmentAmount,omitempty"` + BillingCurrencyTotalPaidAmount *Price `json:"billingCurrencyTotalPaidAmount,omitempty"` + + // Represent the billing plans. + BillingPlan *ReservationBillingPlan `json:"billingPlan,omitempty"` + + // The number of completed transactions in this reservation's payment + CompletedTransactions *int32 `json:"completedTransactions,omitempty"` + + // The number of total transactions in this reservation's payment + TotalTransactions *int32 `json:"totalTransactions,omitempty"` +} + +// RefundPolicyError - error details +type RefundPolicyError struct { + Code *ErrorResponseCode `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// RefundPolicyResult - Refund policy result +type RefundPolicyResult struct { + // Refund policy result property + Properties *RefundPolicyResultProperty `json:"properties,omitempty"` +} + +// RefundPolicyResultProperty - Refund policy result property +type RefundPolicyResultProperty struct { + ConsumedRefundsTotal *Price `json:"consumedRefundsTotal,omitempty"` + MaxRefundLimit *Price `json:"maxRefundLimit,omitempty"` + + // Refund Policy errors + PolicyErrors []*RefundPolicyError `json:"policyErrors,omitempty"` +} + +type RefundRequest struct { + Properties *RefundRequestProperties `json:"properties,omitempty"` +} + +type RefundRequestProperties struct { + // Reservation to return + ReservationToReturn *ReservationToReturn `json:"reservationToReturn,omitempty"` + + // The reason of returning the reservation + ReturnReason *string `json:"returnReason,omitempty"` + + // The scope of the refund, e.g. Reservation + Scope *string `json:"scope,omitempty"` + + // SessionId that was returned by CalculateRefund API. + SessionID *string `json:"sessionId,omitempty"` +} + +type RefundResponse struct { + // Fully qualified identifier of the reservation being returned + ID *string `json:"id,omitempty"` + Properties *RefundResponseProperties `json:"properties,omitempty"` +} + +type RefundResponseProperties struct { + // billing information + BillingInformation *RefundBillingInformation `json:"billingInformation,omitempty"` + BillingRefundAmount *Price `json:"billingRefundAmount,omitempty"` + + // Refund policy result + PolicyResult *RefundPolicyResult `json:"policyResult,omitempty"` + PricingRefundAmount *Price `json:"pricingRefundAmount,omitempty"` + + // Quantity to be returned + Quantity *int32 `json:"quantity,omitempty"` + + // Refund session identifier + SessionID *string `json:"sessionId,omitempty"` +} + type RenewPropertiesResponse struct { // Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. BillingCurrencyTotal *RenewPropertiesResponseBillingCurrencyTotal `json:"billingCurrencyTotal,omitempty"` @@ -885,6 +988,11 @@ type RenewPropertiesResponsePricingCurrencyTotal struct { CurrencyCode *string `json:"currencyCode,omitempty"` } +// ReservationClientArchiveOptions contains the optional parameters for the ReservationClient.Archive method. +type ReservationClientArchiveOptions struct { + // placeholder for future optional parameters +} + // ReservationClientBeginAvailableScopesOptions contains the optional parameters for the ReservationClient.BeginAvailableScopes // method. type ReservationClientBeginAvailableScopesOptions struct { @@ -946,6 +1054,11 @@ type ReservationClientListRevisionsOptions struct { // placeholder for future optional parameters } +// ReservationClientUnarchiveOptions contains the optional parameters for the ReservationClient.Unarchive method. +type ReservationClientUnarchiveOptions struct { + // placeholder for future optional parameters +} + type ReservationList struct { // Url to get the next page of reservations. NextLink *string `json:"nextLink,omitempty"` @@ -1203,6 +1316,11 @@ type ResourceName struct { LocalizedValue *string `json:"localizedValue,omitempty" azure:"ro"` } +// ReturnClientPostOptions contains the optional parameters for the ReturnClient.Post method. +type ReturnClientPostOptions struct { + // placeholder for future optional parameters +} + type SKUCapability struct { // An invariant to describe the feature. Name *string `json:"name,omitempty"` diff --git a/sdk/resourcemanager/reservations/armreservations/models_serde.go b/sdk/resourcemanager/reservations/armreservations/models_serde.go new file mode 100644 index 000000000000..c42ad5582ca1 --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/models_serde.go @@ -0,0 +1,3876 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armreservations + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AppliedReservationList. +func (a AppliedReservationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppliedReservationList. +func (a *AppliedReservationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppliedReservations. +func (a AppliedReservations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppliedReservations. +func (a *AppliedReservations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppliedReservationsProperties. +func (a AppliedReservationsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reservationOrderIds", a.ReservationOrderIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppliedReservationsProperties. +func (a *AppliedReservationsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reservationOrderIds": + err = unpopulate(val, "ReservationOrderIDs", &a.ReservationOrderIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableScopeProperties. +func (a AvailableScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableScopeProperties. +func (a *AvailableScopeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableScopeRequest. +func (a AvailableScopeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableScopeRequest. +func (a *AvailableScopeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableScopeRequestProperties. +func (a AvailableScopeRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scopes", a.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableScopeRequestProperties. +func (a *AvailableScopeRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scopes": + err = unpopulate(val, "Scopes", &a.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingInformation. +func (b BillingInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyProratedAmount", b.BillingCurrencyProratedAmount) + populate(objectMap, "billingCurrencyRemainingCommitmentAmount", b.BillingCurrencyRemainingCommitmentAmount) + populate(objectMap, "billingCurrencyTotalPaidAmount", b.BillingCurrencyTotalPaidAmount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingInformation. +func (b *BillingInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyProratedAmount": + err = unpopulate(val, "BillingCurrencyProratedAmount", &b.BillingCurrencyProratedAmount) + delete(rawMsg, key) + case "billingCurrencyRemainingCommitmentAmount": + err = unpopulate(val, "BillingCurrencyRemainingCommitmentAmount", &b.BillingCurrencyRemainingCommitmentAmount) + delete(rawMsg, key) + case "billingCurrencyTotalPaidAmount": + err = unpopulate(val, "BillingCurrencyTotalPaidAmount", &b.BillingCurrencyTotalPaidAmount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateExchangeOperationResultResponse. +func (c CalculateExchangeOperationResultResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", c.Error) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateExchangeOperationResultResponse. +func (c *CalculateExchangeOperationResultResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateExchangeRequest. +func (c CalculateExchangeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateExchangeRequest. +func (c *CalculateExchangeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateExchangeRequestProperties. +func (c CalculateExchangeRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reservationsToExchange", c.ReservationsToExchange) + populate(objectMap, "reservationsToPurchase", c.ReservationsToPurchase) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateExchangeRequestProperties. +func (c *CalculateExchangeRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reservationsToExchange": + err = unpopulate(val, "ReservationsToExchange", &c.ReservationsToExchange) + delete(rawMsg, key) + case "reservationsToPurchase": + err = unpopulate(val, "ReservationsToPurchase", &c.ReservationsToPurchase) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateExchangeResponseProperties. +func (c CalculateExchangeResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "netPayable", c.NetPayable) + populate(objectMap, "policyResult", c.PolicyResult) + populate(objectMap, "purchasesTotal", c.PurchasesTotal) + populate(objectMap, "refundsTotal", c.RefundsTotal) + populate(objectMap, "reservationsToExchange", c.ReservationsToExchange) + populate(objectMap, "reservationsToPurchase", c.ReservationsToPurchase) + populate(objectMap, "sessionId", c.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateExchangeResponseProperties. +func (c *CalculateExchangeResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "netPayable": + err = unpopulate(val, "NetPayable", &c.NetPayable) + delete(rawMsg, key) + case "policyResult": + err = unpopulate(val, "PolicyResult", &c.PolicyResult) + delete(rawMsg, key) + case "purchasesTotal": + err = unpopulate(val, "PurchasesTotal", &c.PurchasesTotal) + delete(rawMsg, key) + case "refundsTotal": + err = unpopulate(val, "RefundsTotal", &c.RefundsTotal) + delete(rawMsg, key) + case "reservationsToExchange": + err = unpopulate(val, "ReservationsToExchange", &c.ReservationsToExchange) + delete(rawMsg, key) + case "reservationsToPurchase": + err = unpopulate(val, "ReservationsToPurchase", &c.ReservationsToPurchase) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &c.SessionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculatePriceResponse. +func (c CalculatePriceResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculatePriceResponse. +func (c *CalculatePriceResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculatePriceResponseProperties. +func (c CalculatePriceResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyTotal", c.BillingCurrencyTotal) + populate(objectMap, "grandTotal", c.GrandTotal) + populate(objectMap, "isBillingPartnerManaged", c.IsBillingPartnerManaged) + populate(objectMap, "isTaxIncluded", c.IsTaxIncluded) + populate(objectMap, "netTotal", c.NetTotal) + populate(objectMap, "paymentSchedule", c.PaymentSchedule) + populate(objectMap, "pricingCurrencyTotal", c.PricingCurrencyTotal) + populate(objectMap, "reservationOrderId", c.ReservationOrderID) + populate(objectMap, "skuDescription", c.SKUDescription) + populate(objectMap, "skuTitle", c.SKUTitle) + populate(objectMap, "taxTotal", c.TaxTotal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculatePriceResponseProperties. +func (c *CalculatePriceResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyTotal": + err = unpopulate(val, "BillingCurrencyTotal", &c.BillingCurrencyTotal) + delete(rawMsg, key) + case "grandTotal": + err = unpopulate(val, "GrandTotal", &c.GrandTotal) + delete(rawMsg, key) + case "isBillingPartnerManaged": + err = unpopulate(val, "IsBillingPartnerManaged", &c.IsBillingPartnerManaged) + delete(rawMsg, key) + case "isTaxIncluded": + err = unpopulate(val, "IsTaxIncluded", &c.IsTaxIncluded) + delete(rawMsg, key) + case "netTotal": + err = unpopulate(val, "NetTotal", &c.NetTotal) + delete(rawMsg, key) + case "paymentSchedule": + err = unpopulate(val, "PaymentSchedule", &c.PaymentSchedule) + delete(rawMsg, key) + case "pricingCurrencyTotal": + err = unpopulate(val, "PricingCurrencyTotal", &c.PricingCurrencyTotal) + delete(rawMsg, key) + case "reservationOrderId": + err = unpopulate(val, "ReservationOrderID", &c.ReservationOrderID) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &c.SKUDescription) + delete(rawMsg, key) + case "skuTitle": + err = unpopulate(val, "SKUTitle", &c.SKUTitle) + delete(rawMsg, key) + case "taxTotal": + err = unpopulate(val, "TaxTotal", &c.TaxTotal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculatePriceResponsePropertiesBillingCurrencyTotal. +func (c CalculatePriceResponsePropertiesBillingCurrencyTotal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", c.Amount) + populate(objectMap, "currencyCode", c.CurrencyCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculatePriceResponsePropertiesBillingCurrencyTotal. +func (c *CalculatePriceResponsePropertiesBillingCurrencyTotal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &c.Amount) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &c.CurrencyCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculatePriceResponsePropertiesPricingCurrencyTotal. +func (c CalculatePriceResponsePropertiesPricingCurrencyTotal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", c.Amount) + populate(objectMap, "currencyCode", c.CurrencyCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculatePriceResponsePropertiesPricingCurrencyTotal. +func (c *CalculatePriceResponsePropertiesPricingCurrencyTotal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &c.Amount) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &c.CurrencyCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateRefundRequest. +func (c CalculateRefundRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateRefundRequest. +func (c *CalculateRefundRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateRefundRequestProperties. +func (c CalculateRefundRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reservationToReturn", c.ReservationToReturn) + populate(objectMap, "scope", c.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateRefundRequestProperties. +func (c *CalculateRefundRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reservationToReturn": + err = unpopulate(val, "ReservationToReturn", &c.ReservationToReturn) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &c.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CalculateRefundResponse. +func (c CalculateRefundResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CalculateRefundResponse. +func (c *CalculateRefundResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Catalog. +func (c Catalog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingPlans", c.BillingPlans) + populate(objectMap, "capabilities", c.Capabilities) + populate(objectMap, "locations", c.Locations) + populate(objectMap, "msrp", c.Msrp) + populate(objectMap, "name", c.Name) + populate(objectMap, "resourceType", c.ResourceType) + populate(objectMap, "restrictions", c.Restrictions) + populate(objectMap, "skuProperties", c.SKUProperties) + populate(objectMap, "size", c.Size) + populate(objectMap, "terms", c.Terms) + populate(objectMap, "tier", c.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Catalog. +func (c *Catalog) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingPlans": + err = unpopulate(val, "BillingPlans", &c.BillingPlans) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &c.Capabilities) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &c.Locations) + delete(rawMsg, key) + case "msrp": + err = unpopulate(val, "Msrp", &c.Msrp) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &c.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &c.Restrictions) + delete(rawMsg, key) + case "skuProperties": + err = unpopulate(val, "SKUProperties", &c.SKUProperties) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &c.Size) + delete(rawMsg, key) + case "terms": + err = unpopulate(val, "Terms", &c.Terms) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &c.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CatalogMsrp. +func (c CatalogMsrp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "p1Y", c.P1Y) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CatalogMsrp. +func (c *CatalogMsrp) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "p1Y": + err = unpopulate(val, "P1Y", &c.P1Y) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChangeDirectoryRequest. +func (c ChangeDirectoryRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationTenantId", c.DestinationTenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChangeDirectoryRequest. +func (c *ChangeDirectoryRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationTenantId": + err = unpopulate(val, "DestinationTenantID", &c.DestinationTenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChangeDirectoryResponse. +func (c ChangeDirectoryResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reservationOrder", c.ReservationOrder) + populate(objectMap, "reservations", c.Reservations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChangeDirectoryResponse. +func (c *ChangeDirectoryResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reservationOrder": + err = unpopulate(val, "ReservationOrder", &c.ReservationOrder) + delete(rawMsg, key) + case "reservations": + err = unpopulate(val, "Reservations", &c.Reservations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChangeDirectoryResult. +func (c ChangeDirectoryResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", c.Error) + populate(objectMap, "id", c.ID) + populate(objectMap, "isSucceeded", c.IsSucceeded) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChangeDirectoryResult. +func (c *ChangeDirectoryResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "isSucceeded": + err = unpopulate(val, "IsSucceeded", &c.IsSucceeded) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateGenericQuotaRequestParameters. +func (c CreateGenericQuotaRequestParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateGenericQuotaRequestParameters. +func (c *CreateGenericQuotaRequestParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimit. +func (c CurrentQuotaLimit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "quotaInformation", c.QuotaInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurrentQuotaLimit. +func (c *CurrentQuotaLimit) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "quotaInformation": + err = unpopulate(val, "QuotaInformation", &c.QuotaInformation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimitBase. +func (c CurrentQuotaLimitBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurrentQuotaLimitBase. +func (c *CurrentQuotaLimitBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExceptionResponse. +func (e ExceptionResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExceptionResponse. +func (e *ExceptionResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangeOperationResultResponse. +func (e ExchangeOperationResultResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangeOperationResultResponse. +func (e *ExchangeOperationResultResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangePolicyError. +func (e ExchangePolicyError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangePolicyError. +func (e *ExchangePolicyError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangePolicyErrors. +func (e ExchangePolicyErrors) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "policyErrors", e.PolicyErrors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangePolicyErrors. +func (e *ExchangePolicyErrors) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "policyErrors": + err = unpopulate(val, "PolicyErrors", &e.PolicyErrors) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangeRequest. +func (e ExchangeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangeRequest. +func (e *ExchangeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangeRequestProperties. +func (e ExchangeRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sessionId", e.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangeRequestProperties. +func (e *ExchangeRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sessionId": + err = unpopulate(val, "SessionID", &e.SessionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExchangeResponseProperties. +func (e ExchangeResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "netPayable", e.NetPayable) + populate(objectMap, "policyResult", e.PolicyResult) + populate(objectMap, "purchasesTotal", e.PurchasesTotal) + populate(objectMap, "refundsTotal", e.RefundsTotal) + populate(objectMap, "reservationsToExchange", e.ReservationsToExchange) + populate(objectMap, "reservationsToPurchase", e.ReservationsToPurchase) + populate(objectMap, "sessionId", e.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExchangeResponseProperties. +func (e *ExchangeResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "netPayable": + err = unpopulate(val, "NetPayable", &e.NetPayable) + delete(rawMsg, key) + case "policyResult": + err = unpopulate(val, "PolicyResult", &e.PolicyResult) + delete(rawMsg, key) + case "purchasesTotal": + err = unpopulate(val, "PurchasesTotal", &e.PurchasesTotal) + delete(rawMsg, key) + case "refundsTotal": + err = unpopulate(val, "RefundsTotal", &e.RefundsTotal) + delete(rawMsg, key) + case "reservationsToExchange": + err = unpopulate(val, "ReservationsToExchange", &e.ReservationsToExchange) + delete(rawMsg, key) + case "reservationsToPurchase": + err = unpopulate(val, "ReservationsToPurchase", &e.ReservationsToPurchase) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &e.SessionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedErrorInfo. +func (e ExtendedErrorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedErrorInfo. +func (e *ExtendedErrorInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtendedStatusInfo. +func (e ExtendedStatusInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", e.Message) + populate(objectMap, "statusCode", e.StatusCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedStatusInfo. +func (e *ExtendedStatusInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &e.StatusCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListResult. +func (l ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "summary", l.Summary) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. +func (l *ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &l.Summary) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MergeProperties. +func (m MergeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sources", m.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MergeProperties. +func (m *MergeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sources": + err = unpopulate(val, "Sources", &m.Sources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MergeRequest. +func (m MergeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MergeRequest. +func (m *MergeRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResponse. +func (o OperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", &o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResponse. +func (o *OperationResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResultError. +func (o OperationResultError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultError. +func (o *OperationResultError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Patch. +func (p Patch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Patch. +func (p *Patch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchProperties. +func (p PatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedScopeType", p.AppliedScopeType) + populate(objectMap, "appliedScopes", p.AppliedScopes) + populate(objectMap, "instanceFlexibility", p.InstanceFlexibility) + populate(objectMap, "name", p.Name) + populate(objectMap, "renew", p.Renew) + populate(objectMap, "renewProperties", p.RenewProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchProperties. +func (p *PatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedScopeType": + err = unpopulate(val, "AppliedScopeType", &p.AppliedScopeType) + delete(rawMsg, key) + case "appliedScopes": + err = unpopulate(val, "AppliedScopes", &p.AppliedScopes) + delete(rawMsg, key) + case "instanceFlexibility": + err = unpopulate(val, "InstanceFlexibility", &p.InstanceFlexibility) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "renew": + err = unpopulate(val, "Renew", &p.Renew) + delete(rawMsg, key) + case "renewProperties": + err = unpopulate(val, "RenewProperties", &p.RenewProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchPropertiesRenewProperties. +func (p PatchPropertiesRenewProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "purchaseProperties", p.PurchaseProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchPropertiesRenewProperties. +func (p *PatchPropertiesRenewProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "purchaseProperties": + err = unpopulate(val, "PurchaseProperties", &p.PurchaseProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PaymentDetail. +func (p PaymentDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingAccount", p.BillingAccount) + populate(objectMap, "billingCurrencyTotal", p.BillingCurrencyTotal) + populateDateType(objectMap, "dueDate", p.DueDate) + populate(objectMap, "extendedStatusInfo", p.ExtendedStatusInfo) + populateDateType(objectMap, "paymentDate", p.PaymentDate) + populate(objectMap, "pricingCurrencyTotal", p.PricingCurrencyTotal) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PaymentDetail. +func (p *PaymentDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingAccount": + err = unpopulate(val, "BillingAccount", &p.BillingAccount) + delete(rawMsg, key) + case "billingCurrencyTotal": + err = unpopulate(val, "BillingCurrencyTotal", &p.BillingCurrencyTotal) + delete(rawMsg, key) + case "dueDate": + err = unpopulateDateType(val, "DueDate", &p.DueDate) + delete(rawMsg, key) + case "extendedStatusInfo": + err = unpopulate(val, "ExtendedStatusInfo", &p.ExtendedStatusInfo) + delete(rawMsg, key) + case "paymentDate": + err = unpopulateDateType(val, "PaymentDate", &p.PaymentDate) + delete(rawMsg, key) + case "pricingCurrencyTotal": + err = unpopulate(val, "PricingCurrencyTotal", &p.PricingCurrencyTotal) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Price. +func (p Price) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", p.Amount) + populate(objectMap, "currencyCode", p.CurrencyCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Price. +func (p *Price) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &p.Amount) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &p.CurrencyCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedScopeType", p.AppliedScopeType) + populate(objectMap, "appliedScopes", p.AppliedScopes) + populate(objectMap, "archived", p.Archived) + populateTimeRFC3339(objectMap, "benefitStartTime", p.BenefitStartTime) + populate(objectMap, "billingPlan", p.BillingPlan) + populate(objectMap, "billingScopeId", p.BillingScopeID) + populate(objectMap, "capabilities", p.Capabilities) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "displayProvisioningState", p.DisplayProvisioningState) + populateTimeRFC3339(objectMap, "effectiveDateTime", p.EffectiveDateTime) + populateDateType(objectMap, "expiryDate", p.ExpiryDate) + populate(objectMap, "extendedStatusInfo", p.ExtendedStatusInfo) + populate(objectMap, "instanceFlexibility", p.InstanceFlexibility) + populateTimeRFC3339(objectMap, "lastUpdatedDateTime", p.LastUpdatedDateTime) + populate(objectMap, "mergeProperties", p.MergeProperties) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "provisioningSubState", p.ProvisioningSubState) + populateDateType(objectMap, "purchaseDate", p.PurchaseDate) + populate(objectMap, "quantity", p.Quantity) + populate(objectMap, "renew", p.Renew) + populate(objectMap, "renewDestination", p.RenewDestination) + populate(objectMap, "renewProperties", p.RenewProperties) + populate(objectMap, "renewSource", p.RenewSource) + populate(objectMap, "reservedResourceType", p.ReservedResourceType) + populate(objectMap, "skuDescription", p.SKUDescription) + populate(objectMap, "splitProperties", p.SplitProperties) + populate(objectMap, "term", p.Term) + populate(objectMap, "userFriendlyAppliedScopeType", p.UserFriendlyAppliedScopeType) + populate(objectMap, "userFriendlyRenewState", p.UserFriendlyRenewState) + populate(objectMap, "utilization", p.Utilization) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedScopeType": + err = unpopulate(val, "AppliedScopeType", &p.AppliedScopeType) + delete(rawMsg, key) + case "appliedScopes": + err = unpopulate(val, "AppliedScopes", &p.AppliedScopes) + delete(rawMsg, key) + case "archived": + err = unpopulate(val, "Archived", &p.Archived) + delete(rawMsg, key) + case "benefitStartTime": + err = unpopulateTimeRFC3339(val, "BenefitStartTime", &p.BenefitStartTime) + delete(rawMsg, key) + case "billingPlan": + err = unpopulate(val, "BillingPlan", &p.BillingPlan) + delete(rawMsg, key) + case "billingScopeId": + err = unpopulate(val, "BillingScopeID", &p.BillingScopeID) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &p.Capabilities) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "displayProvisioningState": + err = unpopulate(val, "DisplayProvisioningState", &p.DisplayProvisioningState) + delete(rawMsg, key) + case "effectiveDateTime": + err = unpopulateTimeRFC3339(val, "EffectiveDateTime", &p.EffectiveDateTime) + delete(rawMsg, key) + case "expiryDate": + err = unpopulateDateType(val, "ExpiryDate", &p.ExpiryDate) + delete(rawMsg, key) + case "extendedStatusInfo": + err = unpopulate(val, "ExtendedStatusInfo", &p.ExtendedStatusInfo) + delete(rawMsg, key) + case "instanceFlexibility": + err = unpopulate(val, "InstanceFlexibility", &p.InstanceFlexibility) + delete(rawMsg, key) + case "lastUpdatedDateTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateTime", &p.LastUpdatedDateTime) + delete(rawMsg, key) + case "mergeProperties": + err = unpopulate(val, "MergeProperties", &p.MergeProperties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "provisioningSubState": + err = unpopulate(val, "ProvisioningSubState", &p.ProvisioningSubState) + delete(rawMsg, key) + case "purchaseDate": + err = unpopulateDateType(val, "PurchaseDate", &p.PurchaseDate) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &p.Quantity) + delete(rawMsg, key) + case "renew": + err = unpopulate(val, "Renew", &p.Renew) + delete(rawMsg, key) + case "renewDestination": + err = unpopulate(val, "RenewDestination", &p.RenewDestination) + delete(rawMsg, key) + case "renewProperties": + err = unpopulate(val, "RenewProperties", &p.RenewProperties) + delete(rawMsg, key) + case "renewSource": + err = unpopulate(val, "RenewSource", &p.RenewSource) + delete(rawMsg, key) + case "reservedResourceType": + err = unpopulate(val, "ReservedResourceType", &p.ReservedResourceType) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &p.SKUDescription) + delete(rawMsg, key) + case "splitProperties": + err = unpopulate(val, "SplitProperties", &p.SplitProperties) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &p.Term) + delete(rawMsg, key) + case "userFriendlyAppliedScopeType": + err = unpopulate(val, "UserFriendlyAppliedScopeType", &p.UserFriendlyAppliedScopeType) + delete(rawMsg, key) + case "userFriendlyRenewState": + err = unpopulate(val, "UserFriendlyRenewState", &p.UserFriendlyRenewState) + delete(rawMsg, key) + case "utilization": + err = unpopulate(val, "Utilization", &p.Utilization) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertiesUtilization. +func (p PropertiesUtilization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregates", p.Aggregates) + populate(objectMap, "trend", p.Trend) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertiesUtilization. +func (p *PropertiesUtilization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregates": + err = unpopulate(val, "Aggregates", &p.Aggregates) + delete(rawMsg, key) + case "trend": + err = unpopulate(val, "Trend", &p.Trend) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PurchaseRequest. +func (p PurchaseRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", p.Location) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseRequest. +func (p *PurchaseRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PurchaseRequestProperties. +func (p PurchaseRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedScopeType", p.AppliedScopeType) + populate(objectMap, "appliedScopes", p.AppliedScopes) + populate(objectMap, "billingPlan", p.BillingPlan) + populate(objectMap, "billingScopeId", p.BillingScopeID) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "quantity", p.Quantity) + populate(objectMap, "renew", p.Renew) + populate(objectMap, "reservedResourceProperties", p.ReservedResourceProperties) + populate(objectMap, "reservedResourceType", p.ReservedResourceType) + populate(objectMap, "term", p.Term) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseRequestProperties. +func (p *PurchaseRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedScopeType": + err = unpopulate(val, "AppliedScopeType", &p.AppliedScopeType) + delete(rawMsg, key) + case "appliedScopes": + err = unpopulate(val, "AppliedScopes", &p.AppliedScopes) + delete(rawMsg, key) + case "billingPlan": + err = unpopulate(val, "BillingPlan", &p.BillingPlan) + delete(rawMsg, key) + case "billingScopeId": + err = unpopulate(val, "BillingScopeID", &p.BillingScopeID) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &p.Quantity) + delete(rawMsg, key) + case "renew": + err = unpopulate(val, "Renew", &p.Renew) + delete(rawMsg, key) + case "reservedResourceProperties": + err = unpopulate(val, "ReservedResourceProperties", &p.ReservedResourceProperties) + delete(rawMsg, key) + case "reservedResourceType": + err = unpopulate(val, "ReservedResourceType", &p.ReservedResourceType) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &p.Term) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PurchaseRequestPropertiesReservedResourceProperties. +func (p PurchaseRequestPropertiesReservedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceFlexibility", p.InstanceFlexibility) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PurchaseRequestPropertiesReservedResourceProperties. +func (p *PurchaseRequestPropertiesReservedResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceFlexibility": + err = unpopulate(val, "InstanceFlexibility", &p.InstanceFlexibility) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaLimits. +func (q QuotaLimits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaLimits. +func (q *QuotaLimits) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaLimitsResponse. +func (q QuotaLimitsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaLimitsResponse. +func (q *QuotaLimitsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaProperties. +func (q QuotaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "limit", q.Limit) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", &q.Properties) + populate(objectMap, "quotaPeriod", q.QuotaPeriod) + populate(objectMap, "resourceType", q.ResourceType) + populate(objectMap, "unit", q.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaProperties. +func (q *QuotaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "quotaPeriod": + err = unpopulate(val, "QuotaPeriod", &q.QuotaPeriod) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &q.ResourceType) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestDetails. +func (q QuotaRequestDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestDetails. +func (q *QuotaRequestDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestDetailsList. +func (q QuotaRequestDetailsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestDetailsList. +func (q *QuotaRequestDetailsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestOneResourceProperties. +func (q QuotaRequestOneResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", q.Message) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "provisioningState", q.ProvisioningState) + populateTimeRFC3339(objectMap, "requestSubmitTime", q.RequestSubmitTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestOneResourceProperties. +func (q *QuotaRequestOneResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &q.Message) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &q.ProvisioningState) + delete(rawMsg, key) + case "requestSubmitTime": + err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &q.RequestSubmitTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestOneResourceSubmitResponse. +func (q QuotaRequestOneResourceSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestOneResourceSubmitResponse. +func (q *QuotaRequestOneResourceSubmitResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestProperties. +func (q QuotaRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", q.Message) + populate(objectMap, "provisioningState", q.ProvisioningState) + populateTimeRFC3339(objectMap, "requestSubmitTime", q.RequestSubmitTime) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestProperties. +func (q *QuotaRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &q.Message) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &q.ProvisioningState) + delete(rawMsg, key) + case "requestSubmitTime": + err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &q.RequestSubmitTime) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestStatusDetails. +func (q QuotaRequestStatusDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", q.Message) + populate(objectMap, "provisioningState", q.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestStatusDetails. +func (q *QuotaRequestStatusDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &q.Message) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &q.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestSubmitResponse. +func (q QuotaRequestSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestSubmitResponse. +func (q *QuotaRequestSubmitResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaRequestSubmitResponse201. +func (q QuotaRequestSubmitResponse201) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestSubmitResponse201. +func (q *QuotaRequestSubmitResponse201) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundBillingInformation. +func (r RefundBillingInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyProratedAmount", r.BillingCurrencyProratedAmount) + populate(objectMap, "billingCurrencyRemainingCommitmentAmount", r.BillingCurrencyRemainingCommitmentAmount) + populate(objectMap, "billingCurrencyTotalPaidAmount", r.BillingCurrencyTotalPaidAmount) + populate(objectMap, "billingPlan", r.BillingPlan) + populate(objectMap, "completedTransactions", r.CompletedTransactions) + populate(objectMap, "totalTransactions", r.TotalTransactions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundBillingInformation. +func (r *RefundBillingInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyProratedAmount": + err = unpopulate(val, "BillingCurrencyProratedAmount", &r.BillingCurrencyProratedAmount) + delete(rawMsg, key) + case "billingCurrencyRemainingCommitmentAmount": + err = unpopulate(val, "BillingCurrencyRemainingCommitmentAmount", &r.BillingCurrencyRemainingCommitmentAmount) + delete(rawMsg, key) + case "billingCurrencyTotalPaidAmount": + err = unpopulate(val, "BillingCurrencyTotalPaidAmount", &r.BillingCurrencyTotalPaidAmount) + delete(rawMsg, key) + case "billingPlan": + err = unpopulate(val, "BillingPlan", &r.BillingPlan) + delete(rawMsg, key) + case "completedTransactions": + err = unpopulate(val, "CompletedTransactions", &r.CompletedTransactions) + delete(rawMsg, key) + case "totalTransactions": + err = unpopulate(val, "TotalTransactions", &r.TotalTransactions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundPolicyError. +func (r RefundPolicyError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", r.Code) + populate(objectMap, "message", r.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundPolicyError. +func (r *RefundPolicyError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundPolicyResult. +func (r RefundPolicyResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundPolicyResult. +func (r *RefundPolicyResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundPolicyResultProperty. +func (r RefundPolicyResultProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consumedRefundsTotal", r.ConsumedRefundsTotal) + populate(objectMap, "maxRefundLimit", r.MaxRefundLimit) + populate(objectMap, "policyErrors", r.PolicyErrors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundPolicyResultProperty. +func (r *RefundPolicyResultProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consumedRefundsTotal": + err = unpopulate(val, "ConsumedRefundsTotal", &r.ConsumedRefundsTotal) + delete(rawMsg, key) + case "maxRefundLimit": + err = unpopulate(val, "MaxRefundLimit", &r.MaxRefundLimit) + delete(rawMsg, key) + case "policyErrors": + err = unpopulate(val, "PolicyErrors", &r.PolicyErrors) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundRequest. +func (r RefundRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundRequest. +func (r *RefundRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundRequestProperties. +func (r RefundRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reservationToReturn", r.ReservationToReturn) + populate(objectMap, "returnReason", r.ReturnReason) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "sessionId", r.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundRequestProperties. +func (r *RefundRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reservationToReturn": + err = unpopulate(val, "ReservationToReturn", &r.ReservationToReturn) + delete(rawMsg, key) + case "returnReason": + err = unpopulate(val, "ReturnReason", &r.ReturnReason) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &r.SessionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundResponse. +func (r RefundResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundResponse. +func (r *RefundResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RefundResponseProperties. +func (r RefundResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingInformation", r.BillingInformation) + populate(objectMap, "billingRefundAmount", r.BillingRefundAmount) + populate(objectMap, "policyResult", r.PolicyResult) + populate(objectMap, "pricingRefundAmount", r.PricingRefundAmount) + populate(objectMap, "quantity", r.Quantity) + populate(objectMap, "sessionId", r.SessionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RefundResponseProperties. +func (r *RefundResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingInformation": + err = unpopulate(val, "BillingInformation", &r.BillingInformation) + delete(rawMsg, key) + case "billingRefundAmount": + err = unpopulate(val, "BillingRefundAmount", &r.BillingRefundAmount) + delete(rawMsg, key) + case "policyResult": + err = unpopulate(val, "PolicyResult", &r.PolicyResult) + delete(rawMsg, key) + case "pricingRefundAmount": + err = unpopulate(val, "PricingRefundAmount", &r.PricingRefundAmount) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + case "sessionId": + err = unpopulate(val, "SessionID", &r.SessionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RenewPropertiesResponse. +func (r RenewPropertiesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyTotal", r.BillingCurrencyTotal) + populate(objectMap, "pricingCurrencyTotal", r.PricingCurrencyTotal) + populate(objectMap, "purchaseProperties", r.PurchaseProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RenewPropertiesResponse. +func (r *RenewPropertiesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyTotal": + err = unpopulate(val, "BillingCurrencyTotal", &r.BillingCurrencyTotal) + delete(rawMsg, key) + case "pricingCurrencyTotal": + err = unpopulate(val, "PricingCurrencyTotal", &r.PricingCurrencyTotal) + delete(rawMsg, key) + case "purchaseProperties": + err = unpopulate(val, "PurchaseProperties", &r.PurchaseProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RenewPropertiesResponseBillingCurrencyTotal. +func (r RenewPropertiesResponseBillingCurrencyTotal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", r.Amount) + populate(objectMap, "currencyCode", r.CurrencyCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RenewPropertiesResponseBillingCurrencyTotal. +func (r *RenewPropertiesResponseBillingCurrencyTotal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &r.Amount) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &r.CurrencyCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RenewPropertiesResponsePricingCurrencyTotal. +func (r RenewPropertiesResponsePricingCurrencyTotal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", r.Amount) + populate(objectMap, "currencyCode", r.CurrencyCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RenewPropertiesResponsePricingCurrencyTotal. +func (r *RenewPropertiesResponsePricingCurrencyTotal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &r.Amount) + delete(rawMsg, key) + case "currencyCode": + err = unpopulate(val, "CurrencyCode", &r.CurrencyCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationList. +func (r ReservationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationList. +func (r *ReservationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationMergeProperties. +func (r ReservationMergeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mergeDestination", r.MergeDestination) + populate(objectMap, "mergeSources", r.MergeSources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationMergeProperties. +func (r *ReservationMergeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mergeDestination": + err = unpopulate(val, "MergeDestination", &r.MergeDestination) + delete(rawMsg, key) + case "mergeSources": + err = unpopulate(val, "MergeSources", &r.MergeSources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationOrderBillingPlanInformation. +func (r ReservationOrderBillingPlanInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateDateType(objectMap, "nextPaymentDueDate", r.NextPaymentDueDate) + populate(objectMap, "pricingCurrencyTotal", r.PricingCurrencyTotal) + populateDateType(objectMap, "startDate", r.StartDate) + populate(objectMap, "transactions", r.Transactions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderBillingPlanInformation. +func (r *ReservationOrderBillingPlanInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextPaymentDueDate": + err = unpopulateDateType(val, "NextPaymentDueDate", &r.NextPaymentDueDate) + delete(rawMsg, key) + case "pricingCurrencyTotal": + err = unpopulate(val, "PricingCurrencyTotal", &r.PricingCurrencyTotal) + delete(rawMsg, key) + case "startDate": + err = unpopulateDateType(val, "StartDate", &r.StartDate) + delete(rawMsg, key) + case "transactions": + err = unpopulate(val, "Transactions", &r.Transactions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationOrderList. +func (r ReservationOrderList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderList. +func (r *ReservationOrderList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationOrderProperties. +func (r ReservationOrderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "benefitStartTime", r.BenefitStartTime) + populate(objectMap, "billingPlan", r.BillingPlan) + populateTimeRFC3339(objectMap, "createdDateTime", r.CreatedDateTime) + populate(objectMap, "displayName", r.DisplayName) + populateDateType(objectMap, "expiryDate", r.ExpiryDate) + populate(objectMap, "originalQuantity", r.OriginalQuantity) + populate(objectMap, "planInformation", r.PlanInformation) + populate(objectMap, "provisioningState", r.ProvisioningState) + populateTimeRFC3339(objectMap, "requestDateTime", r.RequestDateTime) + populate(objectMap, "reservations", r.Reservations) + populate(objectMap, "term", r.Term) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderProperties. +func (r *ReservationOrderProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "benefitStartTime": + err = unpopulateTimeRFC3339(val, "BenefitStartTime", &r.BenefitStartTime) + delete(rawMsg, key) + case "billingPlan": + err = unpopulate(val, "BillingPlan", &r.BillingPlan) + delete(rawMsg, key) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &r.CreatedDateTime) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "expiryDate": + err = unpopulateDateType(val, "ExpiryDate", &r.ExpiryDate) + delete(rawMsg, key) + case "originalQuantity": + err = unpopulate(val, "OriginalQuantity", &r.OriginalQuantity) + delete(rawMsg, key) + case "planInformation": + err = unpopulate(val, "PlanInformation", &r.PlanInformation) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "requestDateTime": + err = unpopulateTimeRFC3339(val, "RequestDateTime", &r.RequestDateTime) + delete(rawMsg, key) + case "reservations": + err = unpopulate(val, "Reservations", &r.Reservations) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &r.Term) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationOrderResponse. +func (r ReservationOrderResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderResponse. +func (r *ReservationOrderResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationResponse. +func (r ReservationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + objectMap["kind"] = "Microsoft.Compute" + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationResponse. +func (r *ReservationResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationSplitProperties. +func (r ReservationSplitProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "splitDestinations", r.SplitDestinations) + populate(objectMap, "splitSource", r.SplitSource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSplitProperties. +func (r *ReservationSplitProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "splitDestinations": + err = unpopulate(val, "SplitDestinations", &r.SplitDestinations) + delete(rawMsg, key) + case "splitSource": + err = unpopulate(val, "SplitSource", &r.SplitSource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationSummary. +func (r ReservationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cancelledCount", r.CancelledCount) + populate(objectMap, "expiredCount", r.ExpiredCount) + populate(objectMap, "expiringCount", r.ExpiringCount) + populate(objectMap, "failedCount", r.FailedCount) + populate(objectMap, "pendingCount", r.PendingCount) + populate(objectMap, "processingCount", r.ProcessingCount) + populate(objectMap, "succeededCount", r.SucceededCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSummary. +func (r *ReservationSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cancelledCount": + err = unpopulate(val, "CancelledCount", &r.CancelledCount) + delete(rawMsg, key) + case "expiredCount": + err = unpopulate(val, "ExpiredCount", &r.ExpiredCount) + delete(rawMsg, key) + case "expiringCount": + err = unpopulate(val, "ExpiringCount", &r.ExpiringCount) + delete(rawMsg, key) + case "failedCount": + err = unpopulate(val, "FailedCount", &r.FailedCount) + delete(rawMsg, key) + case "pendingCount": + err = unpopulate(val, "PendingCount", &r.PendingCount) + delete(rawMsg, key) + case "processingCount": + err = unpopulate(val, "ProcessingCount", &r.ProcessingCount) + delete(rawMsg, key) + case "succeededCount": + err = unpopulate(val, "SucceededCount", &r.SucceededCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationToExchange. +func (r ReservationToExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingInformation", r.BillingInformation) + populate(objectMap, "billingRefundAmount", r.BillingRefundAmount) + populate(objectMap, "quantity", r.Quantity) + populate(objectMap, "reservationId", r.ReservationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationToExchange. +func (r *ReservationToExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingInformation": + err = unpopulate(val, "BillingInformation", &r.BillingInformation) + delete(rawMsg, key) + case "billingRefundAmount": + err = unpopulate(val, "BillingRefundAmount", &r.BillingRefundAmount) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &r.ReservationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationToPurchaseCalculateExchange. +func (r ReservationToPurchaseCalculateExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyTotal", r.BillingCurrencyTotal) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationToPurchaseCalculateExchange. +func (r *ReservationToPurchaseCalculateExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyTotal": + err = unpopulate(val, "BillingCurrencyTotal", &r.BillingCurrencyTotal) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationToPurchaseExchange. +func (r ReservationToPurchaseExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCurrencyTotal", r.BillingCurrencyTotal) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "reservationId", r.ReservationID) + populate(objectMap, "reservationOrderId", r.ReservationOrderID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationToPurchaseExchange. +func (r *ReservationToPurchaseExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCurrencyTotal": + err = unpopulate(val, "BillingCurrencyTotal", &r.BillingCurrencyTotal) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &r.ReservationID) + delete(rawMsg, key) + case "reservationOrderId": + err = unpopulate(val, "ReservationOrderID", &r.ReservationOrderID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationToReturn. +func (r ReservationToReturn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "quantity", r.Quantity) + populate(objectMap, "reservationId", r.ReservationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationToReturn. +func (r *ReservationToReturn) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &r.ReservationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationToReturnForExchange. +func (r ReservationToReturnForExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingInformation", r.BillingInformation) + populate(objectMap, "billingRefundAmount", r.BillingRefundAmount) + populate(objectMap, "quantity", r.Quantity) + populate(objectMap, "reservationId", r.ReservationID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationToReturnForExchange. +func (r *ReservationToReturnForExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingInformation": + err = unpopulate(val, "BillingInformation", &r.BillingInformation) + delete(rawMsg, key) + case "billingRefundAmount": + err = unpopulate(val, "BillingRefundAmount", &r.BillingRefundAmount) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &r.ReservationID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReservationUtilizationAggregates. +func (r ReservationUtilizationAggregates) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "grain", r.Grain) + populate(objectMap, "grainUnit", r.GrainUnit) + populate(objectMap, "value", r.Value) + populate(objectMap, "valueUnit", r.ValueUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationUtilizationAggregates. +func (r *ReservationUtilizationAggregates) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "grain": + err = unpopulate(val, "Grain", &r.Grain) + delete(rawMsg, key) + case "grainUnit": + err = unpopulate(val, "GrainUnit", &r.GrainUnit) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + case "valueUnit": + err = unpopulate(val, "ValueUnit", &r.ValueUnit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceName. +func (r ResourceName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", r.LocalizedValue) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceName. +func (r *ResourceName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &r.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUCapability. +func (s SKUCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. +func (s *SKUCapability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUName. +func (s SKUName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUName. +func (s *SKUName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKUProperty. +func (s SKUProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUProperty. +func (s *SKUProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SKURestriction. +func (s SKURestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reasonCode", s.ReasonCode) + populate(objectMap, "type", s.Type) + populate(objectMap, "values", s.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKURestriction. +func (s *SKURestriction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reasonCode": + err = unpopulate(val, "ReasonCode", &s.ReasonCode) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &s.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopeProperties. +func (s ScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scope", s.Scope) + populate(objectMap, "valid", s.Valid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeProperties. +func (s *ScopeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + case "valid": + err = unpopulate(val, "Valid", &s.Valid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceError. +func (s ServiceError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", s.Code) + populate(objectMap, "details", s.Details) + populate(objectMap, "message", s.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceError. +func (s *ServiceError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &s.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceErrorDetail. +func (s ServiceErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", s.Code) + populate(objectMap, "message", s.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceErrorDetail. +func (s *ServiceErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SplitProperties. +func (s SplitProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "quantities", s.Quantities) + populate(objectMap, "reservationId", s.ReservationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SplitProperties. +func (s *SplitProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "quantities": + err = unpopulate(val, "Quantities", &s.Quantities) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, "ReservationID", &s.ReservationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SplitRequest. +func (s SplitRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SplitRequest. +func (s *SplitRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubRequest. +func (s SubRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "limit", s.Limit) + populate(objectMap, "message", s.Message) + populate(objectMap, "name", s.Name) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "subRequestId", s.SubRequestID) + populate(objectMap, "unit", s.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubRequest. +func (s *SubRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limit": + err = unpopulate(val, "Limit", &s.Limit) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &s.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "subRequestId": + err = unpopulate(val, "SubRequestID", &s.SubRequestID) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeProperties. +func (s SubscriptionScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scopes", s.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeProperties. +func (s *SubscriptionScopeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scopes": + err = unpopulate(val, "Scopes", &s.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_operation_client.go b/sdk/resourcemanager/reservations/armreservations/operation_client.go similarity index 98% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_operation_client.go rename to sdk/resourcemanager/reservations/armreservations/operation_client.go index bd9c06cd8d5c..d11ad25936ce 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_operation_client.go +++ b/sdk/resourcemanager/reservations/armreservations/operation_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -49,7 +50,6 @@ func NewOperationClient(credential azcore.TokenCredential, options *arm.ClientOp } // NewListPager - List all the operations. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 // options - OperationClientListOptions contains the optional parameters for the OperationClient.List method. func (client *OperationClient) NewListPager(options *OperationClientListOptions) *runtime.Pager[OperationClientListResponse] { diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_operation_client_test.go b/sdk/resourcemanager/reservations/armreservations/operation_client_example_test.go similarity index 100% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_operation_client_test.go rename to sdk/resourcemanager/reservations/armreservations/operation_client_example_test.go diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_quota_client.go b/sdk/resourcemanager/reservations/armreservations/quota_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_quota_client.go rename to sdk/resourcemanager/reservations/armreservations/quota_client.go index 22fa6ad6a73d..d8a423620c4c 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_quota_client.go +++ b/sdk/resourcemanager/reservations/armreservations/quota_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -201,7 +202,6 @@ func (client *QuotaClient) getHandleResponse(resp *http.Response) (QuotaClientGe // NewListPager - Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota // operation can be leveraged to request quota updates. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-10-25 // subscriptionID - Azure subscription ID. // providerID - Azure resource provider ID. diff --git a/sdk/resourcemanager/reservations/armreservations/quota_client_example_test.go b/sdk/resourcemanager/reservations/armreservations/quota_client_example_test.go new file mode 100644 index 000000000000..954b39cfe57c --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/quota_client_example_test.go @@ -0,0 +1,211 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armreservations_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json +func ExampleQuotaClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", "standardNDSFamily", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json +func ExampleQuotaClient_BeginCreateOrUpdate_quotasRequestPutForCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.Compute", "eastus", "standardFSv2Family", armreservations.CurrentQuotaLimitBase{ + Properties: &armreservations.QuotaProperties{ + Name: &armreservations.ResourceName{ + Value: to.Ptr("standardFSv2Family"), + }, + Limit: to.Ptr[int32](200), + Unit: to.Ptr("Count"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json +func ExampleQuotaClient_BeginCreateOrUpdate_quotasRequestPutForMachineLearningServicesDedicatedResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus", "StandardDv2Family", armreservations.CurrentQuotaLimitBase{ + Properties: &armreservations.QuotaProperties{ + Name: &armreservations.ResourceName{ + Value: to.Ptr("StandardDv2Family"), + }, + Limit: to.Ptr[int32](200), + ResourceType: to.Ptr(armreservations.ResourceTypeDedicated), + Unit: to.Ptr("Count"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json +func ExampleQuotaClient_BeginCreateOrUpdate_quotasRequestPutForMachineLearningServicesLowPriorityResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus", "TotalLowPriorityCores", armreservations.CurrentQuotaLimitBase{ + Properties: &armreservations.QuotaProperties{ + Name: &armreservations.ResourceName{ + Value: to.Ptr("TotalLowPriorityCores"), + }, + Limit: to.Ptr[int32](200), + ResourceType: to.Ptr(armreservations.ResourceTypeLowPriority), + Unit: to.Ptr("Count"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json +func ExampleQuotaClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.Compute", "eastus", "standardFSv2Family", armreservations.CurrentQuotaLimitBase{ + Properties: &armreservations.QuotaProperties{ + Name: &armreservations.ResourceName{ + Value: to.Ptr("standardFSv2Family"), + }, + Limit: to.Ptr[int32](200), + Unit: to.Ptr("Count"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json +func ExampleQuotaClient_NewListPager_quotasListUsagesForCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json +func ExampleQuotaClient_NewListPager_quotasListUsagesMachineLearningServices() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewQuotaClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("00000000-0000-0000-0000-000000000000", "Microsoft.MachineLearningServices", "eastus", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_quotarequeststatus_client.go b/sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_quotarequeststatus_client.go rename to sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client.go index a10687b1c06e..a426d63513ad 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_quotarequeststatus_client.go +++ b/sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -118,7 +119,6 @@ func (client *QuotaRequestStatusClient) getHandleResponse(resp *http.Response) ( // NewListPager - For the specified Azure region (location), subscription, and resource provider, get the history of the quota // requests for the past year. To select specific quota requests, use the oData filter. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-10-25 // subscriptionID - Azure subscription ID. // providerID - Azure resource provider ID. diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_quota_client_test.go b/sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client_example_test.go similarity index 55% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_quota_client_test.go rename to sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client_example_test.go index 0af5d14bc15d..5ad51d51194f 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_quota_client_test.go +++ b/sdk/resourcemanager/reservations/armreservations/quotarequeststatus_client_example_test.go @@ -12,28 +12,22 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json -func ExampleQuotaClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json +func ExampleQuotaRequestStatusClient_Get_quotaRequestFailed() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaClient(cred, nil) + client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "00000000-0000-0000-0000-000000000000", - "Microsoft.Compute", - "eastus", - "standardNDSFamily", - nil) + res, err := client.Get(ctx, "00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", "2B5C8515-37D8-4B6A-879B-CD641A2CF605", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -41,95 +35,59 @@ func ExampleQuotaClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json -func ExampleQuotaClient_BeginCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json +func ExampleQuotaRequestStatusClient_Get_quotaRequestInProgress() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaClient(cred, nil) + client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", - "Microsoft.Compute", - "eastus", - "standardFSv2Family", - armreservations.CurrentQuotaLimitBase{ - Properties: &armreservations.QuotaProperties{ - Name: &armreservations.ResourceName{ - Value: to.Ptr("standardFSv2Family"), - }, - Limit: to.Ptr[int32](200), - Unit: to.Ptr("Count"), - }, - }, - nil) + res, err := client.Get(ctx, "00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", "2B5C8515-37D8-4B6A-879B-CD641A2CF605", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // TODO: use response item _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json -func ExampleQuotaClient_BeginUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json +func ExampleQuotaRequestStatusClient_Get_quotaRequestStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaClient(cred, nil) + client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", - "Microsoft.Compute", - "eastus", - "standardFSv2Family", - armreservations.CurrentQuotaLimitBase{ - Properties: &armreservations.QuotaProperties{ - Name: &armreservations.ResourceName{ - Value: to.Ptr("standardFSv2Family"), - }, - Limit: to.Ptr[int32](200), - Unit: to.Ptr("Count"), - }, - }, - nil) + res, err := client.Get(ctx, "00000000-0000-0000-0000-000000000000", "Microsoft.Compute", "eastus", "2B5C8515-37D8-4B6A-879B-CD641A2CF605", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // TODO: use response item _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json -func ExampleQuotaClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json +func ExampleQuotaRequestStatusClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armreservations.NewQuotaClient(cred, nil) + client, err := armreservations.NewQuotaRequestStatusClient(cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("00000000-0000-0000-0000-000000000000", - "Microsoft.Compute", - "eastus", - nil) + pager := client.NewListPager("3f75fdf7-977e-44ad-990d-99f14f0f299f", "Microsoft.Compute", "eastus", &armreservations.QuotaRequestStatusClientListOptions{Filter: nil, + Top: nil, + Skiptoken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_reservation_client.go b/sdk/resourcemanager/reservations/armreservations/reservation_client.go similarity index 85% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_reservation_client.go rename to sdk/resourcemanager/reservations/armreservations/reservation_client.go index d31aaf32d249..6cc8b3c93e35 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_reservation_client.go +++ b/sdk/resourcemanager/reservations/armreservations/reservation_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -52,6 +53,49 @@ func NewReservationClient(credential azcore.TokenCredential, options *arm.Client return client, nil } +// Archive - Archiving a Reservation moves it to Archived state. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-01 +// reservationOrderID - Order Id of the reservation +// reservationID - Id of the Reservation Item +// options - ReservationClientArchiveOptions contains the optional parameters for the ReservationClient.Archive method. +func (client *ReservationClient) Archive(ctx context.Context, reservationOrderID string, reservationID string, options *ReservationClientArchiveOptions) (ReservationClientArchiveResponse, error) { + req, err := client.archiveCreateRequest(ctx, reservationOrderID, reservationID, options) + if err != nil { + return ReservationClientArchiveResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReservationClientArchiveResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReservationClientArchiveResponse{}, runtime.NewResponseError(resp) + } + return ReservationClientArchiveResponse{}, nil +} + +// archiveCreateRequest creates the Archive request. +func (client *ReservationClient) archiveCreateRequest(ctx context.Context, reservationOrderID string, reservationID string, options *ReservationClientArchiveOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/archive" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + if reservationID == "" { + return nil, errors.New("parameter reservationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationId}", url.PathEscape(reservationID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginAvailableScopes - Get Available Scopes for Reservation. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 @@ -167,7 +211,6 @@ func (client *ReservationClient) getHandleResponse(resp *http.Response) (Reserva } // NewListPager - List Reservations within a single ReservationOrder. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 // reservationOrderID - Order Id of the reservation // options - ReservationClientListOptions contains the optional parameters for the ReservationClient.List method. @@ -228,7 +271,6 @@ func (client *ReservationClient) listHandleResponse(resp *http.Response) (Reserv // NewListAllPager - List the reservations and the roll up counts of reservations group by provisioning states that the user // has access to in the current tenant. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 // options - ReservationClientListAllOptions contains the optional parameters for the ReservationClient.ListAll method. func (client *ReservationClient) NewListAllPager(options *ReservationClientListAllOptions) *runtime.Pager[ReservationClientListAllResponse] { @@ -301,7 +343,6 @@ func (client *ReservationClient) listAllHandleResponse(resp *http.Response) (Res } // NewListRevisionsPager - List of all the revisions for the Reservation. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 // reservationID - Id of the Reservation Item // reservationOrderID - Order Id of the reservation @@ -479,6 +520,49 @@ func (client *ReservationClient) splitCreateRequest(ctx context.Context, reserva return req, runtime.MarshalAsJSON(req, body) } +// Unarchive - Unarchiving a Reservation moves it to the state it was before archiving. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-01 +// reservationOrderID - Order Id of the reservation +// reservationID - Id of the Reservation Item +// options - ReservationClientUnarchiveOptions contains the optional parameters for the ReservationClient.Unarchive method. +func (client *ReservationClient) Unarchive(ctx context.Context, reservationOrderID string, reservationID string, options *ReservationClientUnarchiveOptions) (ReservationClientUnarchiveResponse, error) { + req, err := client.unarchiveCreateRequest(ctx, reservationOrderID, reservationID, options) + if err != nil { + return ReservationClientUnarchiveResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReservationClientUnarchiveResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReservationClientUnarchiveResponse{}, runtime.NewResponseError(resp) + } + return ReservationClientUnarchiveResponse{}, nil +} + +// unarchiveCreateRequest creates the Unarchive request. +func (client *ReservationClient) unarchiveCreateRequest(ctx context.Context, reservationOrderID string, reservationID string, options *ReservationClientUnarchiveOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/unarchive" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + if reservationID == "" { + return nil, errors.New("parameter reservationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationId}", url.PathEscape(reservationID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Updates the applied scopes of the Reservation. // If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservation_client_test.go b/sdk/resourcemanager/reservations/armreservations/reservation_client_example_test.go similarity index 68% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservation_client_test.go rename to sdk/resourcemanager/reservations/armreservations/reservation_client_example_test.go index 6996ccdeb972..70c63958cffe 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservation_client_test.go +++ b/sdk/resourcemanager/reservations/armreservations/reservation_client_example_test.go @@ -28,16 +28,12 @@ func ExampleReservationClient_BeginAvailableScopes() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginAvailableScopes(ctx, - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", - armreservations.AvailableScopeRequest{ - Properties: &armreservations.AvailableScopeRequestProperties{ - Scopes: []*string{ - to.Ptr("/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9")}, - }, + poller, err := client.BeginAvailableScopes(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", armreservations.AvailableScopeRequest{ + Properties: &armreservations.AvailableScopeRequestProperties{ + Scopes: []*string{ + to.Ptr("/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -60,17 +56,14 @@ func ExampleReservationClient_BeginSplit() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginSplit(ctx, - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - armreservations.SplitRequest{ - Properties: &armreservations.SplitProperties{ - Quantities: []*int32{ - to.Ptr[int32](1), - to.Ptr[int32](2)}, - ReservationID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"), - }, + poller, err := client.BeginSplit(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", armreservations.SplitRequest{ + Properties: &armreservations.SplitProperties{ + Quantities: []*int32{ + to.Ptr[int32](1), + to.Ptr[int32](2)}, + ReservationID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -93,16 +86,13 @@ func ExampleReservationClient_BeginMerge() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginMerge(ctx, - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - armreservations.MergeRequest{ - Properties: &armreservations.MergeProperties{ - Sources: []*string{ - to.Ptr("/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73"), - to.Ptr("/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799")}, - }, + poller, err := client.BeginMerge(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", armreservations.MergeRequest{ + Properties: &armreservations.MergeProperties{ + Sources: []*string{ + to.Ptr("/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73"), + to.Ptr("/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -125,8 +115,7 @@ func ExampleReservationClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - nil) + pager := client.NewListPager("276e7ae4-84d0-4da6-ab4b-d6b94f3557da", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -150,10 +139,7 @@ func ExampleReservationClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "6ef59113-3482-40da-8d79-787f823e34bc", - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - &armreservations.ReservationClientGetOptions{Expand: to.Ptr("renewProperties")}) + res, err := client.Get(ctx, "6ef59113-3482-40da-8d79-787f823e34bc", "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", &armreservations.ReservationClientGetOptions{Expand: to.Ptr("renewProperties")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -172,16 +158,12 @@ func ExampleReservationClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - "6ef59113-3482-40da-8d79-787f823e34bc", - armreservations.Patch{ - Properties: &armreservations.PatchProperties{ - AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), - InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOff), - }, + poller, err := client.BeginUpdate(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", "6ef59113-3482-40da-8d79-787f823e34bc", armreservations.Patch{ + Properties: &armreservations.PatchProperties{ + AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), + InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOff), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -193,6 +175,40 @@ func ExampleReservationClient_BeginUpdate() { _ = res } +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Archive.json +func ExampleReservationClient_Archive() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewReservationClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Archive(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Unarchive.json +func ExampleReservationClient_Unarchive() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewReservationClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Unarchive(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationRevisions.json func ExampleReservationClient_NewListRevisionsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -204,9 +220,7 @@ func ExampleReservationClient_NewListRevisionsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListRevisionsPager("6ef59113-3482-40da-8d79-787f823e34bc", - "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", - nil) + pager := client.NewListRevisionsPager("6ef59113-3482-40da-8d79-787f823e34bc", "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_reservationorder_client.go b/sdk/resourcemanager/reservations/armreservations/reservationorder_client.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_reservationorder_client.go rename to sdk/resourcemanager/reservations/armreservations/reservationorder_client.go index ae75c4f46323..9e9154f91a0b 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_reservationorder_client.go +++ b/sdk/resourcemanager/reservations/armreservations/reservationorder_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -195,7 +196,6 @@ func (client *ReservationOrderClient) getHandleResponse(resp *http.Response) (Re } // NewListPager - List of all the ReservationOrders that the user has access to in the current tenant. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01 // options - ReservationOrderClientListOptions contains the optional parameters for the ReservationOrderClient.List method. func (client *ReservationOrderClient) NewListPager(options *ReservationOrderClientListOptions) *runtime.Pager[ReservationOrderClientListResponse] { diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservationorder_client_test.go b/sdk/resourcemanager/reservations/armreservations/reservationorder_client_example_test.go similarity index 58% rename from sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservationorder_client_test.go rename to sdk/resourcemanager/reservations/armreservations/reservationorder_client_example_test.go index 7724205372ea..7d2faa89561a 100644 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_reservationorder_client_test.go +++ b/sdk/resourcemanager/reservations/armreservations/reservationorder_client_example_test.go @@ -28,26 +28,24 @@ func ExampleReservationOrderClient_Calculate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Calculate(ctx, - armreservations.PurchaseRequest{ - Location: to.Ptr("westus"), - Properties: &armreservations.PurchaseRequestProperties{ - AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), - BillingPlan: to.Ptr(armreservations.ReservationBillingPlanMonthly), - BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), - DisplayName: to.Ptr("TestReservationOrder"), - Quantity: to.Ptr[int32](1), - ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ - InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), - }, - ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), - Term: to.Ptr(armreservations.ReservationTermP1Y), - }, - SKU: &armreservations.SKUName{ - Name: to.Ptr("standard_D1"), + res, err := client.Calculate(ctx, armreservations.PurchaseRequest{ + Location: to.Ptr("westus"), + Properties: &armreservations.PurchaseRequestProperties{ + AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), + BillingPlan: to.Ptr(armreservations.ReservationBillingPlanMonthly), + BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), + DisplayName: to.Ptr("TestReservationOrder"), + Quantity: to.Ptr[int32](1), + ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ + InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), }, + ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), + Term: to.Ptr(armreservations.ReservationTermP1Y), + }, + SKU: &armreservations.SKUName{ + Name: to.Ptr("standard_D1"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -90,28 +88,25 @@ func ExampleReservationOrderClient_BeginPurchase() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginPurchase(ctx, - "a075419f-44cc-497f-b68a-14ee811d48b9", - armreservations.PurchaseRequest{ - Location: to.Ptr("westus"), - Properties: &armreservations.PurchaseRequestProperties{ - AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), - BillingPlan: to.Ptr(armreservations.ReservationBillingPlanMonthly), - BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), - DisplayName: to.Ptr("TestReservationOrder"), - Quantity: to.Ptr[int32](1), - Renew: to.Ptr(false), - ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ - InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), - }, - ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), - Term: to.Ptr(armreservations.ReservationTermP1Y), - }, - SKU: &armreservations.SKUName{ - Name: to.Ptr("standard_D1"), + poller, err := client.BeginPurchase(ctx, "a075419f-44cc-497f-b68a-14ee811d48b9", armreservations.PurchaseRequest{ + Location: to.Ptr("westus"), + Properties: &armreservations.PurchaseRequestProperties{ + AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), + BillingPlan: to.Ptr(armreservations.ReservationBillingPlanMonthly), + BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), + DisplayName: to.Ptr("TestReservationOrder"), + Quantity: to.Ptr[int32](1), + Renew: to.Ptr(false), + ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ + InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), }, + ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), + Term: to.Ptr(armreservations.ReservationTermP1Y), }, - nil) + SKU: &armreservations.SKUName{ + Name: to.Ptr("standard_D1"), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -124,7 +119,7 @@ func ExampleReservationOrderClient_BeginPurchase() { } // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.json -func ExampleReservationOrderClient_Get() { +func ExampleReservationOrderClient_Get_getReservation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -134,9 +129,26 @@ func ExampleReservationOrderClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "a075419f-44cc-497f-b68a-14ee811d48b9", - &armreservations.ReservationOrderClientGetOptions{Expand: nil}) + res, err := client.Get(ctx, "a075419f-44cc-497f-b68a-14ee811d48b9", &armreservations.ReservationOrderClientGetOptions{Expand: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json +func ExampleReservationOrderClient_Get_getReservationWithExpandPayments() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewReservationOrderClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "a075419f-44cc-497f-b68a-14ee811d48b9", &armreservations.ReservationOrderClientGetOptions{Expand: to.Ptr("schedule")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -155,12 +167,9 @@ func ExampleReservationOrderClient_ChangeDirectory() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ChangeDirectory(ctx, - "a075419f-44cc-497f-b68a-14ee811d48b9", - armreservations.ChangeDirectoryRequest{ - DestinationTenantID: to.Ptr("906655ea-30be-4587-9d12-b50e077b0f32"), - }, - nil) + res, err := client.ChangeDirectory(ctx, "a075419f-44cc-497f-b68a-14ee811d48b9", armreservations.ChangeDirectoryRequest{ + DestinationTenantID: to.Ptr("906655ea-30be-4587-9d12-b50e077b0f32"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_response_types.go b/sdk/resourcemanager/reservations/armreservations/response_types.go similarity index 86% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_response_types.go rename to sdk/resourcemanager/reservations/armreservations/response_types.go index 3e9494fd81fd..9792a3d47b63 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_response_types.go +++ b/sdk/resourcemanager/reservations/armreservations/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations @@ -26,6 +27,11 @@ type CalculateExchangeClientPostResponse struct { CalculateExchangeOperationResultResponse } +// CalculateRefundClientPostResponse contains the response from method CalculateRefundClient.Post. +type CalculateRefundClientPostResponse struct { + CalculateRefundResponse +} + // ExchangeClientPostResponse contains the response from method ExchangeClient.Post. type ExchangeClientPostResponse struct { ExchangeOperationResultResponse @@ -70,6 +76,11 @@ type QuotaRequestStatusClientListResponse struct { QuotaRequestDetailsList } +// ReservationClientArchiveResponse contains the response from method ReservationClient.Archive. +type ReservationClientArchiveResponse struct { + // placeholder for future response values +} + // ReservationClientAvailableScopesResponse contains the response from method ReservationClient.AvailableScopes. type ReservationClientAvailableScopesResponse struct { AvailableScopeProperties @@ -117,6 +128,11 @@ func (r *ReservationClientSplitResponse) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, &r.ReservationResponseArray) } +// ReservationClientUnarchiveResponse contains the response from method ReservationClient.Unarchive. +type ReservationClientUnarchiveResponse struct { + // placeholder for future response values +} + // ReservationClientUpdateResponse contains the response from method ReservationClient.Update. type ReservationClientUpdateResponse struct { ReservationResponse @@ -146,3 +162,10 @@ type ReservationOrderClientListResponse struct { type ReservationOrderClientPurchaseResponse struct { ReservationOrderResponse } + +// ReturnClientPostResponse contains the response from method ReturnClient.Post. +type ReturnClientPostResponse struct { + RefundResponse + // Location contains the information returned from the Location header response. + Location *string +} diff --git a/sdk/resourcemanager/reservations/armreservations/return_client.go b/sdk/resourcemanager/reservations/armreservations/return_client.go new file mode 100644 index 000000000000..4b90d1163e21 --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/return_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armreservations + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReturnClient contains the methods for the Return group. +// Don't use this type directly, use NewReturnClient() instead. +type ReturnClient struct { + host string + pl runtime.Pipeline +} + +// NewReturnClient creates a new instance of ReturnClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewReturnClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ReturnClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ReturnClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// Post - Return a reservation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-03-01 +// reservationOrderID - Order Id of the reservation +// body - Information needed for returning reservation. +// options - ReturnClientPostOptions contains the optional parameters for the ReturnClient.Post method. +func (client *ReturnClient) Post(ctx context.Context, reservationOrderID string, body RefundRequest, options *ReturnClientPostOptions) (ReturnClientPostResponse, error) { + req, err := client.postCreateRequest(ctx, reservationOrderID, body, options) + if err != nil { + return ReturnClientPostResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReturnClientPostResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return ReturnClientPostResponse{}, runtime.NewResponseError(resp) + } + return client.postHandleResponse(resp) +} + +// postCreateRequest creates the Post request. +func (client *ReturnClient) postCreateRequest(ctx context.Context, reservationOrderID string, body RefundRequest, options *ReturnClientPostOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return" + if reservationOrderID == "" { + return nil, errors.New("parameter reservationOrderID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{reservationOrderId}", url.PathEscape(reservationOrderID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, body) +} + +// postHandleResponse handles the Post response. +func (client *ReturnClient) postHandleResponse(resp *http.Response) (ReturnClientPostResponse, error) { + result := ReturnClientPostResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.RefundResponse); err != nil { + return ReturnClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/reservations/armreservations/return_client_example_test.go b/sdk/resourcemanager/reservations/armreservations/return_client_example_test.go new file mode 100644 index 000000000000..62a4427ab6f6 --- /dev/null +++ b/sdk/resourcemanager/reservations/armreservations/return_client_example_test.go @@ -0,0 +1,45 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armreservations_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/Return.json +func ExampleReturnClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armreservations.NewReturnClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Post(ctx, "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", armreservations.RefundRequest{ + Properties: &armreservations.RefundRequestProperties{ + ReservationToReturn: &armreservations.ReservationToReturn{ + Quantity: to.Ptr[int32](1), + ReservationID: to.Ptr("/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000"), + }, + ReturnReason: to.Ptr("PurchasedWrongProduct"), + Scope: to.Ptr("Reservation"), + SessionID: to.Ptr("10000000-aaaa-bbbb-cccc-200000000000"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_time_rfc3339.go b/sdk/resourcemanager/reservations/armreservations/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/reservations/armreservations/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/reservations/armreservations/time_rfc3339.go index 28c96b219665..125c370e554f 100644 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/reservations/armreservations/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armreservations diff --git a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_calculateexchange_client_test.go b/sdk/resourcemanager/reservations/armreservations/ze_generated_example_calculateexchange_client_test.go deleted file mode 100644 index d2d40bef7ec6..000000000000 --- a/sdk/resourcemanager/reservations/armreservations/ze_generated_example_calculateexchange_client_test.go +++ /dev/null @@ -1,71 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armreservations_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/CalculateExchange.json -func ExampleCalculateExchangeClient_BeginPost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armreservations.NewCalculateExchangeClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPost(ctx, - armreservations.CalculateExchangeRequest{ - Properties: &armreservations.CalculateExchangeRequestProperties{ - ReservationsToExchange: []*armreservations.ReservationToReturn{ - { - Quantity: to.Ptr[int32](1), - ReservationID: to.Ptr("/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6"), - }}, - ReservationsToPurchase: []*armreservations.PurchaseRequest{ - { - Location: to.Ptr("westus"), - Properties: &armreservations.PurchaseRequestProperties{ - AppliedScopeType: to.Ptr(armreservations.AppliedScopeTypeShared), - BillingPlan: to.Ptr(armreservations.ReservationBillingPlanUpfront), - BillingScopeID: to.Ptr("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83"), - DisplayName: to.Ptr("testDisplayName"), - Quantity: to.Ptr[int32](1), - Renew: to.Ptr(false), - ReservedResourceProperties: &armreservations.PurchaseRequestPropertiesReservedResourceProperties{ - InstanceFlexibility: to.Ptr(armreservations.InstanceFlexibilityOn), - }, - ReservedResourceType: to.Ptr(armreservations.ReservedResourceTypeVirtualMachines), - Term: to.Ptr(armreservations.ReservationTermP1Y), - }, - SKU: &armreservations.SKUName{ - Name: to.Ptr("Standard_B1ls"), - }, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/reservations/armreservations/zz_generated_models_serde.go b/sdk/resourcemanager/reservations/armreservations/zz_generated_models_serde.go deleted file mode 100644 index 42b586e46af0..000000000000 --- a/sdk/resourcemanager/reservations/armreservations/zz_generated_models_serde.go +++ /dev/null @@ -1,428 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armreservations - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AvailableScopeRequestProperties. -func (a AvailableScopeRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "scopes", a.Scopes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CalculateExchangeRequestProperties. -func (c CalculateExchangeRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "reservationsToExchange", c.ReservationsToExchange) - populate(objectMap, "reservationsToPurchase", c.ReservationsToPurchase) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CurrentQuotaLimitBase. -func (c CurrentQuotaLimitBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MergeProperties. -func (m MergeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "sources", m.Sources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Patch. -func (p Patch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", p.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PatchProperties. -func (p PatchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "appliedScopeType", p.AppliedScopeType) - populate(objectMap, "appliedScopes", p.AppliedScopes) - populate(objectMap, "instanceFlexibility", p.InstanceFlexibility) - populate(objectMap, "name", p.Name) - populate(objectMap, "renew", p.Renew) - populate(objectMap, "renewProperties", p.RenewProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PaymentDetail. -func (p *PaymentDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "billingAccount": - err = unpopulate(val, "BillingAccount", &p.BillingAccount) - delete(rawMsg, key) - case "billingCurrencyTotal": - err = unpopulate(val, "BillingCurrencyTotal", &p.BillingCurrencyTotal) - delete(rawMsg, key) - case "dueDate": - err = unpopulateDateType(val, "DueDate", &p.DueDate) - delete(rawMsg, key) - case "extendedStatusInfo": - err = unpopulate(val, "ExtendedStatusInfo", &p.ExtendedStatusInfo) - delete(rawMsg, key) - case "paymentDate": - err = unpopulateDateType(val, "PaymentDate", &p.PaymentDate) - delete(rawMsg, key) - case "pricingCurrencyTotal": - err = unpopulate(val, "PricingCurrencyTotal", &p.PricingCurrencyTotal) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. -func (p *Properties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "appliedScopeType": - err = unpopulate(val, "AppliedScopeType", &p.AppliedScopeType) - delete(rawMsg, key) - case "appliedScopes": - err = unpopulate(val, "AppliedScopes", &p.AppliedScopes) - delete(rawMsg, key) - case "archived": - err = unpopulate(val, "Archived", &p.Archived) - delete(rawMsg, key) - case "benefitStartTime": - err = unpopulateTimeRFC3339(val, "BenefitStartTime", &p.BenefitStartTime) - delete(rawMsg, key) - case "billingPlan": - err = unpopulate(val, "BillingPlan", &p.BillingPlan) - delete(rawMsg, key) - case "billingScopeId": - err = unpopulate(val, "BillingScopeID", &p.BillingScopeID) - delete(rawMsg, key) - case "capabilities": - err = unpopulate(val, "Capabilities", &p.Capabilities) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "displayProvisioningState": - err = unpopulate(val, "DisplayProvisioningState", &p.DisplayProvisioningState) - delete(rawMsg, key) - case "effectiveDateTime": - err = unpopulateTimeRFC3339(val, "EffectiveDateTime", &p.EffectiveDateTime) - delete(rawMsg, key) - case "expiryDate": - err = unpopulateDateType(val, "ExpiryDate", &p.ExpiryDate) - delete(rawMsg, key) - case "extendedStatusInfo": - err = unpopulate(val, "ExtendedStatusInfo", &p.ExtendedStatusInfo) - delete(rawMsg, key) - case "instanceFlexibility": - err = unpopulate(val, "InstanceFlexibility", &p.InstanceFlexibility) - delete(rawMsg, key) - case "lastUpdatedDateTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateTime", &p.LastUpdatedDateTime) - delete(rawMsg, key) - case "mergeProperties": - err = unpopulate(val, "MergeProperties", &p.MergeProperties) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "provisioningSubState": - err = unpopulate(val, "ProvisioningSubState", &p.ProvisioningSubState) - delete(rawMsg, key) - case "purchaseDate": - err = unpopulateDateType(val, "PurchaseDate", &p.PurchaseDate) - delete(rawMsg, key) - case "quantity": - err = unpopulate(val, "Quantity", &p.Quantity) - delete(rawMsg, key) - case "renew": - err = unpopulate(val, "Renew", &p.Renew) - delete(rawMsg, key) - case "renewDestination": - err = unpopulate(val, "RenewDestination", &p.RenewDestination) - delete(rawMsg, key) - case "renewProperties": - err = unpopulate(val, "RenewProperties", &p.RenewProperties) - delete(rawMsg, key) - case "renewSource": - err = unpopulate(val, "RenewSource", &p.RenewSource) - delete(rawMsg, key) - case "reservedResourceType": - err = unpopulate(val, "ReservedResourceType", &p.ReservedResourceType) - delete(rawMsg, key) - case "skuDescription": - err = unpopulate(val, "SKUDescription", &p.SKUDescription) - delete(rawMsg, key) - case "splitProperties": - err = unpopulate(val, "SplitProperties", &p.SplitProperties) - delete(rawMsg, key) - case "term": - err = unpopulate(val, "Term", &p.Term) - delete(rawMsg, key) - case "userFriendlyAppliedScopeType": - err = unpopulate(val, "UserFriendlyAppliedScopeType", &p.UserFriendlyAppliedScopeType) - delete(rawMsg, key) - case "userFriendlyRenewState": - err = unpopulate(val, "UserFriendlyRenewState", &p.UserFriendlyRenewState) - delete(rawMsg, key) - case "utilization": - err = unpopulate(val, "Utilization", &p.Utilization) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PurchaseRequestProperties. -func (p PurchaseRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "appliedScopeType", p.AppliedScopeType) - populate(objectMap, "appliedScopes", p.AppliedScopes) - populate(objectMap, "billingPlan", p.BillingPlan) - populate(objectMap, "billingScopeId", p.BillingScopeID) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "quantity", p.Quantity) - populate(objectMap, "renew", p.Renew) - populate(objectMap, "reservedResourceProperties", p.ReservedResourceProperties) - populate(objectMap, "reservedResourceType", p.ReservedResourceType) - populate(objectMap, "term", p.Term) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestOneResourceProperties. -func (q *QuotaRequestOneResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "message": - err = unpopulate(val, "Message", &q.Message) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &q.Properties) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &q.ProvisioningState) - delete(rawMsg, key) - case "requestSubmitTime": - err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &q.RequestSubmitTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaRequestProperties. -func (q *QuotaRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "message": - err = unpopulate(val, "Message", &q.Message) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &q.ProvisioningState) - delete(rawMsg, key) - case "requestSubmitTime": - err = unpopulateTimeRFC3339(val, "RequestSubmitTime", &q.RequestSubmitTime) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderBillingPlanInformation. -func (r *ReservationOrderBillingPlanInformation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextPaymentDueDate": - err = unpopulateDateType(val, "NextPaymentDueDate", &r.NextPaymentDueDate) - delete(rawMsg, key) - case "pricingCurrencyTotal": - err = unpopulate(val, "PricingCurrencyTotal", &r.PricingCurrencyTotal) - delete(rawMsg, key) - case "startDate": - err = unpopulateDateType(val, "StartDate", &r.StartDate) - delete(rawMsg, key) - case "transactions": - err = unpopulate(val, "Transactions", &r.Transactions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationOrderProperties. -func (r *ReservationOrderProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "benefitStartTime": - err = unpopulateTimeRFC3339(val, "BenefitStartTime", &r.BenefitStartTime) - delete(rawMsg, key) - case "billingPlan": - err = unpopulate(val, "BillingPlan", &r.BillingPlan) - delete(rawMsg, key) - case "createdDateTime": - err = unpopulateTimeRFC3339(val, "CreatedDateTime", &r.CreatedDateTime) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &r.DisplayName) - delete(rawMsg, key) - case "expiryDate": - err = unpopulateDateType(val, "ExpiryDate", &r.ExpiryDate) - delete(rawMsg, key) - case "originalQuantity": - err = unpopulate(val, "OriginalQuantity", &r.OriginalQuantity) - delete(rawMsg, key) - case "planInformation": - err = unpopulate(val, "PlanInformation", &r.PlanInformation) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "requestDateTime": - err = unpopulateTimeRFC3339(val, "RequestDateTime", &r.RequestDateTime) - delete(rawMsg, key) - case "reservations": - err = unpopulate(val, "Reservations", &r.Reservations) - delete(rawMsg, key) - case "term": - err = unpopulate(val, "Term", &r.Term) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SplitProperties. -func (s SplitProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "quantities", s.Quantities) - populate(objectMap, "reservationId", s.ReservationID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md index 11d0c0b9c965..ea9b2a677639 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md @@ -1,5 +1,27 @@ # Release History +## 0.7.0 (2022-09-17) +### Features Added + +- New const `LeastPrivilegeModeEnabled` +- New const `ClusterSubnetTypeMultiSubnet` +- New const `ClusterSubnetTypeSingleSubnet` +- New type alias `ClusterSubnetType` +- New type alias `LeastPrivilegeMode` +- New function `PossibleClusterSubnetTypeValues() []ClusterSubnetType` +- New function `PossibleLeastPrivilegeModeValues() []LeastPrivilegeMode` +- New struct `MultiSubnetIPConfiguration` +- New field `PersistFolderPath` in struct `SQLTempDbSettings` +- New field `PersistFolder` in struct `SQLTempDbSettings` +- New field `WsfcStaticIP` in struct `Properties` +- New field `LeastPrivilegeMode` in struct `Properties` +- New field `EnableAutomaticUpgrade` in struct `Properties` +- New field `MultiSubnetIPConfigurations` in struct `AvailabilityGroupListenerProperties` +- New field `ClusterSubnetType` in struct `WsfcDomainProfile` +- New field `IsLpimEnabled` in struct `SQLInstanceSettings` +- New field `IsIfiEnabled` in struct `SQLInstanceSettings` + + ## 0.6.0 (2022-06-02) ### Breaking Changes diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md index 9dcec750daf3..203ed84f15b3 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cfe4dc8393d283e59cc6af4fceaf2c70eaee31a9/specification/sqlvirtualmachine/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cfe4dc8393d283e59cc6af4fceaf2c70eaee31a9/specification/sqlvirtualmachine/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.6.0 +module-version: 0.7.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_availabilitygrouplisteners_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go similarity index 96% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_availabilitygrouplisteners_client.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go index 2c5b05b723f8..33e3ea905920 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_availabilitygrouplisteners_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine @@ -56,7 +57,7 @@ func NewAvailabilityGroupListenersClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -78,7 +79,7 @@ func (client *AvailabilityGroupListenersClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *AvailabilityGroupListenersClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener, options *AvailabilityGroupListenersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, parameters, options) if err != nil { @@ -118,7 +119,7 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -126,7 +127,7 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -147,7 +148,7 @@ func (client *AvailabilityGroupListenersClient) BeginDelete(ctx context.Context, // Delete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *AvailabilityGroupListenersClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, options *AvailabilityGroupListenersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, options) if err != nil { @@ -187,14 +188,14 @@ func (client *AvailabilityGroupListenersClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -243,7 +244,7 @@ func (client *AvailabilityGroupListenersClient) getCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,8 +260,7 @@ func (client *AvailabilityGroupListenersClient) getHandleResponse(resp *http.Res } // NewListByGroupPager - Lists all availability group listeners in a SQL virtual machine group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -314,7 +314,7 @@ func (client *AvailabilityGroupListenersClient) listByGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go new file mode 100644 index 000000000000..7c131f45bacd --- /dev/null +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go @@ -0,0 +1,165 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsqlvirtualmachine_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetAvailabilityGroupListener.json +func ExampleAvailabilityGroupListenersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "testrg", "testvmgroup", "agl-test", &armsqlvirtualmachine.AvailabilityGroupListenersClientGetOptions{Expand: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json +func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerUsingLoadBalancerThisIsUsedForVMsPresentInSingleSubnet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ + Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ + AvailabilityGroupName: to.Ptr("ag-test"), + LoadBalancerConfigurations: []*armsqlvirtualmachine.LoadBalancerConfiguration{ + { + LoadBalancerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test"), + PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ + IPAddress: to.Ptr("10.1.0.112"), + SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), + }, + ProbePort: to.Ptr[int32](59983), + SQLVirtualMachineInstances: []*string{ + to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), + to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")}, + }}, + Port: to.Ptr[int32](1433), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListenerWithMultiSubnet.json +func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerThisIsUsedForVMsPresentInMultiSubnet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ + Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ + AvailabilityGroupName: to.Ptr("ag-test"), + MultiSubnetIPConfigurations: []*armsqlvirtualmachine.MultiSubnetIPConfiguration{ + { + PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ + IPAddress: to.Ptr("10.0.0.112"), + SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), + }, + SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), + }, + { + PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ + IPAddress: to.Ptr("10.0.1.112"), + SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/alternate"), + }, + SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm1"), + }}, + Port: to.Ptr[int32](1433), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteAvailabilityGroupListener.json +func ExampleAvailabilityGroupListenersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", "agl-test", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByGroupAvailabilityGroupListener.json +func ExampleAvailabilityGroupListenersClient_NewListByGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByGroupPager("testrg", "testvmgroup", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/build.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/build.go index 874a29665644..fbe9ffde2587 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/build.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/sqlvirtualmachine/armsqlvirtualmachine +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/sqlvirtualmachine/armsqlvirtualmachine package armsqlvirtualmachine diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_constants.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go similarity index 93% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_constants.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go index fef9143b0991..906f96e8d36a 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_constants.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine const ( moduleName = "armsqlvirtualmachine" - moduleVersion = "v0.6.0" + moduleVersion = "v0.7.0" ) // AssessmentDayOfWeek - Day of the week to run assessment. @@ -109,6 +110,22 @@ func PossibleClusterManagerTypeValues() []ClusterManagerType { } } +// ClusterSubnetType - Cluster subnet type. +type ClusterSubnetType string + +const ( + ClusterSubnetTypeMultiSubnet ClusterSubnetType = "MultiSubnet" + ClusterSubnetTypeSingleSubnet ClusterSubnetType = "SingleSubnet" +) + +// PossibleClusterSubnetTypeValues returns the possible values for the ClusterSubnetType const type. +func PossibleClusterSubnetTypeValues() []ClusterSubnetType { + return []ClusterSubnetType{ + ClusterSubnetTypeMultiSubnet, + ClusterSubnetTypeSingleSubnet, + } +} + // Commit - Replica commit mode in availability group. type Commit string @@ -258,6 +275,20 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// LeastPrivilegeMode - SQL IaaS Agent least privilege mode. +type LeastPrivilegeMode string + +const ( + LeastPrivilegeModeEnabled LeastPrivilegeMode = "Enabled" +) + +// PossibleLeastPrivilegeModeValues returns the possible values for the LeastPrivilegeMode const type. +func PossibleLeastPrivilegeModeValues() []LeastPrivilegeMode { + return []LeastPrivilegeMode{ + LeastPrivilegeModeEnabled, + } +} + // OperationOrigin - The intended executor of the operation. type OperationOrigin string diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod index 7384dd046efe..fd6005fb3a68 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_groups_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go similarity index 95% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_groups_client.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go index f7abf683b20e..cedf520cf3bb 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_groups_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine @@ -56,7 +57,7 @@ func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -77,7 +78,7 @@ func (client *GroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *GroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters Group, options *GroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -113,7 +114,7 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,7 +122,7 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -140,7 +141,7 @@ func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *GroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, options *GroupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, options) if err != nil { @@ -176,14 +177,14 @@ func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -223,7 +224,7 @@ func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +240,7 @@ func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClient } // NewListPager - Gets all SQL virtual machine groups in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // options - GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. func (client *GroupsClient) NewListPager(options *GroupsClientListOptions) *runtime.Pager[GroupsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GroupsClientListResponse]{ @@ -282,7 +282,7 @@ func (client *GroupsClient) listCreateRequest(ctx context.Context, options *Grou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -298,8 +298,7 @@ func (client *GroupsClient) listHandleResponse(resp *http.Response) (GroupsClien } // NewListByResourceGroupPager - Gets all SQL virtual machine groups in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // options - GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.ListByResourceGroup @@ -348,7 +347,7 @@ func (client *GroupsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,7 +364,7 @@ func (client *GroupsClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginUpdate - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -385,7 +384,7 @@ func (client *GroupsClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *GroupsClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters GroupUpdate, options *GroupsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -421,7 +420,7 @@ func (client *GroupsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachinegroups_client_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go similarity index 74% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachinegroups_client_test.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go index 91d18d676952..22fd39c711be 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachinegroups_client_test.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachineGroup.json func ExampleGroupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleGroupsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "testrg", - "testvmgroup", - nil) + res, err := client.Get(ctx, "testrg", "testvmgroup", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -39,7 +36,7 @@ func ExampleGroupsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json func ExampleGroupsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,29 +47,26 @@ func ExampleGroupsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginCreateOrUpdate(ctx, - "testrg", - "testvmgroup", - armsqlvirtualmachine.Group{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - Properties: &armsqlvirtualmachine.GroupProperties{ - SQLImageOffer: to.Ptr("SQL2016-WS2016"), - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLVMGroupImageSKUEnterprise), - WsfcDomainProfile: &armsqlvirtualmachine.WsfcDomainProfile{ - ClusterBootstrapAccount: to.Ptr("testrpadmin"), - ClusterOperatorAccount: to.Ptr("testrp@testdomain.com"), - DomainFqdn: to.Ptr("testdomain.com"), - OuPath: to.Ptr("OU=WSCluster,DC=testdomain,DC=com"), - SQLServiceAccount: to.Ptr("sqlservice@testdomain.com"), - StorageAccountPrimaryKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://storgact.blob.core.windows.net/"), - }, + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.Group{ + Location: to.Ptr("northeurope"), + Tags: map[string]*string{ + "mytag": to.Ptr("myval"), + }, + Properties: &armsqlvirtualmachine.GroupProperties{ + SQLImageOffer: to.Ptr("SQL2016-WS2016"), + SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLVMGroupImageSKUEnterprise), + WsfcDomainProfile: &armsqlvirtualmachine.WsfcDomainProfile{ + ClusterBootstrapAccount: to.Ptr("testrpadmin"), + ClusterOperatorAccount: to.Ptr("testrp@testdomain.com"), + ClusterSubnetType: to.Ptr(armsqlvirtualmachine.ClusterSubnetTypeMultiSubnet), + DomainFqdn: to.Ptr("testdomain.com"), + OuPath: to.Ptr("OU=WSCluster,DC=testdomain,DC=com"), + SQLServiceAccount: to.Ptr("sqlservice@testdomain.com"), + StorageAccountPrimaryKey: to.Ptr(""), + StorageAccountURL: to.Ptr("https://storgact.blob.core.windows.net/"), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -84,7 +78,7 @@ func ExampleGroupsClient_BeginCreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachineGroup.json func ExampleGroupsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -95,10 +89,7 @@ func ExampleGroupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginDelete(ctx, - "testrg", - "testvmgroup", - nil) + poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -108,7 +99,7 @@ func ExampleGroupsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachineGroup.json func ExampleGroupsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,15 +110,11 @@ func ExampleGroupsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := client.BeginUpdate(ctx, - "testrg", - "testvmgroup", - armsqlvirtualmachine.GroupUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, + poller, err := client.BeginUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.GroupUpdate{ + Tags: map[string]*string{ + "mytag": to.Ptr("myval"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -139,7 +126,7 @@ func ExampleGroupsClient_BeginUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json func ExampleGroupsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -150,8 +137,7 @@ func ExampleGroupsClient_NewListByResourceGroupPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByResourceGroupPager("testrg", - nil) + pager := client.NewListByResourceGroupPager("testrg", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -164,7 +150,7 @@ func ExampleGroupsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json func ExampleGroupsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go similarity index 93% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go index 233df085f47d..c7402032b9a2 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine @@ -18,8 +19,8 @@ type AdditionalFeaturesServerConfigurations struct { // AgConfiguration - Availability group configuration. type AgConfiguration struct { - // READ-ONLY; Replica configurations. - Replicas []*AgReplica `json:"replicas,omitempty" azure:"ro"` + // Replica configurations. + Replicas []*AgReplica `json:"replicas,omitempty"` } // AgReplica - Availability group replica configuration. @@ -153,6 +154,9 @@ type AvailabilityGroupListenerProperties struct { // List of load balancer configurations for an availability group listener. LoadBalancerConfigurations []*LoadBalancerConfiguration `json:"loadBalancerConfigurations,omitempty"` + // List of multi subnet IP configurations for an AG listener. + MultiSubnetIPConfigurations []*MultiSubnetIPConfiguration `json:"multiSubnetIpConfigurations,omitempty"` + // Listener port. Port *int32 `json:"port,omitempty"` @@ -329,6 +333,15 @@ type LoadBalancerConfiguration struct { SQLVirtualMachineInstances []*string `json:"sqlVirtualMachineInstances,omitempty"` } +// MultiSubnetIPConfiguration - Multi subnet ip configuration for an availability group listener. +type MultiSubnetIPConfiguration struct { + // REQUIRED; Private IP address. + PrivateIPAddress *PrivateIPAddress `json:"privateIpAddress,omitempty"` + + // REQUIRED; SQL virtual machine instance resource id that are enrolled into the availability group listener. + SQLVirtualMachineInstance *string `json:"sqlVirtualMachineInstance,omitempty"` +} + // Operation - SQL REST API operation definition. type Operation struct { // READ-ONLY; The localized display information for this particular operation / action. @@ -393,9 +406,15 @@ type Properties struct { // Auto patching settings for applying critical security updates to SQL virtual machine. AutoPatchingSettings *AutoPatchingSettings `json:"autoPatchingSettings,omitempty"` + // Enable automatic upgrade of Sql IaaS extension Agent. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + // Key vault credential settings. KeyVaultCredentialSettings *KeyVaultCredentialSettings `json:"keyVaultCredentialSettings,omitempty"` + // SQL IaaS Agent least privilege mode. + LeastPrivilegeMode *LeastPrivilegeMode `json:"leastPrivilegeMode,omitempty"` + // SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. SQLImageOffer *string `json:"sqlImageOffer,omitempty"` @@ -423,34 +442,13 @@ type Properties struct { // Domain credentials for setting up Windows Server Failover Cluster for SQL availability group. WsfcDomainCredentials *WsfcDomainCredentials `json:"wsfcDomainCredentials,omitempty"` + // Domain credentials for setting up Windows Server Failover Cluster for SQL availability group. + WsfcStaticIP *string `json:"wsfcStaticIp,omitempty"` + // READ-ONLY; Provisioning state to track the async operation status. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } -// ProxyResource - ARM proxy resource. -type ProxyResource struct { - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Resource - ARM resource. -type Resource struct { - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - // ResourceIdentity - Azure Active Directory identity configuration for a resource. type ResourceIdentity struct { // The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal @@ -484,6 +482,12 @@ type SQLInstanceSettings struct { // SQL Server Collation. Collation *string `json:"collation,omitempty"` + // SQL Server IFI. + IsIfiEnabled *bool `json:"isIfiEnabled,omitempty"` + + // SQL Server LPIM. + IsLpimEnabled *bool `json:"isLpimEnabled,omitempty"` + // SQL Server Optimize for Adhoc workloads. IsOptimizeForAdHocWorkloadsEnabled *bool `json:"isOptimizeForAdHocWorkloadsEnabled,omitempty"` @@ -518,27 +522,34 @@ type SQLStorageUpdateSettings struct { StartingDeviceID *int32 `json:"startingDeviceId,omitempty"` } +// SQLTempDbSettings - Set tempDb storage settings for SQL Server. type SQLTempDbSettings struct { - // SQL Server default file count + // SQL Server tempdb data file count DataFileCount *int32 `json:"dataFileCount,omitempty"` - // SQL Server default file size + // SQL Server tempdb data file size DataFileSize *int32 `json:"dataFileSize,omitempty"` - // SQL Server default file autoGrowth size + // SQL Server tempdb data file autoGrowth size DataGrowth *int32 `json:"dataGrowth,omitempty"` // SQL Server default file path DefaultFilePath *string `json:"defaultFilePath,omitempty"` - // SQL Server default file size + // SQL Server tempdb log file size LogFileSize *int32 `json:"logFileSize,omitempty"` - // SQL Server default file autoGrowth size + // SQL Server tempdb log file autoGrowth size LogGrowth *int32 `json:"logGrowth,omitempty"` // Logical Unit Numbers for the disks. Luns []*int32 `json:"luns,omitempty"` + + // SQL Server tempdb persist folder choice + PersistFolder *bool `json:"persistFolder,omitempty"` + + // SQL Server tempdb persist folder location + PersistFolderPath *string `json:"persistFolderPath,omitempty"` } // SQLVirtualMachine - A SQL virtual machine. @@ -632,6 +643,7 @@ type SQLWorkloadTypeUpdateSettings struct { SQLWorkloadType *SQLWorkloadType `json:"sqlWorkloadType,omitempty"` } +// Schedule - Set assessment schedule for SQL Server. type Schedule struct { // Day of the week to run assessment. DayOfWeek *AssessmentDayOfWeek `json:"dayOfWeek,omitempty"` @@ -710,24 +722,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// TrackedResource - ARM tracked top level resource. -type TrackedResource struct { - // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - // Update - An update to a SQL virtual machine. type Update struct { // Resource tags. @@ -755,6 +749,9 @@ type WsfcDomainProfile struct { // in the cluster. ClusterOperatorAccount *string `json:"clusterOperatorAccount,omitempty"` + // Cluster subnet type. + ClusterSubnetType *ClusterSubnetType `json:"clusterSubnetType,omitempty"` + // Fully qualified name of the domain. DomainFqdn *string `json:"domainFqdn,omitempty"` diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go new file mode 100644 index 000000000000..fe970d8a5c14 --- /dev/null +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go @@ -0,0 +1,1584 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsqlvirtualmachine + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdditionalFeaturesServerConfigurations. +func (a AdditionalFeaturesServerConfigurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isRServicesEnabled", a.IsRServicesEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalFeaturesServerConfigurations. +func (a *AdditionalFeaturesServerConfigurations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isRServicesEnabled": + err = unpopulate(val, "IsRServicesEnabled", &a.IsRServicesEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgConfiguration. +func (a AgConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "replicas", a.Replicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgConfiguration. +func (a *AgConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replicas": + err = unpopulate(val, "Replicas", &a.Replicas) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgReplica. +func (a AgReplica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commit", a.Commit) + populate(objectMap, "failover", a.Failover) + populate(objectMap, "readableSecondary", a.ReadableSecondary) + populate(objectMap, "role", a.Role) + populate(objectMap, "sqlVirtualMachineInstanceId", a.SQLVirtualMachineInstanceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgReplica. +func (a *AgReplica) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "commit": + err = unpopulate(val, "Commit", &a.Commit) + delete(rawMsg, key) + case "failover": + err = unpopulate(val, "Failover", &a.Failover) + delete(rawMsg, key) + case "readableSecondary": + err = unpopulate(val, "ReadableSecondary", &a.ReadableSecondary) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "sqlVirtualMachineInstanceId": + err = unpopulate(val, "SQLVirtualMachineInstanceID", &a.SQLVirtualMachineInstanceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssessmentSettings. +func (a AssessmentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enable", a.Enable) + populate(objectMap, "runImmediately", a.RunImmediately) + populate(objectMap, "schedule", a.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentSettings. +func (a *AssessmentSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enable": + err = unpopulate(val, "Enable", &a.Enable) + delete(rawMsg, key) + case "runImmediately": + err = unpopulate(val, "RunImmediately", &a.RunImmediately) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &a.Schedule) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoBackupSettings. +func (a AutoBackupSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupScheduleType", a.BackupScheduleType) + populate(objectMap, "backupSystemDbs", a.BackupSystemDbs) + populate(objectMap, "daysOfWeek", a.DaysOfWeek) + populate(objectMap, "enable", a.Enable) + populate(objectMap, "enableEncryption", a.EnableEncryption) + populate(objectMap, "fullBackupFrequency", a.FullBackupFrequency) + populate(objectMap, "fullBackupStartTime", a.FullBackupStartTime) + populate(objectMap, "fullBackupWindowHours", a.FullBackupWindowHours) + populate(objectMap, "logBackupFrequency", a.LogBackupFrequency) + populate(objectMap, "password", a.Password) + populate(objectMap, "retentionPeriod", a.RetentionPeriod) + populate(objectMap, "storageAccessKey", a.StorageAccessKey) + populate(objectMap, "storageAccountUrl", a.StorageAccountURL) + populate(objectMap, "storageContainerName", a.StorageContainerName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoBackupSettings. +func (a *AutoBackupSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupScheduleType": + err = unpopulate(val, "BackupScheduleType", &a.BackupScheduleType) + delete(rawMsg, key) + case "backupSystemDbs": + err = unpopulate(val, "BackupSystemDbs", &a.BackupSystemDbs) + delete(rawMsg, key) + case "daysOfWeek": + err = unpopulate(val, "DaysOfWeek", &a.DaysOfWeek) + delete(rawMsg, key) + case "enable": + err = unpopulate(val, "Enable", &a.Enable) + delete(rawMsg, key) + case "enableEncryption": + err = unpopulate(val, "EnableEncryption", &a.EnableEncryption) + delete(rawMsg, key) + case "fullBackupFrequency": + err = unpopulate(val, "FullBackupFrequency", &a.FullBackupFrequency) + delete(rawMsg, key) + case "fullBackupStartTime": + err = unpopulate(val, "FullBackupStartTime", &a.FullBackupStartTime) + delete(rawMsg, key) + case "fullBackupWindowHours": + err = unpopulate(val, "FullBackupWindowHours", &a.FullBackupWindowHours) + delete(rawMsg, key) + case "logBackupFrequency": + err = unpopulate(val, "LogBackupFrequency", &a.LogBackupFrequency) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &a.Password) + delete(rawMsg, key) + case "retentionPeriod": + err = unpopulate(val, "RetentionPeriod", &a.RetentionPeriod) + delete(rawMsg, key) + case "storageAccessKey": + err = unpopulate(val, "StorageAccessKey", &a.StorageAccessKey) + delete(rawMsg, key) + case "storageAccountUrl": + err = unpopulate(val, "StorageAccountURL", &a.StorageAccountURL) + delete(rawMsg, key) + case "storageContainerName": + err = unpopulate(val, "StorageContainerName", &a.StorageContainerName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoPatchingSettings. +func (a AutoPatchingSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dayOfWeek", a.DayOfWeek) + populate(objectMap, "enable", a.Enable) + populate(objectMap, "maintenanceWindowDuration", a.MaintenanceWindowDuration) + populate(objectMap, "maintenanceWindowStartingHour", a.MaintenanceWindowStartingHour) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoPatchingSettings. +func (a *AutoPatchingSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &a.DayOfWeek) + delete(rawMsg, key) + case "enable": + err = unpopulate(val, "Enable", &a.Enable) + delete(rawMsg, key) + case "maintenanceWindowDuration": + err = unpopulate(val, "MaintenanceWindowDuration", &a.MaintenanceWindowDuration) + delete(rawMsg, key) + case "maintenanceWindowStartingHour": + err = unpopulate(val, "MaintenanceWindowStartingHour", &a.MaintenanceWindowStartingHour) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListener. +func (a AvailabilityGroupListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityGroupListener. +func (a *AvailabilityGroupListener) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListenerListResult. +func (a AvailabilityGroupListenerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityGroupListenerListResult. +func (a *AvailabilityGroupListenerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListenerProperties. +func (a AvailabilityGroupListenerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityGroupConfiguration", a.AvailabilityGroupConfiguration) + populate(objectMap, "availabilityGroupName", a.AvailabilityGroupName) + populate(objectMap, "createDefaultAvailabilityGroupIfNotExist", a.CreateDefaultAvailabilityGroupIfNotExist) + populate(objectMap, "loadBalancerConfigurations", a.LoadBalancerConfigurations) + populate(objectMap, "multiSubnetIpConfigurations", a.MultiSubnetIPConfigurations) + populate(objectMap, "port", a.Port) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilityGroupListenerProperties. +func (a *AvailabilityGroupListenerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupConfiguration": + err = unpopulate(val, "AvailabilityGroupConfiguration", &a.AvailabilityGroupConfiguration) + delete(rawMsg, key) + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &a.AvailabilityGroupName) + delete(rawMsg, key) + case "createDefaultAvailabilityGroupIfNotExist": + err = unpopulate(val, "CreateDefaultAvailabilityGroupIfNotExist", &a.CreateDefaultAvailabilityGroupIfNotExist) + delete(rawMsg, key) + case "loadBalancerConfigurations": + err = unpopulate(val, "LoadBalancerConfigurations", &a.LoadBalancerConfigurations) + delete(rawMsg, key) + case "multiSubnetIpConfigurations": + err = unpopulate(val, "MultiSubnetIPConfigurations", &a.MultiSubnetIPConfigurations) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &a.Port) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Group. +func (g Group) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Group. +func (g *Group) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupListResult. +func (g GroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupListResult. +func (g *GroupListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupProperties. +func (g GroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterConfiguration", g.ClusterConfiguration) + populate(objectMap, "clusterManagerType", g.ClusterManagerType) + populate(objectMap, "provisioningState", g.ProvisioningState) + populate(objectMap, "sqlImageOffer", g.SQLImageOffer) + populate(objectMap, "sqlImageSku", g.SQLImageSKU) + populate(objectMap, "scaleType", g.ScaleType) + populate(objectMap, "wsfcDomainProfile", g.WsfcDomainProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupProperties. +func (g *GroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterConfiguration": + err = unpopulate(val, "ClusterConfiguration", &g.ClusterConfiguration) + delete(rawMsg, key) + case "clusterManagerType": + err = unpopulate(val, "ClusterManagerType", &g.ClusterManagerType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + case "sqlImageOffer": + err = unpopulate(val, "SQLImageOffer", &g.SQLImageOffer) + delete(rawMsg, key) + case "sqlImageSku": + err = unpopulate(val, "SQLImageSKU", &g.SQLImageSKU) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &g.ScaleType) + delete(rawMsg, key) + case "wsfcDomainProfile": + err = unpopulate(val, "WsfcDomainProfile", &g.WsfcDomainProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupUpdate. +func (g GroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", g.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupUpdate. +func (g *GroupUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultCredentialSettings. +func (k KeyVaultCredentialSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureKeyVaultUrl", k.AzureKeyVaultURL) + populate(objectMap, "credentialName", k.CredentialName) + populate(objectMap, "enable", k.Enable) + populate(objectMap, "servicePrincipalName", k.ServicePrincipalName) + populate(objectMap, "servicePrincipalSecret", k.ServicePrincipalSecret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultCredentialSettings. +func (k *KeyVaultCredentialSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureKeyVaultUrl": + err = unpopulate(val, "AzureKeyVaultURL", &k.AzureKeyVaultURL) + delete(rawMsg, key) + case "credentialName": + err = unpopulate(val, "CredentialName", &k.CredentialName) + delete(rawMsg, key) + case "enable": + err = unpopulate(val, "Enable", &k.Enable) + delete(rawMsg, key) + case "servicePrincipalName": + err = unpopulate(val, "ServicePrincipalName", &k.ServicePrincipalName) + delete(rawMsg, key) + case "servicePrincipalSecret": + err = unpopulate(val, "ServicePrincipalSecret", &k.ServicePrincipalSecret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListResult. +func (l ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. +func (l *ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfiguration. +func (l LoadBalancerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loadBalancerResourceId", l.LoadBalancerResourceID) + populate(objectMap, "privateIpAddress", l.PrivateIPAddress) + populate(objectMap, "probePort", l.ProbePort) + populate(objectMap, "publicIpAddressResourceId", l.PublicIPAddressResourceID) + populate(objectMap, "sqlVirtualMachineInstances", l.SQLVirtualMachineInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerConfiguration. +func (l *LoadBalancerConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "loadBalancerResourceId": + err = unpopulate(val, "LoadBalancerResourceID", &l.LoadBalancerResourceID) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &l.PrivateIPAddress) + delete(rawMsg, key) + case "probePort": + err = unpopulate(val, "ProbePort", &l.ProbePort) + delete(rawMsg, key) + case "publicIpAddressResourceId": + err = unpopulate(val, "PublicIPAddressResourceID", &l.PublicIPAddressResourceID) + delete(rawMsg, key) + case "sqlVirtualMachineInstances": + err = unpopulate(val, "SQLVirtualMachineInstances", &l.SQLVirtualMachineInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MultiSubnetIPConfiguration. +func (m MultiSubnetIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateIpAddress", m.PrivateIPAddress) + populate(objectMap, "sqlVirtualMachineInstance", m.SQLVirtualMachineInstance) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MultiSubnetIPConfiguration. +func (m *MultiSubnetIPConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &m.PrivateIPAddress) + delete(rawMsg, key) + case "sqlVirtualMachineInstance": + err = unpopulate(val, "SQLVirtualMachineInstance", &m.SQLVirtualMachineInstance) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateIPAddress. +func (p PrivateIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipAddress", p.IPAddress) + populate(objectMap, "subnetResourceId", p.SubnetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateIPAddress. +func (p *PrivateIPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddress": + err = unpopulate(val, "IPAddress", &p.IPAddress) + delete(rawMsg, key) + case "subnetResourceId": + err = unpopulate(val, "SubnetResourceID", &p.SubnetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentSettings", p.AssessmentSettings) + populate(objectMap, "autoBackupSettings", p.AutoBackupSettings) + populate(objectMap, "autoPatchingSettings", p.AutoPatchingSettings) + populate(objectMap, "enableAutomaticUpgrade", p.EnableAutomaticUpgrade) + populate(objectMap, "keyVaultCredentialSettings", p.KeyVaultCredentialSettings) + populate(objectMap, "leastPrivilegeMode", p.LeastPrivilegeMode) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "sqlImageOffer", p.SQLImageOffer) + populate(objectMap, "sqlImageSku", p.SQLImageSKU) + populate(objectMap, "sqlManagement", p.SQLManagement) + populate(objectMap, "sqlServerLicenseType", p.SQLServerLicenseType) + populate(objectMap, "sqlVirtualMachineGroupResourceId", p.SQLVirtualMachineGroupResourceID) + populate(objectMap, "serverConfigurationsManagementSettings", p.ServerConfigurationsManagementSettings) + populate(objectMap, "storageConfigurationSettings", p.StorageConfigurationSettings) + populate(objectMap, "virtualMachineResourceId", p.VirtualMachineResourceID) + populate(objectMap, "wsfcDomainCredentials", p.WsfcDomainCredentials) + populate(objectMap, "wsfcStaticIp", p.WsfcStaticIP) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentSettings": + err = unpopulate(val, "AssessmentSettings", &p.AssessmentSettings) + delete(rawMsg, key) + case "autoBackupSettings": + err = unpopulate(val, "AutoBackupSettings", &p.AutoBackupSettings) + delete(rawMsg, key) + case "autoPatchingSettings": + err = unpopulate(val, "AutoPatchingSettings", &p.AutoPatchingSettings) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &p.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "keyVaultCredentialSettings": + err = unpopulate(val, "KeyVaultCredentialSettings", &p.KeyVaultCredentialSettings) + delete(rawMsg, key) + case "leastPrivilegeMode": + err = unpopulate(val, "LeastPrivilegeMode", &p.LeastPrivilegeMode) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "sqlImageOffer": + err = unpopulate(val, "SQLImageOffer", &p.SQLImageOffer) + delete(rawMsg, key) + case "sqlImageSku": + err = unpopulate(val, "SQLImageSKU", &p.SQLImageSKU) + delete(rawMsg, key) + case "sqlManagement": + err = unpopulate(val, "SQLManagement", &p.SQLManagement) + delete(rawMsg, key) + case "sqlServerLicenseType": + err = unpopulate(val, "SQLServerLicenseType", &p.SQLServerLicenseType) + delete(rawMsg, key) + case "sqlVirtualMachineGroupResourceId": + err = unpopulate(val, "SQLVirtualMachineGroupResourceID", &p.SQLVirtualMachineGroupResourceID) + delete(rawMsg, key) + case "serverConfigurationsManagementSettings": + err = unpopulate(val, "ServerConfigurationsManagementSettings", &p.ServerConfigurationsManagementSettings) + delete(rawMsg, key) + case "storageConfigurationSettings": + err = unpopulate(val, "StorageConfigurationSettings", &p.StorageConfigurationSettings) + delete(rawMsg, key) + case "virtualMachineResourceId": + err = unpopulate(val, "VirtualMachineResourceID", &p.VirtualMachineResourceID) + delete(rawMsg, key) + case "wsfcDomainCredentials": + err = unpopulate(val, "WsfcDomainCredentials", &p.WsfcDomainCredentials) + delete(rawMsg, key) + case "wsfcStaticIp": + err = unpopulate(val, "WsfcStaticIP", &p.WsfcStaticIP) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. +func (r ResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "tenantId", r.TenantID) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. +func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &r.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLConnectivityUpdateSettings. +func (s SQLConnectivityUpdateSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectivityType", s.ConnectivityType) + populate(objectMap, "port", s.Port) + populate(objectMap, "sqlAuthUpdatePassword", s.SQLAuthUpdatePassword) + populate(objectMap, "sqlAuthUpdateUserName", s.SQLAuthUpdateUserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLConnectivityUpdateSettings. +func (s *SQLConnectivityUpdateSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectivityType": + err = unpopulate(val, "ConnectivityType", &s.ConnectivityType) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + case "sqlAuthUpdatePassword": + err = unpopulate(val, "SQLAuthUpdatePassword", &s.SQLAuthUpdatePassword) + delete(rawMsg, key) + case "sqlAuthUpdateUserName": + err = unpopulate(val, "SQLAuthUpdateUserName", &s.SQLAuthUpdateUserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLInstanceSettings. +func (s SQLInstanceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "collation", s.Collation) + populate(objectMap, "isIfiEnabled", s.IsIfiEnabled) + populate(objectMap, "isLpimEnabled", s.IsLpimEnabled) + populate(objectMap, "isOptimizeForAdHocWorkloadsEnabled", s.IsOptimizeForAdHocWorkloadsEnabled) + populate(objectMap, "maxDop", s.MaxDop) + populate(objectMap, "maxServerMemoryMB", s.MaxServerMemoryMB) + populate(objectMap, "minServerMemoryMB", s.MinServerMemoryMB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLInstanceSettings. +func (s *SQLInstanceSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collation": + err = unpopulate(val, "Collation", &s.Collation) + delete(rawMsg, key) + case "isIfiEnabled": + err = unpopulate(val, "IsIfiEnabled", &s.IsIfiEnabled) + delete(rawMsg, key) + case "isLpimEnabled": + err = unpopulate(val, "IsLpimEnabled", &s.IsLpimEnabled) + delete(rawMsg, key) + case "isOptimizeForAdHocWorkloadsEnabled": + err = unpopulate(val, "IsOptimizeForAdHocWorkloadsEnabled", &s.IsOptimizeForAdHocWorkloadsEnabled) + delete(rawMsg, key) + case "maxDop": + err = unpopulate(val, "MaxDop", &s.MaxDop) + delete(rawMsg, key) + case "maxServerMemoryMB": + err = unpopulate(val, "MaxServerMemoryMB", &s.MaxServerMemoryMB) + delete(rawMsg, key) + case "minServerMemoryMB": + err = unpopulate(val, "MinServerMemoryMB", &s.MinServerMemoryMB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStorageSettings. +func (s SQLStorageSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultFilePath", s.DefaultFilePath) + populate(objectMap, "luns", s.Luns) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStorageSettings. +func (s *SQLStorageSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultFilePath": + err = unpopulate(val, "DefaultFilePath", &s.DefaultFilePath) + delete(rawMsg, key) + case "luns": + err = unpopulate(val, "Luns", &s.Luns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStorageUpdateSettings. +func (s SQLStorageUpdateSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskConfigurationType", s.DiskConfigurationType) + populate(objectMap, "diskCount", s.DiskCount) + populate(objectMap, "startingDeviceId", s.StartingDeviceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStorageUpdateSettings. +func (s *SQLStorageUpdateSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskConfigurationType": + err = unpopulate(val, "DiskConfigurationType", &s.DiskConfigurationType) + delete(rawMsg, key) + case "diskCount": + err = unpopulate(val, "DiskCount", &s.DiskCount) + delete(rawMsg, key) + case "startingDeviceId": + err = unpopulate(val, "StartingDeviceID", &s.StartingDeviceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLTempDbSettings. +func (s SQLTempDbSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataFileCount", s.DataFileCount) + populate(objectMap, "dataFileSize", s.DataFileSize) + populate(objectMap, "dataGrowth", s.DataGrowth) + populate(objectMap, "defaultFilePath", s.DefaultFilePath) + populate(objectMap, "logFileSize", s.LogFileSize) + populate(objectMap, "logGrowth", s.LogGrowth) + populate(objectMap, "luns", s.Luns) + populate(objectMap, "persistFolder", s.PersistFolder) + populate(objectMap, "persistFolderPath", s.PersistFolderPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTempDbSettings. +func (s *SQLTempDbSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataFileCount": + err = unpopulate(val, "DataFileCount", &s.DataFileCount) + delete(rawMsg, key) + case "dataFileSize": + err = unpopulate(val, "DataFileSize", &s.DataFileSize) + delete(rawMsg, key) + case "dataGrowth": + err = unpopulate(val, "DataGrowth", &s.DataGrowth) + delete(rawMsg, key) + case "defaultFilePath": + err = unpopulate(val, "DefaultFilePath", &s.DefaultFilePath) + delete(rawMsg, key) + case "logFileSize": + err = unpopulate(val, "LogFileSize", &s.LogFileSize) + delete(rawMsg, key) + case "logGrowth": + err = unpopulate(val, "LogGrowth", &s.LogGrowth) + delete(rawMsg, key) + case "luns": + err = unpopulate(val, "Luns", &s.Luns) + delete(rawMsg, key) + case "persistFolder": + err = unpopulate(val, "PersistFolder", &s.PersistFolder) + delete(rawMsg, key) + case "persistFolderPath": + err = unpopulate(val, "PersistFolderPath", &s.PersistFolderPath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLVirtualMachine. +func (s SQLVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVirtualMachine. +func (s *SQLVirtualMachine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLWorkloadTypeUpdateSettings. +func (s SQLWorkloadTypeUpdateSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sqlWorkloadType", s.SQLWorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLWorkloadTypeUpdateSettings. +func (s *SQLWorkloadTypeUpdateSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sqlWorkloadType": + err = unpopulate(val, "SQLWorkloadType", &s.SQLWorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Schedule. +func (s Schedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dayOfWeek", s.DayOfWeek) + populate(objectMap, "enable", s.Enable) + populate(objectMap, "monthlyOccurrence", s.MonthlyOccurrence) + populate(objectMap, "startTime", s.StartTime) + populate(objectMap, "weeklyInterval", s.WeeklyInterval) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Schedule. +func (s *Schedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &s.DayOfWeek) + delete(rawMsg, key) + case "enable": + err = unpopulate(val, "Enable", &s.Enable) + delete(rawMsg, key) + case "monthlyOccurrence": + err = unpopulate(val, "MonthlyOccurrence", &s.MonthlyOccurrence) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + case "weeklyInterval": + err = unpopulate(val, "WeeklyInterval", &s.WeeklyInterval) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationsManagementSettings. +func (s ServerConfigurationsManagementSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalFeaturesServerConfigurations", s.AdditionalFeaturesServerConfigurations) + populate(objectMap, "sqlConnectivityUpdateSettings", s.SQLConnectivityUpdateSettings) + populate(objectMap, "sqlInstanceSettings", s.SQLInstanceSettings) + populate(objectMap, "sqlStorageUpdateSettings", s.SQLStorageUpdateSettings) + populate(objectMap, "sqlWorkloadTypeUpdateSettings", s.SQLWorkloadTypeUpdateSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationsManagementSettings. +func (s *ServerConfigurationsManagementSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalFeaturesServerConfigurations": + err = unpopulate(val, "AdditionalFeaturesServerConfigurations", &s.AdditionalFeaturesServerConfigurations) + delete(rawMsg, key) + case "sqlConnectivityUpdateSettings": + err = unpopulate(val, "SQLConnectivityUpdateSettings", &s.SQLConnectivityUpdateSettings) + delete(rawMsg, key) + case "sqlInstanceSettings": + err = unpopulate(val, "SQLInstanceSettings", &s.SQLInstanceSettings) + delete(rawMsg, key) + case "sqlStorageUpdateSettings": + err = unpopulate(val, "SQLStorageUpdateSettings", &s.SQLStorageUpdateSettings) + delete(rawMsg, key) + case "sqlWorkloadTypeUpdateSettings": + err = unpopulate(val, "SQLWorkloadTypeUpdateSettings", &s.SQLWorkloadTypeUpdateSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageConfigurationSettings. +func (s StorageConfigurationSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "diskConfigurationType", s.DiskConfigurationType) + populate(objectMap, "sqlDataSettings", s.SQLDataSettings) + populate(objectMap, "sqlLogSettings", s.SQLLogSettings) + populate(objectMap, "sqlSystemDbOnDataDisk", s.SQLSystemDbOnDataDisk) + populate(objectMap, "sqlTempDbSettings", s.SQLTempDbSettings) + populate(objectMap, "storageWorkloadType", s.StorageWorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageConfigurationSettings. +func (s *StorageConfigurationSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskConfigurationType": + err = unpopulate(val, "DiskConfigurationType", &s.DiskConfigurationType) + delete(rawMsg, key) + case "sqlDataSettings": + err = unpopulate(val, "SQLDataSettings", &s.SQLDataSettings) + delete(rawMsg, key) + case "sqlLogSettings": + err = unpopulate(val, "SQLLogSettings", &s.SQLLogSettings) + delete(rawMsg, key) + case "sqlSystemDbOnDataDisk": + err = unpopulate(val, "SQLSystemDbOnDataDisk", &s.SQLSystemDbOnDataDisk) + delete(rawMsg, key) + case "sqlTempDbSettings": + err = unpopulate(val, "SQLTempDbSettings", &s.SQLTempDbSettings) + delete(rawMsg, key) + case "storageWorkloadType": + err = unpopulate(val, "StorageWorkloadType", &s.StorageWorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Update. +func (u Update) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Update. +func (u *Update) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WsfcDomainCredentials. +func (w WsfcDomainCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterBootstrapAccountPassword", w.ClusterBootstrapAccountPassword) + populate(objectMap, "clusterOperatorAccountPassword", w.ClusterOperatorAccountPassword) + populate(objectMap, "sqlServiceAccountPassword", w.SQLServiceAccountPassword) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WsfcDomainCredentials. +func (w *WsfcDomainCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterBootstrapAccountPassword": + err = unpopulate(val, "ClusterBootstrapAccountPassword", &w.ClusterBootstrapAccountPassword) + delete(rawMsg, key) + case "clusterOperatorAccountPassword": + err = unpopulate(val, "ClusterOperatorAccountPassword", &w.ClusterOperatorAccountPassword) + delete(rawMsg, key) + case "sqlServiceAccountPassword": + err = unpopulate(val, "SQLServiceAccountPassword", &w.SQLServiceAccountPassword) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WsfcDomainProfile. +func (w WsfcDomainProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clusterBootstrapAccount", w.ClusterBootstrapAccount) + populate(objectMap, "clusterOperatorAccount", w.ClusterOperatorAccount) + populate(objectMap, "clusterSubnetType", w.ClusterSubnetType) + populate(objectMap, "domainFqdn", w.DomainFqdn) + populate(objectMap, "fileShareWitnessPath", w.FileShareWitnessPath) + populate(objectMap, "ouPath", w.OuPath) + populate(objectMap, "sqlServiceAccount", w.SQLServiceAccount) + populate(objectMap, "storageAccountPrimaryKey", w.StorageAccountPrimaryKey) + populate(objectMap, "storageAccountUrl", w.StorageAccountURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WsfcDomainProfile. +func (w *WsfcDomainProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterBootstrapAccount": + err = unpopulate(val, "ClusterBootstrapAccount", &w.ClusterBootstrapAccount) + delete(rawMsg, key) + case "clusterOperatorAccount": + err = unpopulate(val, "ClusterOperatorAccount", &w.ClusterOperatorAccount) + delete(rawMsg, key) + case "clusterSubnetType": + err = unpopulate(val, "ClusterSubnetType", &w.ClusterSubnetType) + delete(rawMsg, key) + case "domainFqdn": + err = unpopulate(val, "DomainFqdn", &w.DomainFqdn) + delete(rawMsg, key) + case "fileShareWitnessPath": + err = unpopulate(val, "FileShareWitnessPath", &w.FileShareWitnessPath) + delete(rawMsg, key) + case "ouPath": + err = unpopulate(val, "OuPath", &w.OuPath) + delete(rawMsg, key) + case "sqlServiceAccount": + err = unpopulate(val, "SQLServiceAccount", &w.SQLServiceAccount) + delete(rawMsg, key) + case "storageAccountPrimaryKey": + err = unpopulate(val, "StorageAccountPrimaryKey", &w.StorageAccountPrimaryKey) + delete(rawMsg, key) + case "storageAccountUrl": + err = unpopulate(val, "StorageAccountURL", &w.StorageAccountURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_operations_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go similarity index 95% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_operations_client.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go index f443e17840bf..8796edc6a6ba 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_operations_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available SQL Virtual Machine Rest API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go similarity index 95% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_operations_client_test.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go index 6a858f8c55e4..dae17c934bac 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListOperation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListOperation.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_response_types.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go similarity index 99% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_response_types.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go index a3be98d03325..51b028b96de8 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_response_types.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_sqlvirtualmachines_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go similarity index 95% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_sqlvirtualmachines_client.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go index ba2ca90fc559..08306e25cb8c 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_sqlvirtualmachines_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine @@ -56,7 +57,7 @@ func NewSQLVirtualMachinesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -77,7 +78,7 @@ func (client *SQLVirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *SQLVirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVirtualMachine, options *SQLVirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -113,7 +114,7 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,7 +122,7 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -141,7 +142,7 @@ func (client *SQLVirtualMachinesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *SQLVirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -177,14 +178,14 @@ func (client *SQLVirtualMachinesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // Get - Gets a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -227,7 +228,7 @@ func (client *SQLVirtualMachinesClient) getCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,8 +244,7 @@ func (client *SQLVirtualMachinesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets all SQL virtual machines in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // options - SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.List method. func (client *SQLVirtualMachinesClient) NewListPager(options *SQLVirtualMachinesClientListOptions) *runtime.Pager[SQLVirtualMachinesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLVirtualMachinesClientListResponse]{ @@ -286,7 +286,7 @@ func (client *SQLVirtualMachinesClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,8 +302,7 @@ func (client *SQLVirtualMachinesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all SQL virtual machines in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // options - SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListByResourceGroup @@ -352,7 +351,7 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,8 +367,7 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupHandleResponse(resp * } // NewListBySQLVMGroupPager - Gets the list of sql virtual machines in a SQL virtual machine group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -423,7 +421,7 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +438,7 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupHandleResponse(resp *htt // BeginRedeploy - Uninstalls and reinstalls the SQL Iaas Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -460,7 +458,7 @@ func (client *SQLVirtualMachinesClient) BeginRedeploy(ctx context.Context, resou // Redeploy - Uninstalls and reinstalls the SQL Iaas Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *SQLVirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -496,14 +494,14 @@ func (client *SQLVirtualMachinesClient) redeployCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginStartAssessment - Starts Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -523,7 +521,7 @@ func (client *SQLVirtualMachinesClient) BeginStartAssessment(ctx context.Context // StartAssessment - Starts Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *SQLVirtualMachinesClient) startAssessment(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginStartAssessmentOptions) (*http.Response, error) { req, err := client.startAssessmentCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -559,14 +557,14 @@ func (client *SQLVirtualMachinesClient) startAssessmentCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // BeginUpdate - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -587,7 +585,7 @@ func (client *SQLVirtualMachinesClient) BeginUpdate(ctx context.Context, resourc // Update - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-07-01-preview func (client *SQLVirtualMachinesClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters Update, options *SQLVirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -623,7 +621,7 @@ func (client *SQLVirtualMachinesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go new file mode 100644 index 000000000000..42956b4e6c4a --- /dev/null +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go @@ -0,0 +1,520 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsqlvirtualmachine_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_NewListBySQLVMGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListBySQLVMGroupPager("testrg", "testvm", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_BeginStartAssessment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginStartAssessment(ctx, "testrg", "testvm", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/RedeploySqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_BeginRedeploy() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginRedeploy(ctx, "testrg", "testvm", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "testrg", "testvm", &armsqlvirtualmachine.SQLVirtualMachinesClientGetOptions{Expand: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineAndJoinsItToASqlVirtualMachineGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + SQLVirtualMachineGroupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/testvmgroup"), + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2"), + WsfcDomainCredentials: &armsqlvirtualmachine.WsfcDomainCredentials{ + ClusterBootstrapAccountPassword: to.Ptr(""), + ClusterOperatorAccountPassword: to.Ptr(""), + SQLServiceAccountPassword: to.Ptr(""), + }, + WsfcStaticIP: to.Ptr("10.0.0.7"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForAutomatedBackUpSettingsWithWeeklyAndDaysOfTheWeekToRunTheBackUp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ + BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), + BackupSystemDbs: to.Ptr(true), + DaysOfWeek: []*armsqlvirtualmachine.AutoBackupDaysOfWeek{ + to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekMonday), + to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekFriday)}, + Enable: to.Ptr(true), + EnableEncryption: to.Ptr(true), + FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeWeekly), + FullBackupStartTime: to.Ptr[int32](6), + FullBackupWindowHours: to.Ptr[int32](11), + LogBackupFrequency: to.Ptr[int32](10), + Password: to.Ptr(""), + RetentionPeriod: to.Ptr[int32](17), + StorageAccessKey: to.Ptr(""), + StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), + StorageContainerName: to.Ptr("testcontainer"), + }, + AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ + DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), + Enable: to.Ptr(true), + MaintenanceWindowDuration: to.Ptr[int32](60), + MaintenanceWindowStartingHour: to.Ptr[int32](2), + }, + KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ + Enable: to.Ptr(false), + }, + ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ + AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ + IsRServicesEnabled: to.Ptr(false), + }, + SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ + ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), + Port: to.Ptr[int32](1433), + SQLAuthUpdatePassword: to.Ptr(""), + SQLAuthUpdateUserName: to.Ptr("sqllogin"), + }, + SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ + DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), + DiskCount: to.Ptr[int32](1), + StartingDeviceID: to.Ptr[int32](2), + }, + SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ + SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), + }, + }, + SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), + SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), + SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToExtendDataLogOrTempDbStoragePool() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ + DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeEXTEND), + SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ + Luns: []*int32{ + to.Ptr[int32](2)}, + }, + }, + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToNewDataLogAndTempDbStoragePool() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ + DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), + SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ + DefaultFilePath: to.Ptr("F:\\folderpath\\"), + Luns: []*int32{ + to.Ptr[int32](0)}, + }, + SQLLogSettings: &armsqlvirtualmachine.SQLStorageSettings{ + DefaultFilePath: to.Ptr("G:\\folderpath\\"), + Luns: []*int32{ + to.Ptr[int32](1)}, + }, + SQLSystemDbOnDataDisk: to.Ptr(true), + SQLTempDbSettings: &armsqlvirtualmachine.SQLTempDbSettings{ + DataFileCount: to.Ptr[int32](8), + DataFileSize: to.Ptr[int32](256), + DataGrowth: to.Ptr[int32](512), + DefaultFilePath: to.Ptr("D:\\TEMP"), + LogFileSize: to.Ptr[int32](256), + LogGrowth: to.Ptr[int32](512), + }, + StorageWorkloadType: to.Ptr(armsqlvirtualmachine.StorageWorkloadTypeOLTP), + }, + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMaxParameters() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + AssessmentSettings: &armsqlvirtualmachine.AssessmentSettings{ + Enable: to.Ptr(true), + RunImmediately: to.Ptr(true), + Schedule: &armsqlvirtualmachine.Schedule{ + DayOfWeek: to.Ptr(armsqlvirtualmachine.AssessmentDayOfWeekSunday), + Enable: to.Ptr(true), + StartTime: to.Ptr("23:17"), + WeeklyInterval: to.Ptr[int32](1), + }, + }, + AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ + BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), + BackupSystemDbs: to.Ptr(true), + Enable: to.Ptr(true), + EnableEncryption: to.Ptr(true), + FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeDaily), + FullBackupStartTime: to.Ptr[int32](6), + FullBackupWindowHours: to.Ptr[int32](11), + LogBackupFrequency: to.Ptr[int32](10), + Password: to.Ptr(""), + RetentionPeriod: to.Ptr[int32](17), + StorageAccessKey: to.Ptr(""), + StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), + StorageContainerName: to.Ptr("testcontainer"), + }, + AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ + DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), + Enable: to.Ptr(true), + MaintenanceWindowDuration: to.Ptr[int32](60), + MaintenanceWindowStartingHour: to.Ptr[int32](2), + }, + EnableAutomaticUpgrade: to.Ptr(true), + KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ + Enable: to.Ptr(false), + }, + LeastPrivilegeMode: to.Ptr(armsqlvirtualmachine.LeastPrivilegeModeEnabled), + ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ + AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ + IsRServicesEnabled: to.Ptr(false), + }, + SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ + ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), + Port: to.Ptr[int32](1433), + SQLAuthUpdatePassword: to.Ptr(""), + SQLAuthUpdateUserName: to.Ptr("sqllogin"), + }, + SQLInstanceSettings: &armsqlvirtualmachine.SQLInstanceSettings{ + Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), + IsIfiEnabled: to.Ptr(true), + IsLpimEnabled: to.Ptr(true), + IsOptimizeForAdHocWorkloadsEnabled: to.Ptr(true), + MaxDop: to.Ptr[int32](8), + MaxServerMemoryMB: to.Ptr[int32](128), + MinServerMemoryMB: to.Ptr[int32](0), + }, + SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ + DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), + DiskCount: to.Ptr[int32](1), + StartingDeviceID: to.Ptr[int32](2), + }, + SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ + SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), + }, + }, + SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), + SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), + SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json +func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMinParameters() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ + Location: to.Ptr("northeurope"), + Properties: &armsqlvirtualmachine.Properties{ + VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "testrg", "testvm1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.Update{ + Tags: map[string]*string{ + "mytag": to.Ptr("myval"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json +func ExampleSQLVirtualMachinesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByResourceGroupPager("testrg", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_time_rfc3339.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go index e36acb76f88d..6680b2257477 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsqlvirtualmachine diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_availabilitygrouplisteners_client_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_availabilitygrouplisteners_client_test.go deleted file mode 100644 index 37d72a73ab88..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_availabilitygrouplisteners_client_test.go +++ /dev/null @@ -1,137 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsqlvirtualmachine_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testvmgroup", - "agl-test", - &armsqlvirtualmachine.AvailabilityGroupListenersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "testrg", - "testvmgroup", - "agl-test", - armsqlvirtualmachine.AvailabilityGroupListener{ - Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ - AvailabilityGroupName: to.Ptr("ag-test"), - LoadBalancerConfigurations: []*armsqlvirtualmachine.LoadBalancerConfiguration{ - { - LoadBalancerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test"), - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.1.0.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - ProbePort: to.Ptr[int32](59983), - SQLVirtualMachineInstances: []*string{ - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")}, - }}, - Port: to.Ptr[int32](1433), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testvmgroup", - "agl-test", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByGroupAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_NewListByGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGroupPager("testrg", - "testvmgroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachines_client_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachines_client_test.go deleted file mode 100644 index 95a3015930b1..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/ze_generated_example_sqlvirtualmachines_client_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsqlvirtualmachine_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/RedeploySqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginRedeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, - "testrg", - "testvm", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testvm", - &armsqlvirtualmachine.SQLVirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "testrg", - "testvm", - armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - SQLVirtualMachineGroupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/testvmgroup"), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2"), - WsfcDomainCredentials: &armsqlvirtualmachine.WsfcDomainCredentials{ - ClusterBootstrapAccountPassword: to.Ptr(""), - ClusterOperatorAccountPassword: to.Ptr(""), - SQLServiceAccountPassword: to.Ptr(""), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testvm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "testrg", - "testvm", - armsqlvirtualmachine.Update{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginStartAssessment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartAssessment(ctx, - "testrg", - "testvm", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models_serde.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models_serde.go deleted file mode 100644 index 3e7b54b42bdc..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/zz_generated_models_serde.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsqlvirtualmachine - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AgConfiguration. -func (a AgConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "replicas", a.Replicas) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoBackupSettings. -func (a AutoBackupSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupScheduleType", a.BackupScheduleType) - populate(objectMap, "backupSystemDbs", a.BackupSystemDbs) - populate(objectMap, "daysOfWeek", a.DaysOfWeek) - populate(objectMap, "enable", a.Enable) - populate(objectMap, "enableEncryption", a.EnableEncryption) - populate(objectMap, "fullBackupFrequency", a.FullBackupFrequency) - populate(objectMap, "fullBackupStartTime", a.FullBackupStartTime) - populate(objectMap, "fullBackupWindowHours", a.FullBackupWindowHours) - populate(objectMap, "logBackupFrequency", a.LogBackupFrequency) - populate(objectMap, "password", a.Password) - populate(objectMap, "retentionPeriod", a.RetentionPeriod) - populate(objectMap, "storageAccessKey", a.StorageAccessKey) - populate(objectMap, "storageAccountUrl", a.StorageAccountURL) - populate(objectMap, "storageContainerName", a.StorageContainerName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListenerProperties. -func (a AvailabilityGroupListenerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availabilityGroupConfiguration", a.AvailabilityGroupConfiguration) - populate(objectMap, "availabilityGroupName", a.AvailabilityGroupName) - populate(objectMap, "createDefaultAvailabilityGroupIfNotExist", a.CreateDefaultAvailabilityGroupIfNotExist) - populate(objectMap, "loadBalancerConfigurations", a.LoadBalancerConfigurations) - populate(objectMap, "port", a.Port) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Group. -func (g Group) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", g.ID) - populate(objectMap, "location", g.Location) - populate(objectMap, "name", g.Name) - populate(objectMap, "properties", g.Properties) - populate(objectMap, "systemData", g.SystemData) - populate(objectMap, "tags", g.Tags) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type GroupUpdate. -func (g GroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", g.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfiguration. -func (l LoadBalancerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "loadBalancerResourceId", l.LoadBalancerResourceID) - populate(objectMap, "privateIpAddress", l.PrivateIPAddress) - populate(objectMap, "probePort", l.ProbePort) - populate(objectMap, "publicIpAddressResourceId", l.PublicIPAddressResourceID) - populate(objectMap, "sqlVirtualMachineInstances", l.SQLVirtualMachineInstances) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLStorageSettings. -func (s SQLStorageSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultFilePath", s.DefaultFilePath) - populate(objectMap, "luns", s.Luns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLTempDbSettings. -func (s SQLTempDbSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataFileCount", s.DataFileCount) - populate(objectMap, "dataFileSize", s.DataFileSize) - populate(objectMap, "dataGrowth", s.DataGrowth) - populate(objectMap, "defaultFilePath", s.DefaultFilePath) - populate(objectMap, "logFileSize", s.LogFileSize) - populate(objectMap, "logGrowth", s.LogGrowth) - populate(objectMap, "luns", s.Luns) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLVirtualMachine. -func (s SQLVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Update. -func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", u.Tags) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/storage/azblob/blockblob/chunkwriting.go b/sdk/storage/azblob/blockblob/chunkwriting.go index 0ed98c403281..16927ecf895e 100644 --- a/sdk/storage/azblob/blockblob/chunkwriting.go +++ b/sdk/storage/azblob/blockblob/chunkwriting.go @@ -13,12 +13,12 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared" "io" "sync" "sync/atomic" "github.com/Azure/azure-sdk-for-go/sdk/internal/uuid" + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared" ) // blockWriter provides methods to upload blocks that represent a file to a server and commit them. @@ -181,8 +181,12 @@ func (c *copier) write(chunk copierChunk) { stageBlockOptions := c.o.getStageBlockOptions() _, err := c.to.StageBlock(c.ctx, chunk.id, shared.NopCloser(bytes.NewReader(chunk.buffer[:chunk.length])), stageBlockOptions) if err != nil { - c.errCh <- fmt.Errorf("write error: %w", err) - return + select { + case c.errCh <- err: + // failed to stage block, cancel the copy + default: + // don't block the goroutine if there's a pending error + } } } diff --git a/sdk/storage/azblob/blockblob/chunkwriting_test.go b/sdk/storage/azblob/blockblob/chunkwriting_test.go new file mode 100644 index 000000000000..addc3fbd97be --- /dev/null +++ b/sdk/storage/azblob/blockblob/chunkwriting_test.go @@ -0,0 +1,372 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +package blockblob + +import ( + "context" + "crypto/md5" + "errors" + "fmt" + "io" + "math/rand" + "os" + "path/filepath" + "strings" + "sync/atomic" + "testing" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/internal/uuid" + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared" +) + +const finalFileName = "final" + +type fakeBlockWriter struct { + path string + block int32 + errOnBlock int32 + stageDelay time.Duration +} + +func newFakeBlockWriter() *fakeBlockWriter { + generatedUuid, _ := uuid.New() + f := &fakeBlockWriter{ + path: filepath.Join(os.TempDir(), generatedUuid.String()), + block: -1, + errOnBlock: -1, + } + + if err := os.MkdirAll(f.path, 0700); err != nil { + panic(err) + } + + return f +} + +func (f *fakeBlockWriter) StageBlock(_ context.Context, blockID string, body io.ReadSeekCloser, _ *StageBlockOptions) (StageBlockResponse, error) { + n := atomic.AddInt32(&f.block, 1) + + if f.stageDelay > 0 { + time.Sleep(f.stageDelay) + } + + if f.errOnBlock > -1 && n >= f.errOnBlock { + return StageBlockResponse{}, io.ErrNoProgress + } + + blockID = strings.Replace(blockID, "/", "slash", -1) + + fp, err := os.OpenFile(filepath.Join(f.path, blockID), os.O_CREATE+os.O_WRONLY, 0600) + if err != nil { + return StageBlockResponse{}, fmt.Errorf("could not create a stage block file: %s", err) + } + defer func(fp *os.File) { + _ = fp.Close() + }(fp) + + if _, err := io.Copy(fp, body); err != nil { + return StageBlockResponse{}, err + } + + return StageBlockResponse{}, nil +} + +func (f *fakeBlockWriter) CommitBlockList(_ context.Context, base64BlockIDs []string, _ *CommitBlockListOptions) (CommitBlockListResponse, error) { + dst, err := os.OpenFile(filepath.Join(f.path, finalFileName), os.O_CREATE+os.O_WRONLY, 0600) + if err != nil { + return CommitBlockListResponse{}, err + } + defer func(dst *os.File) { + _ = dst.Close() + }(dst) + + for _, id := range base64BlockIDs { + id = strings.Replace(id, "/", "slash", -1) + src, err := os.Open(filepath.Join(f.path, id)) + if err != nil { + return CommitBlockListResponse{}, fmt.Errorf("could not combine chunk %s: %s", id, err) + } + _, err = io.Copy(dst, src) + if err != nil { + return CommitBlockListResponse{}, fmt.Errorf("problem writing final file from chunks: %s", err) + } + err = src.Close() + if err != nil { + return CommitBlockListResponse{}, fmt.Errorf("problem closing the source : %s", err) + } + } + return CommitBlockListResponse{}, nil +} + +func (f *fakeBlockWriter) cleanup() { + err := os.RemoveAll(f.path) + if err != nil { + return + } +} + +func (f *fakeBlockWriter) final() string { + return filepath.Join(f.path, finalFileName) +} + +func createSrcFile(size int) (string, error) { + generatedUuid, err := uuid.New() + if err != nil { + return "", err + } + p := filepath.Join(os.TempDir(), generatedUuid.String()) + fp, err := os.OpenFile(p, os.O_CREATE+os.O_WRONLY, 0600) + if err != nil { + return "", fmt.Errorf("could not create source file: %s", err) + } + defer func(fp *os.File) { + _ = fp.Close() + }(fp) + + lr := &io.LimitedReader{R: rand.New(rand.NewSource(time.Now().UnixNano())), N: int64(size)} + copied, err := io.Copy(fp, lr) + switch { + case err != nil && err != io.EOF: + return "", fmt.Errorf("copying %v: %s", size, err) + case copied != int64(size): + return "", fmt.Errorf("copying %v: copied %d bytes, expected %d", size, copied, size) + } + return p, nil +} + +func fileMD5(p string) string { + f, err := os.Open(p) + if err != nil { + panic(err) + } + defer func(f *os.File) { + _ = f.Close() + + }(f) + + h := md5.New() + if _, err := io.Copy(h, f); err != nil { + panic(err) + } + + return fmt.Sprintf("%x", h.Sum(nil)) +} + +func TestGetErr(t *testing.T) { + t.Parallel() + + canceled, cancel := context.WithCancel(context.Background()) + cancel() + err := errors.New("error") + + tests := []struct { + desc string + ctx context.Context + err error + want error + }{ + {"No errors", context.Background(), nil, nil}, + {"Context was cancelled", canceled, nil, context.Canceled}, + {"Context was cancelled but had error", canceled, err, err}, + {"Err returned", context.Background(), err, err}, + } + + tm, err := shared.NewStaticBuffer(_1MiB, 1) + if err != nil { + panic(err) + } + + for _, test := range tests { + c := copier{ + errCh: make(chan error, 1), + ctx: test.ctx, + o: UploadStreamOptions{transferManager: tm}, + } + if test.err != nil { + c.errCh <- test.err + } + + got := c.getErr() + if test.want != got { + t.Errorf("TestGetErr(%s): got %v, want %v", test.desc, got, test.want) + } + } +} + +func TestSlowDestCopyFrom(t *testing.T) { + p, err := createSrcFile(_1MiB + 500*1024) //This should cause 2 reads + if err != nil { + panic(err) + } + defer func(name string) { + _ = os.Remove(name) + }(p) + + from, err := os.Open(p) + if err != nil { + panic(err) + } + defer from.Close() + + br := newFakeBlockWriter() + defer br.cleanup() + + br.stageDelay = 200 * time.Millisecond + br.errOnBlock = 0 + + errs := make(chan error, 1) + go func() { + _, err := copyFromReader(context.Background(), from, br, UploadStreamOptions{}) + errs <- err + }() + + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + select { + case <-ctx.Done(): + failMsg := "TestSlowDestCopyFrom(slow writes shouldn't cause deadlock) failed: Context expired, copy deadlocked" + t.Error(failMsg) + case <-errs: + return + } +} + +func TestCopyFromReader(t *testing.T) { + t.Parallel() + + canceled, cancel := context.WithCancel(context.Background()) + cancel() + + spm, err := shared.NewSyncPool(_1MiB, 2) + if err != nil { + panic(err) + } + defer spm.Close() + + tests := []struct { + desc string + ctx context.Context + o UploadStreamOptions + fileSize int + uploadErr bool + err bool + }{ + { + desc: "context was cancelled", + ctx: canceled, + err: true, + }, + { + desc: "Send file(0 KiB) with default UploadStreamOptions", + ctx: context.Background(), + fileSize: 0, + }, + { + desc: "Send file(10 KiB) with default UploadStreamOptions", + ctx: context.Background(), + fileSize: 10 * 1024, + }, + { + desc: "Send file(10 KiB) with default UploadStreamOptions set to azcopy settings", + ctx: context.Background(), + fileSize: 10 * 1024, + o: UploadStreamOptions{Concurrency: 5, BlockSize: 8 * 1024 * 1024}, + }, + { + desc: "Send file(1 MiB) with default UploadStreamOptions", + ctx: context.Background(), + fileSize: _1MiB, + }, + { + desc: "Send file(1 MiB) with default UploadStreamOptions set to azcopy settings", + ctx: context.Background(), + fileSize: _1MiB, + o: UploadStreamOptions{Concurrency: 5, BlockSize: 8 * 1024 * 1024}, + }, + { + desc: "Send file(1.5 MiB) with default UploadStreamOptions", + ctx: context.Background(), + fileSize: _1MiB + 500*1024, + }, + { + desc: "Send file(1.5 MiB) with 2 writers", + ctx: context.Background(), + fileSize: _1MiB + 500*1024 + 1, + o: UploadStreamOptions{Concurrency: 2}, + }, + { + desc: "Send file(12 MiB) with 3 writers and 1 MiB buffer and a write error", + ctx: context.Background(), + fileSize: 12 * _1MiB, + o: UploadStreamOptions{Concurrency: 2, BlockSize: _1MiB}, + uploadErr: true, + err: true, + }, + { + desc: "Send file(12 MiB) with 3 writers and 1.5 MiB buffer", + ctx: context.Background(), + fileSize: 12 * _1MiB, + o: UploadStreamOptions{Concurrency: 2, BlockSize: _1MiB + .5*_1MiB}, + }, + { + desc: "Send file(12 MiB) with default UploadStreamOptions set to azcopy settings", + ctx: context.Background(), + fileSize: 12 * _1MiB, + o: UploadStreamOptions{Concurrency: 5, BlockSize: 8 * 1024 * 1024}, + }, + { + desc: "Send file(12 MiB) with default UploadStreamOptions using SyncPool manager", + ctx: context.Background(), + fileSize: 12 * _1MiB, + o: UploadStreamOptions{ + transferManager: spm, + }, + }, + } + + for _, test := range tests { + p, err := createSrcFile(test.fileSize) + if err != nil { + panic(err) + } + defer func(name string) { + _ = os.Remove(name) + }(p) + + from, err := os.Open(p) + if err != nil { + panic(err) + } + + br := newFakeBlockWriter() + defer br.cleanup() + if test.uploadErr { + br.errOnBlock = 1 + } + + _, err = copyFromReader(test.ctx, from, br, test.o) + switch { + case err == nil && test.err: + t.Errorf("TestCopyFromReader(%s): got err == nil, want err != nil", test.desc) + continue + case err != nil && !test.err: + t.Errorf("TestCopyFromReader(%s): got err == %s, want err == nil", test.desc, err) + continue + case err != nil: + continue + } + + want := fileMD5(p) + got := fileMD5(br.final()) + + if got != want { + t.Errorf("TestCopyFromReader(%s): MD5 not the same: got %s, want %s", test.desc, got, want) + } + } +} diff --git a/sdk/storage/azblob/testdata/zt_chunkwriting_test.go b/sdk/storage/azblob/testdata/zt_chunkwriting_test.go deleted file mode 100644 index a1ff6ae1b049..000000000000 --- a/sdk/storage/azblob/testdata/zt_chunkwriting_test.go +++ /dev/null @@ -1,319 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package azblob_test - -//const finalFileName = "final" -// -////nolint -//type fakeBlockWriter struct { -// path string -// block int32 -// errOnBlock int32 -//} -// -////nolint -//func newFakeBlockWriter() *fakeBlockWriter { -// generatedUuid, _ := uuid.New() -// f := &fakeBlockWriter{ -// path: filepath.Join(os.TempDir(), generatedUuid.String()), -// block: -1, -// errOnBlock: -1, -// } -// -// if err := os.MkdirAll(f.path, 0700); err != nil { -// panic(err) -// } -// -// return f -//} -// -////nolint -//func (f *fakeBlockWriter) StageBlock(_ context.Context, blockID string, body io.ReadSeekCloser, _ *BlockBlobStageBlockOptions) (BlockBlobStageBlockResponse, error) { -// n := atomic.AddInt32(&f.block, 1) -// if n == f.errOnBlock { -// return BlockBlobStageBlockResponse{}, io.ErrNoProgress -// } -// -// blockID = strings.Replace(blockID, "/", "slash", -1) -// -// fp, err := os.OpenFile(filepath.Join(f.path, blockID), os.O_CREATE+os.O_WRONLY, 0600) -// if err != nil { -// return BlockBlobStageBlockResponse{}, fmt.Errorf("could not create a stage block file: %s", err) -// } -// defer func(fp *os.File) { -// _ = fp.Close() -// }(fp) -// -// if _, err := io.Copy(fp, body); err != nil { -// return BlockBlobStageBlockResponse{}, err -// } -// -// return BlockBlobStageBlockResponse{}, nil -//} -// -////nolint -//func (f *fakeBlockWriter) CommitBlockList(_ context.Context, base64BlockIDs []string, _ *BlockBlobCommitBlockListOptions) (BlockBlobCommitBlockListResponse, error) { -// dst, err := os.OpenFile(filepath.Join(f.path, finalFileName), os.O_CREATE+os.O_WRONLY, 0600) -// if err != nil { -// return BlockBlobCommitBlockListResponse{}, err -// } -// defer func(dst *os.File) { -// _ = dst.Close() -// }(dst) -// -// for _, id := range base64BlockIDs { -// id = strings.Replace(id, "/", "slash", -1) -// src, err := os.Open(filepath.Join(f.path, id)) -// if err != nil { -// return BlockBlobCommitBlockListResponse{}, fmt.Errorf("could not combine chunk %s: %s", id, err) -// } -// _, err = io.Copy(dst, src) -// if err != nil { -// return BlockBlobCommitBlockListResponse{}, fmt.Errorf("problem writing final file from chunks: %s", err) -// } -// err = src.Close() -// if err != nil { -// return BlockBlobCommitBlockListResponse{}, fmt.Errorf("problem closing the source : %s", err) -// } -// } -// return BlockBlobCommitBlockListResponse{}, nil -//} -// -////nolint -//func (f *fakeBlockWriter) cleanup() { -// err := os.RemoveAll(f.path) -// if err != nil { -// return -// } -//} -// -////nolint -//func (f *fakeBlockWriter) final() string { -// return filepath.Join(f.path, finalFileName) -//} -// -////nolint -//func createSrcFile(size int) (string, error) { -// generatedUuid, err := uuid.New() -// if err != nil { -// return "", err -// } -// p := filepath.Join(os.TempDir(), generatedUuid.String()) -// fp, err := os.OpenFile(p, os.O_CREATE+os.O_WRONLY, 0600) -// if err != nil { -// return "", fmt.Errorf("could not create source file: %s", err) -// } -// defer func(fp *os.File) { -// _ = fp.Close() -// }(fp) -// -// lr := &io.LimitedReader{R: rand.New(rand.NewSource(time.Now().UnixNano())), N: int64(size)} -// copied, err := io.Copy(fp, lr) -// switch { -// case err != nil && err != io.EOF: -// return "", fmt.Errorf("copying %v: %s", size, err) -// case copied != int64(size): -// return "", fmt.Errorf("copying %v: copied %d bytes, expected %d", size, copied, size) -// } -// return p, nil -//} -// -////nolint -//func fileMD5(p string) string { -// f, err := os.Open(p) -// if err != nil { -// panic(err) -// } -// defer func(f *os.File) { -// _ = f.Close() -// -// }(f) -// -// h := md5.New() -// if _, err := io.Copy(h, f); err != nil { -// panic(err) -// } -// -// return fmt.Sprintf("%x", h.Sum(nil)) -//} -// -////nolint -//func (s *azblobUnrecordedTestSuite) TestGetErr() { -// s.T().Parallel() -// -// canceled, cancel := context.WithCancel(context.Background()) -// cancel() -// err := errors.New("error") -// -// tests := []struct { -// desc string -// ctx context.Context -// err error -// want error -// }{ -// {"No errors", context.Background(), nil, nil}, -// {"Context was cancelled", canceled, nil, context.Canceled}, -// {"Context was cancelled but had error", canceled, err, err}, -// {"Err returned", context.Background(), err, err}, -// } -// -// tm, err := internal.NewStaticBuffer(_1MiB, 1) -// if err != nil { -// panic(err) -// } -// -// for _, test := range tests { -// c := copier{ -// errCh: make(chan error, 1), -// ctx: test.ctx, -// o: UploadStreamOptions{transferManager: tm}, -// } -// if test.err != nil { -// c.errCh <- test.err -// } -// -// got := c.getErr() -// if test.want != got { -// s.T().Errorf("TestGetErr(%s): got %v, want %v", test.desc, got, test.want) -// } -// } -//} -// -////nolint -//func (s *azblobUnrecordedTestSuite) TestCopyFromReader() { -// s.T().Parallel() -// -// canceled, cancel := context.WithCancel(context.Background()) -// cancel() -// -// spm, err := internal.NewSyncPool(_1MiB, 2) -// if err != nil { -// panic(err) -// } -// defer spm.Close() -// -// tests := []struct { -// desc string -// ctx context.Context -// o UploadStreamOptions -// fileSize int -// uploadErr bool -// err bool -// }{ -// { -// desc: "context was cancelled", -// ctx: canceled, -// err: true, -// }, -// { -// desc: "Send file(0 KiB) with default UploadStreamOptions", -// ctx: context.Background(), -// fileSize: 0, -// }, -// { -// desc: "Send file(10 KiB) with default UploadStreamOptions", -// ctx: context.Background(), -// fileSize: 10 * 1024, -// }, -// { -// desc: "Send file(10 KiB) with default UploadStreamOptions set to azcopy settings", -// ctx: context.Background(), -// fileSize: 10 * 1024, -// o: UploadStreamOptions{MaxBuffers: 5, BufferSize: 8 * 1024 * 1024}, -// }, -// { -// desc: "Send file(1 MiB) with default UploadStreamOptions", -// ctx: context.Background(), -// fileSize: _1MiB, -// }, -// { -// desc: "Send file(1 MiB) with default UploadStreamOptions set to azcopy settings", -// ctx: context.Background(), -// fileSize: _1MiB, -// o: UploadStreamOptions{MaxBuffers: 5, BufferSize: 8 * 1024 * 1024}, -// }, -// { -// desc: "Send file(1.5 MiB) with default UploadStreamOptions", -// ctx: context.Background(), -// fileSize: _1MiB + 500*1024, -// }, -// { -// desc: "Send file(1.5 MiB) with 2 writers", -// ctx: context.Background(), -// fileSize: _1MiB + 500*1024 + 1, -// o: UploadStreamOptions{MaxBuffers: 2}, -// }, -// { -// desc: "Send file(12 MiB) with 3 writers and 1 MiB buffer and a write error", -// ctx: context.Background(), -// fileSize: 12 * _1MiB, -// o: UploadStreamOptions{MaxBuffers: 2, BufferSize: _1MiB}, -// uploadErr: true, -// err: true, -// }, -// { -// desc: "Send file(12 MiB) with 3 writers and 1.5 MiB buffer", -// ctx: context.Background(), -// fileSize: 12 * _1MiB, -// o: UploadStreamOptions{MaxBuffers: 2, BufferSize: _1MiB + .5*_1MiB}, -// }, -// { -// desc: "Send file(12 MiB) with default UploadStreamOptions set to azcopy settings", -// ctx: context.Background(), -// fileSize: 12 * _1MiB, -// o: UploadStreamOptions{MaxBuffers: 5, BufferSize: 8 * 1024 * 1024}, -// }, -// { -// desc: "Send file(12 MiB) with default UploadStreamOptions using SyncPool manager", -// ctx: context.Background(), -// fileSize: 12 * _1MiB, -// o: UploadStreamOptions{ -// transferManager: spm, -// }, -// }, -// } -// -// for _, test := range tests { -// p, err := createSrcFile(test.fileSize) -// if err != nil { -// panic(err) -// } -// defer func(name string) { -// _ = os.Remove(name) -// }(p) -// -// from, err := os.Open(p) -// if err != nil { -// panic(err) -// } -// -// br := newFakeBlockWriter() -// defer br.cleanup() -// if test.uploadErr { -// br.errOnBlock = 1 -// } -// -// _, err = copyFromReader(test.ctx, from, br, test.o) -// switch { -// case err == nil && test.err: -// s.T().Errorf("TestCopyFromReader(%s): got err == nil, want err != nil", test.desc) -// continue -// case err != nil && !test.err: -// s.T().Errorf("TestCopyFromReader(%s): got err == %s, want err == nil", test.desc, err) -// continue -// case err != nil: -// continue -// } -// -// want := fileMD5(p) -// got := fileMD5(br.final()) -// -// if got != want { -// s.T().Errorf("TestCopyFromReader(%s): MD5 not the same: got %s, want %s", test.desc, got, want) -// } -// } -//}