From acc1cbe9d17dcde5eb94b54ada07c3247950942b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 14 Apr 2022 03:54:32 +0000 Subject: [PATCH] CodeGen from PR 18683 in Azure/azure-rest-api-specs Merge ef3e80f8a7d9d2ed9157410e7dfb1837bd1d35a3 into ba65174ad2569e80fdb5838a1dddc26b8c0d6f3d --- .../armdeploymentscripts/CHANGELOG.md | 70 +++ .../armdeploymentscripts/autorest.md | 6 +- .../resources/armdeploymentscripts/go.mod | 28 +- .../resources/armdeploymentscripts/go.sum | 29 +- ...d_example_deploymentscripts_client_test.go | 202 -------- .../zz_generated_client.go | 125 +++-- .../zz_generated_constants.go | 31 +- .../zz_generated_models.go | 431 +----------------- .../zz_generated_models_serde.go | 425 +++++++++++++++++ .../zz_generated_pagers.go | 125 ----- .../zz_generated_pollers.go | 58 --- .../zz_generated_polymorphic_helpers.go | 4 +- .../zz_generated_response_types.go | 115 +---- .../zz_generated_time_rfc3339.go | 4 +- 14 files changed, 637 insertions(+), 1016 deletions(-) delete mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/ze_generated_example_deploymentscripts_client_test.go create mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pagers.go delete mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pollers.go diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md b/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md index 4a728e0ce1ae..8cf1b7a844f4 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md +++ b/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md @@ -1,5 +1,75 @@ # Release History +## 0.4.0 (2022-04-14) +### Breaking Changes + +- Function `*Client.ListByResourceGroup` return value(s) have been changed from `(*ClientListByResourceGroupPager)` to `(*runtime.Pager[ClientListByResourceGroupResponse])` +- Function `*Client.ListBySubscription` return value(s) have been changed from `(*ClientListBySubscriptionPager)` to `(*runtime.Pager[ClientListBySubscriptionResponse])` +- Function `*Client.BeginCreate` return value(s) have been changed from `(ClientCreatePollerResponse, error)` to `(*armruntime.Poller[ClientCreateResponse], error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `CleanupOptions.ToPtr` has been removed +- Function `*ClientCreatePoller.Done` has been removed +- Function `*ClientListByResourceGroupPager.Err` has been removed +- Function `ClientCreatePollerResponse.PollUntilDone` has been removed +- Function `ScriptType.ToPtr` has been removed +- Function `*ClientCreatePoller.ResumeToken` has been removed +- Function `*ClientCreateResult.UnmarshalJSON` has been removed +- Function `*ClientGetResult.UnmarshalJSON` has been removed +- Function `ManagedServiceIdentityType.ToPtr` has been removed +- Function `ScriptProvisioningState.ToPtr` has been removed +- Function `*ClientCreatePollerResponse.Resume` has been removed +- Function `*ClientListByResourceGroupPager.PageResponse` has been removed +- Function `*ClientListByResourceGroupPager.NextPage` has been removed +- Function `CreatedByType.ToPtr` has been removed +- Function `*ClientListBySubscriptionPager.NextPage` has been removed +- Function `*ClientCreatePoller.Poll` has been removed +- Function `*ClientUpdateResult.UnmarshalJSON` has been removed +- Function `*ClientCreatePoller.FinalResponse` has been removed +- Function `*ClientListBySubscriptionPager.Err` has been removed +- Function `*ClientListBySubscriptionPager.PageResponse` has been removed +- Struct `ClientCreatePoller` has been removed +- Struct `ClientCreatePollerResponse` has been removed +- Struct `ClientCreateResult` has been removed +- Struct `ClientGetLogsDefaultResult` has been removed +- Struct `ClientGetLogsResult` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListByResourceGroupPager` has been removed +- Struct `ClientListByResourceGroupResult` has been removed +- Struct `ClientListBySubscriptionPager` has been removed +- Struct `ClientListBySubscriptionResult` has been removed +- Struct `ClientUpdateResult` has been removed +- Field `ClientUpdateResult` of struct `ClientUpdateResponse` has been removed +- Field `RawResponse` of struct `ClientUpdateResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `ClientGetLogsDefaultResult` of struct `ClientGetLogsDefaultResponse` has been removed +- Field `RawResponse` of struct `ClientGetLogsDefaultResponse` has been removed +- Field `ClientListBySubscriptionResult` of struct `ClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `ClientListBySubscriptionResponse` has been removed +- Field `ClientGetLogsResult` of struct `ClientGetLogsResponse` has been removed +- Field `RawResponse` of struct `ClientGetLogsResponse` has been removed +- Field `RawResponse` of struct `ClientDeleteResponse` has been removed +- Field `ClientCreateResult` of struct `ClientCreateResponse` has been removed +- Field `RawResponse` of struct `ClientCreateResponse` has been removed +- Field `ClientListByResourceGroupResult` of struct `ClientListByResourceGroupResponse` has been removed +- Field `RawResponse` of struct `ClientListByResourceGroupResponse` has been removed + +### Features Added + +- New function `*ClientGetResponse.UnmarshalJSON([]byte) error` +- New function `*ClientUpdateResponse.UnmarshalJSON([]byte) error` +- New function `*ClientCreateResponse.UnmarshalJSON([]byte) error` +- New struct `Error` +- New anonymous field `DeploymentScriptClassification` in struct `ClientCreateResponse` +- New anonymous field `ScriptLogsList` in struct `ClientGetLogsResponse` +- New anonymous field `DeploymentScriptListResult` in struct `ClientListBySubscriptionResponse` +- New field `ResumeToken` in struct `ClientBeginCreateOptions` +- New anonymous field `DeploymentScriptClassification` in struct `ClientUpdateResponse` +- New anonymous field `DeploymentScriptClassification` in struct `ClientGetResponse` +- New anonymous field `ScriptLog` in struct `ClientGetLogsDefaultResponse` +- New anonymous field `DeploymentScriptListResult` in struct `ClientListByResourceGroupResponse` + + ## 0.3.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md b/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md index d962090416e1..c2a6580e53ec 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md +++ b/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/a67988c1aaf3b020ef5217a37f4c169f21881d0b/specification/resources/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a67988c1aaf3b020ef5217a37f4c169f21881d0b/specification/resources/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.3.1 +module-version: 0.4.0 package-deploymentscripts: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/go.mod b/sdk/resourcemanager/resources/armdeploymentscripts/go.mod index 885d987c4ea0..49b744ef3dfe 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/go.mod +++ b/sdk/resourcemanager/resources/armdeploymentscripts/go.mod @@ -1,12 +1,30 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeploymentscripts -go 1.16 +go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.1.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.3.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.3.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.4.0 github.com/stretchr/testify v1.7.0 ) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dnaeon/go-vcr v1.1.0 // 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 + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/go.sum b/sdk/resourcemanager/resources/armdeploymentscripts/go.sum index cd7e82fc0b90..b513e30cb877 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/go.sum +++ b/sdk/resourcemanager/resources/armdeploymentscripts/go.sum @@ -1,18 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0 h1:zBJcBJwte0x6PcPK7XaWDMvK2o2ZM2f1sMaqNNavQ5g= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 h1:RxemzI2cHD0A8WyMqHu/UnDjfpGES/cmjtPbQoktWqs= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1/go.mod h1:+nVKciyKD2J9TyVcEQ82Bo9b+3F92PiQfHrIE/zqLqM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0/go.mod h1:w5pDIZuawUmY3Bj4tVx3Xb8KS96ToB0j315w9rqpAg0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 h1:NVS/4LOQfkBpk+B1VopIzv1ptmYeEskA8w/3K/w7vjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0/go.mod h1:RG0cZndeZM17StwohYclmcXSr4oOJ8b1I5hB8llIc6Y= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.1.0 h1:/hWqo5bAXoNK7svf5GvgpXFPzOCpM29/Eu+WqcE34Uk= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.1.0/go.mod h1:wXFq4k1znCwV7Bw70gw4UDNYKv/nrCUr70hjUmOj1Jo= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.3.1 h1:BBbQ9XBvmXKzw4eL9uChPyNZgf+i/liXDCk9eLNlFss= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.3.1/go.mod h1:I8zxpW5dgsUDURn73KC7cexI2WC8QIsjwfJ5n+1O3Ls= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v0.3.1 h1:EXTDtCSTfPauGawsG+Ae/W46B1PkrgzuKNrcFqy4ljM= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v0.3.1/go.mod h1:PoA99xQAlN13MyUjzgIPWMZEr0etHpYSuT25LmhR3zQ= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.3.0 h1:gYG7I0WxtCnHSWOFLbWCHLBWr+yzI5UeU9KuGZajf5U= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.3.0/go.mod h1:bwEUbGO8V/7KcrqwO14ADZ0m4AkTvSKx3ma68FRc3Bg= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.4.0 h1:wRP3rtixOmWSfaLJqr5aX2CqwJCZxZI1lgfqyYw6Uwo= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.4.0/go.mod h1:S2mj15SUrr7/r/3/k5g3wWC7GTtV+JL3uK6RmNOlEaY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v0.4.0 h1:TSBK+EXu33WBNrYhWmOecKJAl4z1Z5dtbDmqOzd1zGk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v0.4.0/go.mod h1:tt77DwGu+r0Ued27YQPhiW8h8YWpYwpfOfi5uRpRMTg= 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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -23,7 +20,6 @@ github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/ github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -43,21 +39,16 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNm golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/ze_generated_example_deploymentscripts_client_test.go b/sdk/resourcemanager/resources/armdeploymentscripts/ze_generated_example_deploymentscripts_client_test.go deleted file mode 100644 index 0434f0d6b882..000000000000 --- a/sdk/resourcemanager/resources/armdeploymentscripts/ze_generated_example_deploymentscripts_client_test.go +++ /dev/null @@ -1,202 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdeploymentscripts_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/resources/armdeploymentscripts" -) - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create.json -func ExampleClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - poller, err := client.BeginCreate(ctx, - "", - "", - &armdeploymentscripts.AzurePowerShellScript{ - Identity: &armdeploymentscripts.ManagedServiceIdentity{ - Type: armdeploymentscripts.ManagedServiceIdentityType("UserAssigned").ToPtr(), - UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}, - }, - }, - Kind: armdeploymentscripts.ScriptType("AzurePowerShell").ToPtr(), - Location: to.StringPtr(""), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - CleanupPreference: armdeploymentscripts.CleanupOptions("Always").ToPtr(), - Arguments: to.StringPtr(""), - RetentionInterval: to.StringPtr(""), - ScriptContent: to.StringPtr(""), - SupportingScriptUris: []*string{ - to.StringPtr("https://uri1.to.supporting.script"), - to.StringPtr("https://uri2.to.supporting.script")}, - Timeout: to.StringPtr(""), - AzPowerShellVersion: to.StringPtr(""), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientCreateResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Update.json -func ExampleClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - res, err := client.Update(ctx, - "", - "", - &armdeploymentscripts.ClientUpdateOptions{DeploymentScript: &armdeploymentscripts.DeploymentScriptUpdateParameter{ - Tags: map[string]*string{}, - }, - }) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientUpdateResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Get.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientGetResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Delete.json -func ExampleClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListBySubscription.json -func ExampleClient_ListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - pager := client.ListBySubscription(nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.json -func ExampleClient_GetLogs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - res, err := client.GetLogs(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientGetLogsResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogsDefault.json -func ExampleClient_GetLogsDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - res, err := client.GetLogsDefault(ctx, - "", - "", - &armdeploymentscripts.ClientGetLogsDefaultOptions{Tail: nil}) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientGetLogsDefaultResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListByResourceGroup.json -func ExampleClient_ListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armdeploymentscripts.NewClient("", cred, nil) - pager := client.ListByResourceGroup("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_client.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_client.go index 835dea7ccbb3..3e5b13d8d964 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_client.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_client.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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. @@ -14,6 +14,7 @@ import ( "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" @@ -34,20 +35,24 @@ type Client struct { // subscriptionID - Subscription Id which forms part of the URI for every service call. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Client { +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} } - ep := options.Endpoint - if len(ep) == 0 { - ep = arm.AzurePublicCloud + ep := cloud.AzurePublicCloud.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 := &Client{ subscriptionID: subscriptionID, - host: string(ep), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + host: ep, + pl: pl, } - return client + return client, nil } // BeginCreate - Creates a deployment script. @@ -56,22 +61,16 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // scriptName - Name of the deployment script. // deploymentScript - Deployment script supplied to the operation. // options - ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. -func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, scriptName string, deploymentScript DeploymentScriptClassification, options *ClientBeginCreateOptions) (ClientCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, scriptName, deploymentScript, options) - if err != nil { - return ClientCreatePollerResponse{}, err - } - result := ClientCreatePollerResponse{ - RawResponse: resp, +func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, scriptName string, deploymentScript DeploymentScriptClassification, options *ClientBeginCreateOptions) (*armruntime.Poller[ClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, scriptName, deploymentScript, options) + if err != nil { + return nil, err + } + return armruntime.NewPoller[ClientCreateResponse](resp, client.pl, nil) + } else { + return armruntime.NewPollerFromResumeToken[ClientCreateResponse](options.ResumeToken, client.pl, nil) } - pt, err := armruntime.NewPoller("Client.Create", "", resp, client.pl) - if err != nil { - return ClientCreatePollerResponse{}, err - } - result.Poller = &ClientCreatePoller{ - pt: pt, - } - return result, nil } // Create - Creates a deployment script. @@ -134,7 +133,7 @@ func (client *Client) Delete(ctx context.Context, resourceGroupName string, scri if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ClientDeleteResponse{}, runtime.NewResponseError(resp) } - return ClientDeleteResponse{RawResponse: resp}, nil + return ClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -211,7 +210,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st // getHandleResponse handles the Get response. func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, error) { - result := ClientGetResponse{RawResponse: resp} + result := ClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { return ClientGetResponse{}, err } @@ -266,7 +265,7 @@ func (client *Client) getLogsCreateRequest(ctx context.Context, resourceGroupNam // getLogsHandleResponse handles the GetLogs response. func (client *Client) getLogsHandleResponse(resp *http.Response) (ClientGetLogsResponse, error) { - result := ClientGetLogsResponse{RawResponse: resp} + result := ClientGetLogsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ScriptLogsList); err != nil { return ClientGetLogsResponse{}, err } @@ -324,7 +323,7 @@ func (client *Client) getLogsDefaultCreateRequest(ctx context.Context, resourceG // getLogsDefaultHandleResponse handles the GetLogsDefault response. func (client *Client) getLogsDefaultHandleResponse(resp *http.Response) (ClientGetLogsDefaultResponse, error) { - result := ClientGetLogsDefaultResponse{RawResponse: resp} + result := ClientGetLogsDefaultResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ScriptLog); err != nil { return ClientGetLogsDefaultResponse{}, err } @@ -335,16 +334,32 @@ func (client *Client) getLogsDefaultHandleResponse(resp *http.Response) (ClientG // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. The name is case insensitive. // options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. -func (client *Client) ListByResourceGroup(resourceGroupName string, options *ClientListByResourceGroupOptions) *ClientListByResourceGroupPager { - return &ClientListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) +func (client *Client) ListByResourceGroup(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListByResourceGroupResponse]{ + More: func(page ClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DeploymentScriptListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientListByResourceGroupResponse) (ClientListByResourceGroupResponse, 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 ClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) }, - } + }) } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. @@ -371,7 +386,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (ClientListByResourceGroupResponse, error) { - result := ClientListByResourceGroupResponse{RawResponse: resp} + result := ClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentScriptListResult); err != nil { return ClientListByResourceGroupResponse{}, err } @@ -381,16 +396,32 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // ListBySubscription - Lists all deployment scripts for a given subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method. -func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *ClientListBySubscriptionPager { - return &ClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) +func (client *Client) ListBySubscription(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListBySubscriptionResponse]{ + More: func(page ClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.DeploymentScriptListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientListBySubscriptionResponse) (ClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -413,7 +444,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (ClientListBySubscriptionResponse, error) { - result := ClientListBySubscriptionResponse{RawResponse: resp} + result := ClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentScriptListResult); err != nil { return ClientListBySubscriptionResponse{}, err } @@ -471,7 +502,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName // updateHandleResponse handles the Update response. func (client *Client) updateHandleResponse(resp *http.Response) (ClientUpdateResponse, error) { - result := ClientUpdateResponse{RawResponse: resp} + result := ClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { return ClientUpdateResponse{}, err } diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_constants.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_constants.go index 2a83a023b704..654aeaad1062 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_constants.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_constants.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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. @@ -10,7 +10,7 @@ package armdeploymentscripts const ( moduleName = "armdeploymentscripts" - moduleVersion = "v0.3.1" + moduleVersion = "v0.4.0" ) // CleanupOptions - The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. @@ -31,11 +31,6 @@ func PossibleCleanupOptionsValues() []CleanupOptions { } } -// ToPtr returns a *CleanupOptions pointing to the current value. -func (c CleanupOptions) ToPtr() *CleanupOptions { - return &c -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -56,11 +51,6 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// ToPtr returns a *CreatedByType pointing to the current value. -func (c CreatedByType) ToPtr() *CreatedByType { - return &c -} - // ManagedServiceIdentityType - Type of the managed identity. type ManagedServiceIdentityType string @@ -75,11 +65,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// ToPtr returns a *ManagedServiceIdentityType pointing to the current value. -func (c ManagedServiceIdentityType) ToPtr() *ManagedServiceIdentityType { - return &c -} - // ScriptProvisioningState - State of the script execution. This only appears in the response. type ScriptProvisioningState string @@ -104,11 +89,6 @@ func PossibleScriptProvisioningStateValues() []ScriptProvisioningState { } } -// ToPtr returns a *ScriptProvisioningState pointing to the current value. -func (c ScriptProvisioningState) ToPtr() *ScriptProvisioningState { - return &c -} - // ScriptType - Type of the script. type ScriptType string @@ -124,8 +104,3 @@ func PossibleScriptTypeValues() []ScriptType { ScriptTypeAzurePowerShell, } } - -// ToPtr returns a *ScriptType pointing to the current value. -func (c ScriptType) ToPtr() *ScriptType { - return &c -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models.go index 0f0b67adbbaa..183412f2fd7e 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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. @@ -8,12 +8,7 @@ package armdeploymentscripts -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AzureCliScript - Object model for the Azure CLI script. type AzureCliScript struct { @@ -45,79 +40,6 @@ type AzureCliScript struct { Type *string `json:"type,omitempty" azure:"ro"` } -// GetDeploymentScript implements the DeploymentScriptClassification interface for type AzureCliScript. -func (a *AzureCliScript) GetDeploymentScript() *DeploymentScript { - return &DeploymentScript{ - Identity: a.Identity, - Location: a.Location, - Tags: a.Tags, - Kind: a.Kind, - SystemData: a.SystemData, - ID: a.ID, - Name: a.Name, - Type: a.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzureCliScript. -func (a AzureCliScript) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) - objectMap["kind"] = ScriptTypeAzureCLI - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCliScript. -func (a *AzureCliScript) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, &a.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, &a.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &a.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzureCliScriptProperties - Properties of the Azure CLI script object. type AzureCliScriptProperties struct { // REQUIRED; Azure CLI module version to be used. @@ -169,27 +91,6 @@ type AzureCliScriptProperties struct { Status *ScriptStatus `json:"status,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AzureCliScriptProperties. -func (a AzureCliScriptProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", a.Arguments) - populate(objectMap, "azCliVersion", a.AzCliVersion) - populate(objectMap, "cleanupPreference", a.CleanupPreference) - populate(objectMap, "containerSettings", a.ContainerSettings) - populate(objectMap, "environmentVariables", a.EnvironmentVariables) - populate(objectMap, "forceUpdateTag", a.ForceUpdateTag) - populate(objectMap, "outputs", a.Outputs) - populate(objectMap, "primaryScriptUri", a.PrimaryScriptURI) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "retentionInterval", a.RetentionInterval) - populate(objectMap, "scriptContent", a.ScriptContent) - populate(objectMap, "status", a.Status) - populate(objectMap, "storageAccountSettings", a.StorageAccountSettings) - populate(objectMap, "supportingScriptUris", a.SupportingScriptUris) - populate(objectMap, "timeout", a.Timeout) - return json.Marshal(objectMap) -} - // AzurePowerShellScript - Object model for the Azure PowerShell script. type AzurePowerShellScript struct { // REQUIRED; Type of the script. @@ -220,79 +121,6 @@ type AzurePowerShellScript struct { Type *string `json:"type,omitempty" azure:"ro"` } -// GetDeploymentScript implements the DeploymentScriptClassification interface for type AzurePowerShellScript. -func (a *AzurePowerShellScript) GetDeploymentScript() *DeploymentScript { - return &DeploymentScript{ - Identity: a.Identity, - Location: a.Location, - Tags: a.Tags, - Kind: a.Kind, - SystemData: a.SystemData, - ID: a.ID, - Name: a.Name, - Type: a.Type, - } -} - -// MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScript. -func (a AzurePowerShellScript) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) - objectMap["kind"] = ScriptTypeAzurePowerShell - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzurePowerShellScript. -func (a *AzurePowerShellScript) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, &a.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, &a.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &a.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // AzurePowerShellScriptProperties - Properties of the Azure PowerShell script object. type AzurePowerShellScriptProperties struct { // REQUIRED; Azure PowerShell module version to be used. @@ -344,27 +172,6 @@ type AzurePowerShellScriptProperties struct { Status *ScriptStatus `json:"status,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScriptProperties. -func (a AzurePowerShellScriptProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", a.Arguments) - populate(objectMap, "azPowerShellVersion", a.AzPowerShellVersion) - populate(objectMap, "cleanupPreference", a.CleanupPreference) - populate(objectMap, "containerSettings", a.ContainerSettings) - populate(objectMap, "environmentVariables", a.EnvironmentVariables) - populate(objectMap, "forceUpdateTag", a.ForceUpdateTag) - populate(objectMap, "outputs", a.Outputs) - populate(objectMap, "primaryScriptUri", a.PrimaryScriptURI) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "retentionInterval", a.RetentionInterval) - populate(objectMap, "scriptContent", a.ScriptContent) - populate(objectMap, "status", a.Status) - populate(objectMap, "storageAccountSettings", a.StorageAccountSettings) - populate(objectMap, "supportingScriptUris", a.SupportingScriptUris) - populate(objectMap, "timeout", a.Timeout) - return json.Marshal(objectMap) -} - // AzureResourceBase - Common properties for all Azure resources. type AzureResourceBase struct { // READ-ONLY; String Id used to locate any resource on Azure. @@ -379,7 +186,8 @@ type AzureResourceBase struct { // ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. type ClientBeginCreateOptions struct { - // placeholder for future optional parameters + // Resumes the LRO from the provided token. + ResumeToken string } // ClientDeleteOptions contains the optional parameters for the Client.Delete method. @@ -471,23 +279,6 @@ type DeploymentScript struct { Type *string `json:"type,omitempty" azure:"ro"` } -// GetDeploymentScript implements the DeploymentScriptClassification interface for type DeploymentScript. -func (d *DeploymentScript) GetDeploymentScript() *DeploymentScript { return d } - -// MarshalJSON implements the json.Marshaller interface for type DeploymentScript. -func (d DeploymentScript) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - objectMap["kind"] = d.Kind - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - // DeploymentScriptListResult - List of deployment scripts. type DeploymentScriptListResult struct { // An array of deployment scripts. @@ -497,37 +288,6 @@ type DeploymentScriptListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptListResult. -func (d DeploymentScriptListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentScriptListResult. -func (d *DeploymentScriptListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, &d.NextLink) - delete(rawMsg, key) - case "value": - d.Value, err = unmarshalDeploymentScriptClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // DeploymentScriptPropertiesBase - Common properties for the deployment script. type DeploymentScriptPropertiesBase struct { // The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. @@ -549,18 +309,6 @@ type DeploymentScriptPropertiesBase struct { Status *ScriptStatus `json:"status,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptPropertiesBase. -func (d DeploymentScriptPropertiesBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cleanupPreference", d.CleanupPreference) - populate(objectMap, "containerSettings", d.ContainerSettings) - populate(objectMap, "outputs", d.Outputs) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "status", d.Status) - populate(objectMap, "storageAccountSettings", d.StorageAccountSettings) - return json.Marshal(objectMap) -} - // DeploymentScriptUpdateParameter - Deployment script parameters to be updated. type DeploymentScriptUpdateParameter struct { // Resource tags to be updated. @@ -576,16 +324,6 @@ type DeploymentScriptUpdateParameter struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptUpdateParameter. -func (d DeploymentScriptUpdateParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - // EnvironmentVariable - The environment variable to pass to the script in the container instance. type EnvironmentVariable struct { // REQUIRED; The name of the environment variable. @@ -598,6 +336,13 @@ type EnvironmentVariable struct { Value *string `json:"value,omitempty"` } +// Error - Deployment scripts error response. +type Error struct { + // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + // the OData error response format.) + Error *ErrorResponse `json:"error,omitempty"` +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -626,17 +371,6 @@ type ErrorResponse struct { Target *string `json:"target,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - // LogProperties - Script log properties. type LogProperties struct { // READ-ONLY; Script execution logs in text format. @@ -656,15 +390,6 @@ type ManagedServiceIdentity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - // ScriptConfigurationBase - Common configuration settings for both Azure PowerShell and Azure CLI scripts. type ScriptConfigurationBase struct { // REQUIRED; Interval for which the service retains the script resource after it reaches a terminal state. Resource will be @@ -695,20 +420,6 @@ type ScriptConfigurationBase struct { Timeout *string `json:"timeout,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ScriptConfigurationBase. -func (s ScriptConfigurationBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arguments", s.Arguments) - populate(objectMap, "environmentVariables", s.EnvironmentVariables) - populate(objectMap, "forceUpdateTag", s.ForceUpdateTag) - populate(objectMap, "primaryScriptUri", s.PrimaryScriptURI) - populate(objectMap, "retentionInterval", s.RetentionInterval) - populate(objectMap, "scriptContent", s.ScriptContent) - populate(objectMap, "supportingScriptUris", s.SupportingScriptUris) - populate(objectMap, "timeout", s.Timeout) - return json.Marshal(objectMap) -} - // ScriptLog - Script execution log object. type ScriptLog struct { // Script log properties. @@ -730,13 +441,6 @@ type ScriptLogsList struct { Value []*ScriptLog `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type ScriptLogsList. -func (s ScriptLogsList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - // ScriptStatus - Generic object modeling results of script execution. type ScriptStatus struct { // Error that is relayed from the script execution. @@ -758,53 +462,6 @@ type ScriptStatus struct { StorageAccountID *string `json:"storageAccountId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ScriptStatus. -func (s ScriptStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "containerInstanceId", s.ContainerInstanceID) - populateTimeRFC3339(objectMap, "endTime", s.EndTime) - populate(objectMap, "error", s.Error) - populateTimeRFC3339(objectMap, "expirationTime", s.ExpirationTime) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - populate(objectMap, "storageAccountId", s.StorageAccountID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptStatus. -func (s *ScriptStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "containerInstanceId": - err = unpopulate(val, &s.ContainerInstanceID) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, &s.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, &s.Error) - delete(rawMsg, key) - case "expirationTime": - err = unpopulateTimeRFC3339(val, &s.ExpirationTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, &s.StartTime) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, &s.StorageAccountID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // StorageAccountConfiguration - Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 // and FileStorage type StorageAccountConfiguration struct { @@ -836,53 +493,6 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // UserAssignedIdentity - User-assigned managed identity. type UserAssignedIdentity struct { // READ-ONLY; Client App Id associated with this identity. @@ -891,20 +501,3 @@ type UserAssignedIdentity struct { // READ-ONLY; Azure Active Directory principal ID associated with this identity. PrincipalID *string `json:"principalId,omitempty" azure:"ro"` } - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, v interface{}) error { - if data == nil { - return nil - } - return json.Unmarshal(data, v) -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models_serde.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models_serde.go new file mode 100644 index 000000000000..2194af054566 --- /dev/null +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_models_serde.go @@ -0,0 +1,425 @@ +//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 armdeploymentscripts + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// GetDeploymentScript implements the DeploymentScriptClassification interface for type AzureCliScript. +func (a *AzureCliScript) GetDeploymentScript() *DeploymentScript { + return &DeploymentScript{ + Identity: a.Identity, + Location: a.Location, + Tags: a.Tags, + Kind: a.Kind, + SystemData: a.SystemData, + ID: a.ID, + Name: a.Name, + Type: a.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzureCliScript. +func (a AzureCliScript) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + objectMap["kind"] = ScriptTypeAzureCLI + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCliScript. +func (a *AzureCliScript) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &a.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, &a.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &a.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureCliScriptProperties. +func (a AzureCliScriptProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", a.Arguments) + populate(objectMap, "azCliVersion", a.AzCliVersion) + populate(objectMap, "cleanupPreference", a.CleanupPreference) + populate(objectMap, "containerSettings", a.ContainerSettings) + populate(objectMap, "environmentVariables", a.EnvironmentVariables) + populate(objectMap, "forceUpdateTag", a.ForceUpdateTag) + populate(objectMap, "outputs", a.Outputs) + populate(objectMap, "primaryScriptUri", a.PrimaryScriptURI) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "retentionInterval", a.RetentionInterval) + populate(objectMap, "scriptContent", a.ScriptContent) + populate(objectMap, "status", a.Status) + populate(objectMap, "storageAccountSettings", a.StorageAccountSettings) + populate(objectMap, "supportingScriptUris", a.SupportingScriptUris) + populate(objectMap, "timeout", a.Timeout) + return json.Marshal(objectMap) +} + +// GetDeploymentScript implements the DeploymentScriptClassification interface for type AzurePowerShellScript. +func (a *AzurePowerShellScript) GetDeploymentScript() *DeploymentScript { + return &DeploymentScript{ + Identity: a.Identity, + Location: a.Location, + Tags: a.Tags, + Kind: a.Kind, + SystemData: a.SystemData, + ID: a.ID, + Name: a.Name, + Type: a.Type, + } +} + +// MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScript. +func (a AzurePowerShellScript) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + objectMap["kind"] = ScriptTypeAzurePowerShell + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzurePowerShellScript. +func (a *AzurePowerShellScript) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &a.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, &a.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &a.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzurePowerShellScriptProperties. +func (a AzurePowerShellScriptProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", a.Arguments) + populate(objectMap, "azPowerShellVersion", a.AzPowerShellVersion) + populate(objectMap, "cleanupPreference", a.CleanupPreference) + populate(objectMap, "containerSettings", a.ContainerSettings) + populate(objectMap, "environmentVariables", a.EnvironmentVariables) + populate(objectMap, "forceUpdateTag", a.ForceUpdateTag) + populate(objectMap, "outputs", a.Outputs) + populate(objectMap, "primaryScriptUri", a.PrimaryScriptURI) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "retentionInterval", a.RetentionInterval) + populate(objectMap, "scriptContent", a.ScriptContent) + populate(objectMap, "status", a.Status) + populate(objectMap, "storageAccountSettings", a.StorageAccountSettings) + populate(objectMap, "supportingScriptUris", a.SupportingScriptUris) + populate(objectMap, "timeout", a.Timeout) + return json.Marshal(objectMap) +} + +// GetDeploymentScript implements the DeploymentScriptClassification interface for type DeploymentScript. +func (d *DeploymentScript) GetDeploymentScript() *DeploymentScript { return d } + +// MarshalJSON implements the json.Marshaller interface for type DeploymentScript. +func (d DeploymentScript) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + objectMap["kind"] = d.Kind + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptListResult. +func (d DeploymentScriptListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentScriptListResult. +func (d *DeploymentScriptListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, &d.NextLink) + delete(rawMsg, key) + case "value": + d.Value, err = unmarshalDeploymentScriptClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptPropertiesBase. +func (d DeploymentScriptPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cleanupPreference", d.CleanupPreference) + populate(objectMap, "containerSettings", d.ContainerSettings) + populate(objectMap, "outputs", d.Outputs) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "status", d.Status) + populate(objectMap, "storageAccountSettings", d.StorageAccountSettings) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentScriptUpdateParameter. +func (d DeploymentScriptUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptConfigurationBase. +func (s ScriptConfigurationBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", s.Arguments) + populate(objectMap, "environmentVariables", s.EnvironmentVariables) + populate(objectMap, "forceUpdateTag", s.ForceUpdateTag) + populate(objectMap, "primaryScriptUri", s.PrimaryScriptURI) + populate(objectMap, "retentionInterval", s.RetentionInterval) + populate(objectMap, "scriptContent", s.ScriptContent) + populate(objectMap, "supportingScriptUris", s.SupportingScriptUris) + populate(objectMap, "timeout", s.Timeout) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptLogsList. +func (s ScriptLogsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ScriptStatus. +func (s ScriptStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containerInstanceId", s.ContainerInstanceID) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) + populate(objectMap, "error", s.Error) + populateTimeRFC3339(objectMap, "expirationTime", s.ExpirationTime) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "storageAccountId", s.StorageAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScriptStatus. +func (s *ScriptStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "containerInstanceId": + err = unpopulate(val, &s.ContainerInstanceID) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, &s.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &s.Error) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, &s.ExpirationTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, &s.StartTime) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, &s.StorageAccountID) + delete(rawMsg, key) + } + if err != nil { + return 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 err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pagers.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pagers.go deleted file mode 100644 index b20288804f28..000000000000 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pagers.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdeploymentscripts - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "reflect" -) - -// ClientListByResourceGroupPager provides operations for iterating over paged responses. -type ClientListByResourceGroupPager struct { - client *Client - current ClientListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ClientListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DeploymentScriptListResult.NextLink == nil || len(*p.current.DeploymentScriptListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListByResourceGroupResponse page. -func (p *ClientListByResourceGroupPager) PageResponse() ClientListByResourceGroupResponse { - return p.current -} - -// ClientListBySubscriptionPager provides operations for iterating over paged responses. -type ClientListBySubscriptionPager struct { - client *Client - current ClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *ClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.DeploymentScriptListResult.NextLink == nil || len(*p.current.DeploymentScriptListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = runtime.NewResponseError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListBySubscriptionResponse page. -func (p *ClientListBySubscriptionPager) PageResponse() ClientListBySubscriptionResponse { - return p.current -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pollers.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pollers.go deleted file mode 100644 index e4069b6b0b50..000000000000 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_pollers.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdeploymentscripts - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "net/http" -) - -// ClientCreatePoller provides polling facilities until the operation reaches a terminal state. -type ClientCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ClientCreatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ClientCreatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ClientCreateResponse will be returned. -func (p *ClientCreatePoller) FinalResponse(ctx context.Context) (ClientCreateResponse, error) { - respType := ClientCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ClientCreateResult) - if err != nil { - return ClientCreateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ClientCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_polymorphic_helpers.go index 359993f93395..c4a54f97028b 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_polymorphic_helpers.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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. diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_response_types.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_response_types.go index 6e2c22ca8ec5..61d0e6196c27 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_response_types.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_response_types.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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. @@ -8,67 +8,13 @@ package armdeploymentscripts -import ( - "context" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "net/http" - "time" -) - -// ClientCreatePollerResponse contains the response from method Client.Create. -type ClientCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ClientCreatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. -// A good starting value is 30 seconds. Note that some resources might benefit from a different value. -func (l ClientCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClientCreateResponse, error) { - respType := ClientCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ClientCreateResult) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ClientCreatePollerResponse from the provided client and resume token. -func (l *ClientCreatePollerResponse) Resume(ctx context.Context, client *Client, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("Client.Create", token, client.pl) - if err != nil { - return err - } - poller := &ClientCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - // ClientCreateResponse contains the response from method Client.Create. type ClientCreateResponse struct { - ClientCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientCreateResult contains the result from method Client.Create. -type ClientCreateResult struct { DeploymentScriptClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCreateResult. -func (c *ClientCreateResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCreateResponse. +func (c *ClientCreateResponse) UnmarshalJSON(data []byte) error { res, err := unmarshalDeploymentScriptClassification(data) if err != nil { return err @@ -79,48 +25,26 @@ func (c *ClientCreateResult) UnmarshalJSON(data []byte) error { // ClientDeleteResponse contains the response from method Client.Delete. type ClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // ClientGetLogsDefaultResponse contains the response from method Client.GetLogsDefault. type ClientGetLogsDefaultResponse struct { - ClientGetLogsDefaultResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetLogsDefaultResult contains the result from method Client.GetLogsDefault. -type ClientGetLogsDefaultResult struct { ScriptLog } // ClientGetLogsResponse contains the response from method Client.GetLogs. type ClientGetLogsResponse struct { - ClientGetLogsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetLogsResult contains the result from method Client.GetLogs. -type ClientGetLogsResult struct { ScriptLogsList } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { - ClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientGetResult contains the result from method Client.Get. -type ClientGetResult struct { DeploymentScriptClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientGetResult. -func (c *ClientGetResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientGetResponse. +func (c *ClientGetResponse) UnmarshalJSON(data []byte) error { res, err := unmarshalDeploymentScriptClassification(data) if err != nil { return err @@ -131,42 +55,21 @@ func (c *ClientGetResult) UnmarshalJSON(data []byte) error { // ClientListByResourceGroupResponse contains the response from method Client.ListByResourceGroup. type ClientListByResourceGroupResponse struct { - ClientListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListByResourceGroupResult contains the result from method Client.ListByResourceGroup. -type ClientListByResourceGroupResult struct { DeploymentScriptListResult } // ClientListBySubscriptionResponse contains the response from method Client.ListBySubscription. type ClientListBySubscriptionResponse struct { - ClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListBySubscriptionResult contains the result from method Client.ListBySubscription. -type ClientListBySubscriptionResult struct { DeploymentScriptListResult } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { - ClientUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUpdateResult contains the result from method Client.Update. -type ClientUpdateResult struct { DeploymentScriptClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientUpdateResult. -func (c *ClientUpdateResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientUpdateResponse. +func (c *ClientUpdateResponse) UnmarshalJSON(data []byte) error { res, err := unmarshalDeploymentScriptClassification(data) if err != nil { return err diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_time_rfc3339.go index 4733e41e1b0d..c6df22173c13 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/zz_generated_time_rfc3339.go @@ -1,5 +1,5 @@ -//go:build go1.16 -// +build go1.16 +//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.