diff --git a/sdk/resourcemanager/resources/armfeatures/CHANGELOG.md b/sdk/resourcemanager/resources/armfeatures/CHANGELOG.md index 1ab5bc67edf0..898888e0971a 100644 --- a/sdk/resourcemanager/resources/armfeatures/CHANGELOG.md +++ b/sdk/resourcemanager/resources/armfeatures/CHANGELOG.md @@ -1,5 +1,84 @@ # Release History +## 0.3.0 (2022-04-14) +### Breaking Changes + +- Function `NewSubscriptionFeatureRegistrationsClient` return value(s) have been changed from `(*SubscriptionFeatureRegistrationsClient)` to `(*SubscriptionFeatureRegistrationsClient, error)` +- Function `NewClient` return value(s) have been changed from `(*Client)` to `(*Client, error)` +- Function `*FeatureClient.ListOperations` return value(s) have been changed from `(*FeatureClientListOperationsPager)` to `(*runtime.Pager[FeatureClientListOperationsResponse])` +- Function `*Client.ListAll` return value(s) have been changed from `(*ClientListAllPager)` to `(*runtime.Pager[ClientListAllResponse])` +- Function `*SubscriptionFeatureRegistrationsClient.ListBySubscription` return value(s) have been changed from `(*SubscriptionFeatureRegistrationsClientListBySubscriptionPager)` to `(*runtime.Pager[SubscriptionFeatureRegistrationsClientListBySubscriptionResponse])` +- Function `NewFeatureClient` return value(s) have been changed from `(*FeatureClient)` to `(*FeatureClient, error)` +- Function `*SubscriptionFeatureRegistrationsClient.ListAllBySubscription` return value(s) have been changed from `(*SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager)` to `(*runtime.Pager[SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse])` +- Function `*Client.List` return value(s) have been changed from `(*ClientListPager)` to `(*runtime.Pager[ClientListResponse])` +- Function `*SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager.NextPage` has been removed +- Function `*ClientListAllPager.NextPage` has been removed +- Function `*SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager.Err` has been removed +- Function `*ClientListAllPager.Err` has been removed +- Function `*ClientListPager.NextPage` has been removed +- Function `*FeatureClientListOperationsPager.NextPage` has been removed +- Function `*ClientListPager.PageResponse` has been removed +- Function `*SubscriptionFeatureRegistrationsClientListBySubscriptionPager.NextPage` has been removed +- Function `*SubscriptionFeatureRegistrationsClientListBySubscriptionPager.Err` has been removed +- Function `SubscriptionFeatureRegistrationState.ToPtr` has been removed +- Function `SubscriptionFeatureRegistrationApprovalType.ToPtr` has been removed +- Function `*SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager.PageResponse` has been removed +- Function `*ClientListAllPager.PageResponse` has been removed +- Function `*FeatureClientListOperationsPager.PageResponse` has been removed +- Function `*FeatureClientListOperationsPager.Err` has been removed +- Function `*ClientListPager.Err` has been removed +- Function `*SubscriptionFeatureRegistrationsClientListBySubscriptionPager.PageResponse` has been removed +- Struct `ClientGetResult` has been removed +- Struct `ClientListAllPager` has been removed +- Struct `ClientListAllResult` has been removed +- Struct `ClientListPager` has been removed +- Struct `ClientListResult` has been removed +- Struct `ClientRegisterResult` has been removed +- Struct `ClientUnregisterResult` has been removed +- Struct `FeatureClientListOperationsPager` has been removed +- Struct `FeatureClientListOperationsResult` has been removed +- Struct `SubscriptionFeatureRegistrationsClientCreateOrUpdateResult` has been removed +- Struct `SubscriptionFeatureRegistrationsClientGetResult` has been removed +- Struct `SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager` has been removed +- Struct `SubscriptionFeatureRegistrationsClientListAllBySubscriptionResult` has been removed +- Struct `SubscriptionFeatureRegistrationsClientListBySubscriptionPager` has been removed +- Struct `SubscriptionFeatureRegistrationsClientListBySubscriptionResult` has been removed +- Field `RawResponse` of struct `SubscriptionFeatureRegistrationsClientDeleteResponse` has been removed +- Field `SubscriptionFeatureRegistrationsClientCreateOrUpdateResult` of struct `SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse` has been removed +- Field `RawResponse` of struct `SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse` has been removed +- Field `SubscriptionFeatureRegistrationsClientGetResult` of struct `SubscriptionFeatureRegistrationsClientGetResponse` has been removed +- Field `RawResponse` of struct `SubscriptionFeatureRegistrationsClientGetResponse` has been removed +- Field `ClientRegisterResult` of struct `ClientRegisterResponse` has been removed +- Field `RawResponse` of struct `ClientRegisterResponse` has been removed +- Field `SubscriptionFeatureRegistrationsClientListAllBySubscriptionResult` of struct `SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse` has been removed +- Field `ClientUnregisterResult` of struct `ClientUnregisterResponse` has been removed +- Field `RawResponse` of struct `ClientUnregisterResponse` has been removed +- Field `ClientGetResult` of struct `ClientGetResponse` has been removed +- Field `RawResponse` of struct `ClientGetResponse` has been removed +- Field `ClientListResult` of struct `ClientListResponse` has been removed +- Field `RawResponse` of struct `ClientListResponse` has been removed +- Field `ClientListAllResult` of struct `ClientListAllResponse` has been removed +- Field `RawResponse` of struct `ClientListAllResponse` has been removed +- Field `FeatureClientListOperationsResult` of struct `FeatureClientListOperationsResponse` has been removed +- Field `RawResponse` of struct `FeatureClientListOperationsResponse` has been removed +- Field `SubscriptionFeatureRegistrationsClientListBySubscriptionResult` of struct `SubscriptionFeatureRegistrationsClientListBySubscriptionResponse` has been removed +- Field `RawResponse` of struct `SubscriptionFeatureRegistrationsClientListBySubscriptionResponse` has been removed + +### Features Added + +- New anonymous field `SubscriptionFeatureRegistration` in struct `SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse` +- New anonymous field `FeatureResult` in struct `ClientRegisterResponse` +- New anonymous field `FeatureResult` in struct `ClientGetResponse` +- New anonymous field `OperationListResult` in struct `FeatureClientListOperationsResponse` +- New anonymous field `FeatureOperationsListResult` in struct `ClientListResponse` +- New anonymous field `FeatureResult` in struct `ClientUnregisterResponse` +- New anonymous field `SubscriptionFeatureRegistrationList` in struct `SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse` +- New anonymous field `FeatureOperationsListResult` in struct `ClientListAllResponse` +- New anonymous field `SubscriptionFeatureRegistrationList` in struct `SubscriptionFeatureRegistrationsClientListBySubscriptionResponse` +- New anonymous field `SubscriptionFeatureRegistration` in struct `SubscriptionFeatureRegistrationsClientGetResponse` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/resources/armfeatures/autorest.md b/sdk/resourcemanager/resources/armfeatures/autorest.md index eb059b1e1ab5..afe1cc78ec34 100644 --- a/sdk/resourcemanager/resources/armfeatures/autorest.md +++ b/sdk/resourcemanager/resources/armfeatures/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/resources/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/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.2.1 +module-version: 0.3.0 package-features: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armfeatures/go.mod b/sdk/resourcemanager/resources/armfeatures/go.mod index be3f998cf474..703c63eb4a33 100644 --- a/sdk/resourcemanager/resources/armfeatures/go.mod +++ b/sdk/resourcemanager/resources/armfeatures/go.mod @@ -1,10 +1,29 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures -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/resourcemanager/internal v0.1.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v0.3.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/internal v0.9.1 // 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/armfeatures/go.sum b/sdk/resourcemanager/resources/armfeatures/go.sum index 861905ed56b2..facd9999ed64 100644 --- a/sdk/resourcemanager/resources/armfeatures/go.sum +++ b/sdk/resourcemanager/resources/armfeatures/go.sum @@ -1,16 +1,13 @@ -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/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/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= @@ -21,7 +18,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= @@ -41,21 +37,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/armfeatures/ze_generated_example_featureclient_client_test.go b/sdk/resourcemanager/resources/armfeatures/ze_generated_example_featureclient_client_test.go deleted file mode 100644 index f8419e7ff827..000000000000 --- a/sdk/resourcemanager/resources/armfeatures/ze_generated_example_featureclient_client_test.go +++ /dev/null @@ -1,40 +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 armfeatures_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures" -) - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/listFeaturesOperations.json -func ExampleFeatureClient_ListOperations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewFeatureClient(cred, nil) - pager := client.ListOperations(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/armfeatures/ze_generated_example_features_client_test.go b/sdk/resourcemanager/resources/armfeatures/ze_generated_example_features_client_test.go deleted file mode 100644 index 05009e807a4a..000000000000 --- a/sdk/resourcemanager/resources/armfeatures/ze_generated_example_features_client_test.go +++ /dev/null @@ -1,118 +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 armfeatures_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures" -) - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/listSubscriptionFeatures.json -func ExampleClient_ListAll() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewClient("", cred, nil) - pager := client.ListAll(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.Features/stable/2021-07-01/examples/listProviderFeatures.json -func ExampleClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewClient("", cred, nil) - pager := client.List("", - 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.Features/stable/2021-07-01/examples/getFeature.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 := armfeatures.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.Features/stable/2021-07-01/examples/registerFeature.json -func ExampleClient_Register() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewClient("", cred, nil) - res, err := client.Register(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientRegisterResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/unregisterFeature.json -func ExampleClient_Unregister() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewClient("", cred, nil) - res, err := client.Unregister(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ClientUnregisterResult) -} diff --git a/sdk/resourcemanager/resources/armfeatures/ze_generated_example_subscriptionfeatureregistrations_client_test.go b/sdk/resourcemanager/resources/armfeatures/ze_generated_example_subscriptionfeatureregistrations_client_test.go deleted file mode 100644 index ccaeacf5466c..000000000000 --- a/sdk/resourcemanager/resources/armfeatures/ze_generated_example_subscriptionfeatureregistrations_client_test.go +++ /dev/null @@ -1,120 +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 armfeatures_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armfeatures" -) - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/FeatureRegistration/SubscriptionFeatureRegistrationGET.json -func ExampleSubscriptionFeatureRegistrationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewSubscriptionFeatureRegistrationsClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.SubscriptionFeatureRegistrationsClientGetResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/FeatureRegistration/SubscriptionFeatureRegistrationPUT.json -func ExampleSubscriptionFeatureRegistrationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewSubscriptionFeatureRegistrationsClient("", cred, nil) - res, err := client.CreateOrUpdate(ctx, - "", - "", - &armfeatures.SubscriptionFeatureRegistrationsClientCreateOrUpdateOptions{SubscriptionFeatureRegistrationType: &armfeatures.SubscriptionFeatureRegistration{ - Properties: &armfeatures.SubscriptionFeatureRegistrationProperties{}, - }, - }) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.SubscriptionFeatureRegistrationsClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/FeatureRegistration/SubscriptionFeatureRegistrationDELETE.json -func ExampleSubscriptionFeatureRegistrationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewSubscriptionFeatureRegistrationsClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} - -// x-ms-original-file: specification/resources/resource-manager/Microsoft.Features/stable/2021-07-01/examples/FeatureRegistration/SubscriptionFeatureRegistrationLIST.json -func ExampleSubscriptionFeatureRegistrationsClient_ListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewSubscriptionFeatureRegistrationsClient("", 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.Features/stable/2021-07-01/examples/FeatureRegistration/SubscriptionFeatureRegistrationLISTALL.json -func ExampleSubscriptionFeatureRegistrationsClient_ListAllBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armfeatures.NewSubscriptionFeatureRegistrationsClient("", cred, nil) - pager := client.ListAllBySubscription(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/armfeatures/zz_generated_client.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_client.go index 86ff1d11748a..a0aafaad6b3c 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_client.go +++ b/sdk/resourcemanager/resources/armfeatures/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" @@ -33,20 +34,24 @@ type Client struct { // subscriptionID - The Azure subscription ID. // 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 { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = 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(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // Get - Gets the preview feature with the specified name. @@ -97,7 +102,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceProviderName // 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.FeatureResult); err != nil { return ClientGetResponse{}, err } @@ -108,16 +113,32 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // If the operation fails it returns an *azcore.ResponseError type. // resourceProviderNamespace - The namespace of the resource provider for getting features. // options - ClientListOptions contains the optional parameters for the Client.List method. -func (client *Client) List(resourceProviderNamespace string, options *ClientListOptions) *ClientListPager { - return &ClientListPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, resourceProviderNamespace, options) +func (client *Client) List(resourceProviderNamespace string, options *ClientListOptions) *runtime.Pager[ClientListResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListResponse]{ + More: func(page ClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.FeatureOperationsListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientListResponse) (ClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceProviderNamespace, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) }, - } + }) } // listCreateRequest creates the List request. @@ -144,7 +165,7 @@ func (client *Client) listCreateRequest(ctx context.Context, resourceProviderNam // listHandleResponse handles the List response. func (client *Client) listHandleResponse(resp *http.Response) (ClientListResponse, error) { - result := ClientListResponse{RawResponse: resp} + result := ClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FeatureOperationsListResult); err != nil { return ClientListResponse{}, err } @@ -154,16 +175,32 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // ListAll - Gets all the preview features that are available through AFEC for the subscription. // If the operation fails it returns an *azcore.ResponseError type. // options - ClientListAllOptions contains the optional parameters for the Client.ListAll method. -func (client *Client) ListAll(options *ClientListAllOptions) *ClientListAllPager { - return &ClientListAllPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listAllCreateRequest(ctx, options) +func (client *Client) ListAll(options *ClientListAllOptions) *runtime.Pager[ClientListAllResponse] { + return runtime.NewPager(runtime.PageProcessor[ClientListAllResponse]{ + More: func(page ClientListAllResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp ClientListAllResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.FeatureOperationsListResult.NextLink) + Fetcher: func(ctx context.Context, page *ClientListAllResponse) (ClientListAllResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientListAllResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientListAllResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientListAllResponse{}, runtime.NewResponseError(resp) + } + return client.listAllHandleResponse(resp) }, - } + }) } // listAllCreateRequest creates the ListAll request. @@ -186,7 +223,7 @@ func (client *Client) listAllCreateRequest(ctx context.Context, options *ClientL // listAllHandleResponse handles the ListAll response. func (client *Client) listAllHandleResponse(resp *http.Response) (ClientListAllResponse, error) { - result := ClientListAllResponse{RawResponse: resp} + result := ClientListAllResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FeatureOperationsListResult); err != nil { return ClientListAllResponse{}, err } @@ -241,7 +278,7 @@ func (client *Client) registerCreateRequest(ctx context.Context, resourceProvide // registerHandleResponse handles the Register response. func (client *Client) registerHandleResponse(resp *http.Response) (ClientRegisterResponse, error) { - result := ClientRegisterResponse{RawResponse: resp} + result := ClientRegisterResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FeatureResult); err != nil { return ClientRegisterResponse{}, err } @@ -296,7 +333,7 @@ func (client *Client) unregisterCreateRequest(ctx context.Context, resourceProvi // unregisterHandleResponse handles the Unregister response. func (client *Client) unregisterHandleResponse(resp *http.Response) (ClientUnregisterResponse, error) { - result := ClientUnregisterResponse{RawResponse: resp} + result := ClientUnregisterResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FeatureResult); err != nil { return ClientUnregisterResponse{}, err } diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_constants.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_constants.go index d6c9dfa96080..877b4f1a628d 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_constants.go +++ b/sdk/resourcemanager/resources/armfeatures/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 armfeatures const ( moduleName = "armfeatures" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) // SubscriptionFeatureRegistrationApprovalType - The feature approval type. @@ -31,11 +31,6 @@ func PossibleSubscriptionFeatureRegistrationApprovalTypeValues() []SubscriptionF } } -// ToPtr returns a *SubscriptionFeatureRegistrationApprovalType pointing to the current value. -func (c SubscriptionFeatureRegistrationApprovalType) ToPtr() *SubscriptionFeatureRegistrationApprovalType { - return &c -} - // SubscriptionFeatureRegistrationState - The state. type SubscriptionFeatureRegistrationState string @@ -61,8 +56,3 @@ func PossibleSubscriptionFeatureRegistrationStateValues() []SubscriptionFeatureR SubscriptionFeatureRegistrationStateUnregistering, } } - -// ToPtr returns a *SubscriptionFeatureRegistrationState pointing to the current value. -func (c SubscriptionFeatureRegistrationState) ToPtr() *SubscriptionFeatureRegistrationState { - return &c -} diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_feature_client.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_feature_client.go index cac106e9a45c..2971db6307a5 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_feature_client.go +++ b/sdk/resourcemanager/resources/armfeatures/zz_generated_feature_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. @@ -13,6 +13,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" @@ -28,34 +29,54 @@ type FeatureClient struct { // NewFeatureClient creates a new instance of FeatureClient with the specified values. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewFeatureClient(credential azcore.TokenCredential, options *arm.ClientOptions) *FeatureClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewFeatureClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*FeatureClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = 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 := &FeatureClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // ListOperations - Lists all of the available Microsoft.Features REST API operations. // If the operation fails it returns an *azcore.ResponseError type. // options - FeatureClientListOperationsOptions contains the optional parameters for the FeatureClient.ListOperations method. -func (client *FeatureClient) ListOperations(options *FeatureClientListOperationsOptions) *FeatureClientListOperationsPager { - return &FeatureClientListOperationsPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listOperationsCreateRequest(ctx, options) +func (client *FeatureClient) ListOperations(options *FeatureClientListOperationsOptions) *runtime.Pager[FeatureClientListOperationsResponse] { + return runtime.NewPager(runtime.PageProcessor[FeatureClientListOperationsResponse]{ + More: func(page FeatureClientListOperationsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp FeatureClientListOperationsResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + Fetcher: func(ctx context.Context, page *FeatureClientListOperationsResponse) (FeatureClientListOperationsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOperationsCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FeatureClientListOperationsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FeatureClientListOperationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FeatureClientListOperationsResponse{}, runtime.NewResponseError(resp) + } + return client.listOperationsHandleResponse(resp) }, - } + }) } // listOperationsCreateRequest creates the ListOperations request. @@ -74,7 +95,7 @@ func (client *FeatureClient) listOperationsCreateRequest(ctx context.Context, op // listOperationsHandleResponse handles the ListOperations response. func (client *FeatureClient) listOperationsHandleResponse(resp *http.Response) (FeatureClientListOperationsResponse, error) { - result := FeatureClientListOperationsResponse{RawResponse: resp} + result := FeatureClientListOperationsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return FeatureClientListOperationsResponse{}, err } diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_models.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_models.go index c6b201c4e80b..834b28024ca7 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_models.go +++ b/sdk/resourcemanager/resources/armfeatures/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 armfeatures -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) +import "time" // AuthorizationProfile - Authorization Profile type AuthorizationProfile struct { @@ -33,49 +28,6 @@ type AuthorizationProfile struct { RequesterObjectID *string `json:"requesterObjectId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationProfile. -func (a AuthorizationProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "approvedTime", a.ApprovedTime) - populate(objectMap, "approver", a.Approver) - populateTimeRFC3339(objectMap, "requestedTime", a.RequestedTime) - populate(objectMap, "requester", a.Requester) - populate(objectMap, "requesterObjectId", a.RequesterObjectID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProfile. -func (a *AuthorizationProfile) 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 "approvedTime": - err = unpopulateTimeRFC3339(val, &a.ApprovedTime) - delete(rawMsg, key) - case "approver": - err = unpopulate(val, &a.Approver) - delete(rawMsg, key) - case "requestedTime": - err = unpopulateTimeRFC3339(val, &a.RequestedTime) - delete(rawMsg, key) - case "requester": - err = unpopulate(val, &a.Requester) - delete(rawMsg, key) - case "requesterObjectId": - err = unpopulate(val, &a.RequesterObjectID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ClientGetOptions contains the optional parameters for the Client.Get method. type ClientGetOptions struct { // placeholder for future optional parameters @@ -113,15 +65,6 @@ type ErrorDefinition struct { Message *string `json:"message,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - // ErrorResponse - Error response indicates that the service is not able to process the incoming request. type ErrorResponse struct { // The error details. @@ -142,14 +85,6 @@ type FeatureOperationsListResult struct { Value []*FeatureResult `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type FeatureOperationsListResult. -func (f FeatureOperationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) - return json.Marshal(objectMap) -} - // FeatureProperties - Information about feature. type FeatureProperties struct { // The registration state of the feature for the subscription. @@ -202,14 +137,6 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - // ProxyResource - An Azure proxy resource. type ProxyResource struct { // READ-ONLY; Azure resource Id. @@ -245,14 +172,6 @@ type SubscriptionFeatureRegistrationList struct { Value []*SubscriptionFeatureRegistration `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionFeatureRegistrationList. -func (s SubscriptionFeatureRegistrationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - type SubscriptionFeatureRegistrationProperties struct { // Authorization Profile AuthorizationProfile *AuthorizationProfile `json:"authorizationProfile,omitempty"` @@ -297,85 +216,6 @@ type SubscriptionFeatureRegistrationProperties struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionFeatureRegistrationProperties. -func (s SubscriptionFeatureRegistrationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalType", s.ApprovalType) - populate(objectMap, "authorizationProfile", s.AuthorizationProfile) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "documentationLink", s.DocumentationLink) - populate(objectMap, "featureName", s.FeatureName) - populate(objectMap, "metadata", s.Metadata) - populate(objectMap, "providerNamespace", s.ProviderNamespace) - populateTimeRFC3339(objectMap, "registrationDate", s.RegistrationDate) - populateTimeRFC3339(objectMap, "releaseDate", s.ReleaseDate) - populate(objectMap, "shouldFeatureDisplayInPortal", s.ShouldFeatureDisplayInPortal) - populate(objectMap, "state", s.State) - populate(objectMap, "subscriptionId", s.SubscriptionID) - populate(objectMap, "tenantId", s.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionFeatureRegistrationProperties. -func (s *SubscriptionFeatureRegistrationProperties) 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 "approvalType": - err = unpopulate(val, &s.ApprovalType) - delete(rawMsg, key) - case "authorizationProfile": - err = unpopulate(val, &s.AuthorizationProfile) - delete(rawMsg, key) - case "description": - err = unpopulate(val, &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, &s.DisplayName) - delete(rawMsg, key) - case "documentationLink": - err = unpopulate(val, &s.DocumentationLink) - delete(rawMsg, key) - case "featureName": - err = unpopulate(val, &s.FeatureName) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, &s.Metadata) - delete(rawMsg, key) - case "providerNamespace": - err = unpopulate(val, &s.ProviderNamespace) - delete(rawMsg, key) - case "registrationDate": - err = unpopulateTimeRFC3339(val, &s.RegistrationDate) - delete(rawMsg, key) - case "releaseDate": - err = unpopulateTimeRFC3339(val, &s.ReleaseDate) - delete(rawMsg, key) - case "shouldFeatureDisplayInPortal": - err = unpopulate(val, &s.ShouldFeatureDisplayInPortal) - delete(rawMsg, key) - case "state": - err = unpopulate(val, &s.State) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, &s.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, &s.TenantID) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // SubscriptionFeatureRegistrationsClientCreateOrUpdateOptions contains the optional parameters for the SubscriptionFeatureRegistrationsClient.CreateOrUpdate // method. type SubscriptionFeatureRegistrationsClientCreateOrUpdateOptions struct { @@ -406,20 +246,3 @@ type SubscriptionFeatureRegistrationsClientListAllBySubscriptionOptions struct { type SubscriptionFeatureRegistrationsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } - -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/armfeatures/zz_generated_models_serde.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_models_serde.go new file mode 100644 index 000000000000..35074747447e --- /dev/null +++ b/sdk/resourcemanager/resources/armfeatures/zz_generated_models_serde.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 armfeatures + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AuthorizationProfile. +func (a AuthorizationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "approvedTime", a.ApprovedTime) + populate(objectMap, "approver", a.Approver) + populateTimeRFC3339(objectMap, "requestedTime", a.RequestedTime) + populate(objectMap, "requester", a.Requester) + populate(objectMap, "requesterObjectId", a.RequesterObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizationProfile. +func (a *AuthorizationProfile) 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 "approvedTime": + err = unpopulateTimeRFC3339(val, &a.ApprovedTime) + delete(rawMsg, key) + case "approver": + err = unpopulate(val, &a.Approver) + delete(rawMsg, key) + case "requestedTime": + err = unpopulateTimeRFC3339(val, &a.RequestedTime) + delete(rawMsg, key) + case "requester": + err = unpopulate(val, &a.Requester) + delete(rawMsg, key) + case "requesterObjectId": + err = unpopulate(val, &a.RequesterObjectID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureOperationsListResult. +func (f FeatureOperationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// 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) +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionFeatureRegistrationList. +func (s SubscriptionFeatureRegistrationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionFeatureRegistrationProperties. +func (s SubscriptionFeatureRegistrationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "approvalType", s.ApprovalType) + populate(objectMap, "authorizationProfile", s.AuthorizationProfile) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "documentationLink", s.DocumentationLink) + populate(objectMap, "featureName", s.FeatureName) + populate(objectMap, "metadata", s.Metadata) + populate(objectMap, "providerNamespace", s.ProviderNamespace) + populateTimeRFC3339(objectMap, "registrationDate", s.RegistrationDate) + populateTimeRFC3339(objectMap, "releaseDate", s.ReleaseDate) + populate(objectMap, "shouldFeatureDisplayInPortal", s.ShouldFeatureDisplayInPortal) + populate(objectMap, "state", s.State) + populate(objectMap, "subscriptionId", s.SubscriptionID) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionFeatureRegistrationProperties. +func (s *SubscriptionFeatureRegistrationProperties) 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 "approvalType": + err = unpopulate(val, &s.ApprovalType) + delete(rawMsg, key) + case "authorizationProfile": + err = unpopulate(val, &s.AuthorizationProfile) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, &s.DisplayName) + delete(rawMsg, key) + case "documentationLink": + err = unpopulate(val, &s.DocumentationLink) + delete(rawMsg, key) + case "featureName": + err = unpopulate(val, &s.FeatureName) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, &s.Metadata) + delete(rawMsg, key) + case "providerNamespace": + err = unpopulate(val, &s.ProviderNamespace) + delete(rawMsg, key) + case "registrationDate": + err = unpopulateTimeRFC3339(val, &s.RegistrationDate) + delete(rawMsg, key) + case "releaseDate": + err = unpopulateTimeRFC3339(val, &s.ReleaseDate) + delete(rawMsg, key) + case "shouldFeatureDisplayInPortal": + err = unpopulate(val, &s.ShouldFeatureDisplayInPortal) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &s.State) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, &s.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, &s.TenantID) + 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/armfeatures/zz_generated_pagers.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_pagers.go deleted file mode 100644 index 9d4a7982c99f..000000000000 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_pagers.go +++ /dev/null @@ -1,287 +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 armfeatures - -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" -) - -// ClientListAllPager provides operations for iterating over paged responses. -type ClientListAllPager struct { - client *Client - current ClientListAllResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListAllResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListAllPager) 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 *ClientListAllPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.FeatureOperationsListResult.NextLink == nil || len(*p.current.FeatureOperationsListResult.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.listAllHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListAllResponse page. -func (p *ClientListAllPager) PageResponse() ClientListAllResponse { - return p.current -} - -// ClientListPager provides operations for iterating over paged responses. -type ClientListPager struct { - client *Client - current ClientListResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, ClientListResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *ClientListPager) 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 *ClientListPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.FeatureOperationsListResult.NextLink == nil || len(*p.current.FeatureOperationsListResult.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.listHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current ClientListResponse page. -func (p *ClientListPager) PageResponse() ClientListResponse { - return p.current -} - -// FeatureClientListOperationsPager provides operations for iterating over paged responses. -type FeatureClientListOperationsPager struct { - client *FeatureClient - current FeatureClientListOperationsResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, FeatureClientListOperationsResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *FeatureClientListOperationsPager) 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 *FeatureClientListOperationsPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.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.listOperationsHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current FeatureClientListOperationsResponse page. -func (p *FeatureClientListOperationsPager) PageResponse() FeatureClientListOperationsResponse { - return p.current -} - -// SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager provides operations for iterating over paged responses. -type SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager struct { - client *SubscriptionFeatureRegistrationsClient - current SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager) 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 *SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SubscriptionFeatureRegistrationList.NextLink == nil || len(*p.current.SubscriptionFeatureRegistrationList.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.listAllBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse page. -func (p *SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager) PageResponse() SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse { - return p.current -} - -// SubscriptionFeatureRegistrationsClientListBySubscriptionPager provides operations for iterating over paged responses. -type SubscriptionFeatureRegistrationsClientListBySubscriptionPager struct { - client *SubscriptionFeatureRegistrationsClient - current SubscriptionFeatureRegistrationsClientListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, SubscriptionFeatureRegistrationsClientListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *SubscriptionFeatureRegistrationsClientListBySubscriptionPager) 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 *SubscriptionFeatureRegistrationsClientListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.SubscriptionFeatureRegistrationList.NextLink == nil || len(*p.current.SubscriptionFeatureRegistrationList.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 SubscriptionFeatureRegistrationsClientListBySubscriptionResponse page. -func (p *SubscriptionFeatureRegistrationsClientListBySubscriptionPager) PageResponse() SubscriptionFeatureRegistrationsClientListBySubscriptionResponse { - return p.current -} diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_response_types.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_response_types.go index 1a95f2646147..f3257b95432b 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_response_types.go +++ b/sdk/resourcemanager/resources/armfeatures/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,130 +8,57 @@ package armfeatures -import "net/http" - // 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 { FeatureResult } // ClientListAllResponse contains the response from method Client.ListAll. type ClientListAllResponse struct { - ClientListAllResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListAllResult contains the result from method Client.ListAll. -type ClientListAllResult struct { FeatureOperationsListResult } // ClientListResponse contains the response from method Client.List. type ClientListResponse struct { - ClientListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientListResult contains the result from method Client.List. -type ClientListResult struct { FeatureOperationsListResult } // ClientRegisterResponse contains the response from method Client.Register. type ClientRegisterResponse struct { - ClientRegisterResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientRegisterResult contains the result from method Client.Register. -type ClientRegisterResult struct { FeatureResult } // ClientUnregisterResponse contains the response from method Client.Unregister. type ClientUnregisterResponse struct { - ClientUnregisterResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ClientUnregisterResult contains the result from method Client.Unregister. -type ClientUnregisterResult struct { FeatureResult } // FeatureClientListOperationsResponse contains the response from method FeatureClient.ListOperations. type FeatureClientListOperationsResponse struct { - FeatureClientListOperationsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// FeatureClientListOperationsResult contains the result from method FeatureClient.ListOperations. -type FeatureClientListOperationsResult struct { OperationListResult } // SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse contains the response from method SubscriptionFeatureRegistrationsClient.CreateOrUpdate. type SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse struct { - SubscriptionFeatureRegistrationsClientCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SubscriptionFeatureRegistrationsClientCreateOrUpdateResult contains the result from method SubscriptionFeatureRegistrationsClient.CreateOrUpdate. -type SubscriptionFeatureRegistrationsClientCreateOrUpdateResult struct { SubscriptionFeatureRegistration } // SubscriptionFeatureRegistrationsClientDeleteResponse contains the response from method SubscriptionFeatureRegistrationsClient.Delete. type SubscriptionFeatureRegistrationsClientDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response + // placeholder for future response values } // SubscriptionFeatureRegistrationsClientGetResponse contains the response from method SubscriptionFeatureRegistrationsClient.Get. type SubscriptionFeatureRegistrationsClientGetResponse struct { - SubscriptionFeatureRegistrationsClientGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SubscriptionFeatureRegistrationsClientGetResult contains the result from method SubscriptionFeatureRegistrationsClient.Get. -type SubscriptionFeatureRegistrationsClientGetResult struct { SubscriptionFeatureRegistration } // SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse contains the response from method SubscriptionFeatureRegistrationsClient.ListAllBySubscription. type SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse struct { - SubscriptionFeatureRegistrationsClientListAllBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SubscriptionFeatureRegistrationsClientListAllBySubscriptionResult contains the result from method SubscriptionFeatureRegistrationsClient.ListAllBySubscription. -type SubscriptionFeatureRegistrationsClientListAllBySubscriptionResult struct { SubscriptionFeatureRegistrationList } // SubscriptionFeatureRegistrationsClientListBySubscriptionResponse contains the response from method SubscriptionFeatureRegistrationsClient.ListBySubscription. type SubscriptionFeatureRegistrationsClientListBySubscriptionResponse struct { - SubscriptionFeatureRegistrationsClientListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// SubscriptionFeatureRegistrationsClientListBySubscriptionResult contains the result from method SubscriptionFeatureRegistrationsClient.ListBySubscription. -type SubscriptionFeatureRegistrationsClientListBySubscriptionResult struct { SubscriptionFeatureRegistrationList } diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_subscriptionfeatureregistrations_client.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_subscriptionfeatureregistrations_client.go index 4e22ef0b90d3..371da85de7f4 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_subscriptionfeatureregistrations_client.go +++ b/sdk/resourcemanager/resources/armfeatures/zz_generated_subscriptionfeatureregistrations_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" @@ -33,20 +34,24 @@ type SubscriptionFeatureRegistrationsClient struct { // subscriptionID - The Azure subscription ID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. -func NewSubscriptionFeatureRegistrationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubscriptionFeatureRegistrationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options +func NewSubscriptionFeatureRegistrationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionFeatureRegistrationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = 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 := &SubscriptionFeatureRegistrationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: ep, + pl: pl, } - return client + return client, nil } // CreateOrUpdate - Create or update a feature registration. @@ -101,7 +106,7 @@ func (client *SubscriptionFeatureRegistrationsClient) createOrUpdateCreateReques // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *SubscriptionFeatureRegistrationsClient) createOrUpdateHandleResponse(resp *http.Response) (SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse, error) { - result := SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse{RawResponse: resp} + result := SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionFeatureRegistration); err != nil { return SubscriptionFeatureRegistrationsClientCreateOrUpdateResponse{}, err } @@ -126,7 +131,7 @@ func (client *SubscriptionFeatureRegistrationsClient) Delete(ctx context.Context if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return SubscriptionFeatureRegistrationsClientDeleteResponse{}, runtime.NewResponseError(resp) } - return SubscriptionFeatureRegistrationsClientDeleteResponse{RawResponse: resp}, nil + return SubscriptionFeatureRegistrationsClientDeleteResponse{}, nil } // deleteCreateRequest creates the Delete request. @@ -204,7 +209,7 @@ func (client *SubscriptionFeatureRegistrationsClient) getCreateRequest(ctx conte // getHandleResponse handles the Get response. func (client *SubscriptionFeatureRegistrationsClient) getHandleResponse(resp *http.Response) (SubscriptionFeatureRegistrationsClientGetResponse, error) { - result := SubscriptionFeatureRegistrationsClientGetResponse{RawResponse: resp} + result := SubscriptionFeatureRegistrationsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionFeatureRegistration); err != nil { return SubscriptionFeatureRegistrationsClientGetResponse{}, err } @@ -215,16 +220,32 @@ func (client *SubscriptionFeatureRegistrationsClient) getHandleResponse(resp *ht // If the operation fails it returns an *azcore.ResponseError type. // options - SubscriptionFeatureRegistrationsClientListAllBySubscriptionOptions contains the optional parameters for the SubscriptionFeatureRegistrationsClient.ListAllBySubscription // method. -func (client *SubscriptionFeatureRegistrationsClient) ListAllBySubscription(options *SubscriptionFeatureRegistrationsClientListAllBySubscriptionOptions) *SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager { - return &SubscriptionFeatureRegistrationsClientListAllBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listAllBySubscriptionCreateRequest(ctx, options) +func (client *SubscriptionFeatureRegistrationsClient) ListAllBySubscription(options *SubscriptionFeatureRegistrationsClientListAllBySubscriptionOptions) *runtime.Pager[SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse]{ + More: func(page SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SubscriptionFeatureRegistrationList.NextLink) + Fetcher: func(ctx context.Context, page *SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse) (SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listAllBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listAllBySubscriptionHandleResponse(resp) }, - } + }) } // listAllBySubscriptionCreateRequest creates the ListAllBySubscription request. @@ -247,7 +268,7 @@ func (client *SubscriptionFeatureRegistrationsClient) listAllBySubscriptionCreat // listAllBySubscriptionHandleResponse handles the ListAllBySubscription response. func (client *SubscriptionFeatureRegistrationsClient) listAllBySubscriptionHandleResponse(resp *http.Response) (SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse, error) { - result := SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{RawResponse: resp} + result := SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionFeatureRegistrationList); err != nil { return SubscriptionFeatureRegistrationsClientListAllBySubscriptionResponse{}, err } @@ -259,16 +280,32 @@ func (client *SubscriptionFeatureRegistrationsClient) listAllBySubscriptionHandl // providerNamespace - The provider namespace. // options - SubscriptionFeatureRegistrationsClientListBySubscriptionOptions contains the optional parameters for the SubscriptionFeatureRegistrationsClient.ListBySubscription // method. -func (client *SubscriptionFeatureRegistrationsClient) ListBySubscription(providerNamespace string, options *SubscriptionFeatureRegistrationsClientListBySubscriptionOptions) *SubscriptionFeatureRegistrationsClientListBySubscriptionPager { - return &SubscriptionFeatureRegistrationsClientListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, providerNamespace, options) +func (client *SubscriptionFeatureRegistrationsClient) ListBySubscription(providerNamespace string, options *SubscriptionFeatureRegistrationsClientListBySubscriptionOptions) *runtime.Pager[SubscriptionFeatureRegistrationsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PageProcessor[SubscriptionFeatureRegistrationsClientListBySubscriptionResponse]{ + More: func(page SubscriptionFeatureRegistrationsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - advancer: func(ctx context.Context, resp SubscriptionFeatureRegistrationsClientListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.SubscriptionFeatureRegistrationList.NextLink) + Fetcher: func(ctx context.Context, page *SubscriptionFeatureRegistrationsClientListBySubscriptionResponse) (SubscriptionFeatureRegistrationsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, providerNamespace, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) }, - } + }) } // listBySubscriptionCreateRequest creates the ListBySubscription request. @@ -295,7 +332,7 @@ func (client *SubscriptionFeatureRegistrationsClient) listBySubscriptionCreateRe // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *SubscriptionFeatureRegistrationsClient) listBySubscriptionHandleResponse(resp *http.Response) (SubscriptionFeatureRegistrationsClientListBySubscriptionResponse, error) { - result := SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{RawResponse: resp} + result := SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionFeatureRegistrationList); err != nil { return SubscriptionFeatureRegistrationsClientListBySubscriptionResponse{}, err } diff --git a/sdk/resourcemanager/resources/armfeatures/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resources/armfeatures/zz_generated_time_rfc3339.go index 4903d0adfd1e..b0000b574949 100644 --- a/sdk/resourcemanager/resources/armfeatures/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/resources/armfeatures/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.