diff --git a/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md b/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md index 3e54192afc97..51ce7d642e45 100644 --- a/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md +++ b/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md @@ -1,5 +1,42 @@ # Release History +## 0.5.0 (2022-05-16) +### Breaking Changes + +- Function `*LabsClient.BeginCreateOrUpdate` return value(s) have been changed from `(*armruntime.Poller[LabsClientCreateOrUpdateResponse], error)` to `(*runtime.Poller[LabsClientCreateOrUpdateResponse], error)` +- Function `*LabPlansClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[LabPlansClientDeleteResponse], error)` to `(*runtime.Poller[LabPlansClientDeleteResponse], error)` +- Function `*LabPlansClient.BeginUpdate` return value(s) have been changed from `(*armruntime.Poller[LabPlansClientUpdateResponse], error)` to `(*runtime.Poller[LabPlansClientUpdateResponse], error)` +- Function `*VirtualMachinesClient.BeginStop` return value(s) have been changed from `(*armruntime.Poller[VirtualMachinesClientStopResponse], error)` to `(*runtime.Poller[VirtualMachinesClientStopResponse], error)` +- Function `*VirtualMachinesClient.BeginRedeploy` return value(s) have been changed from `(*armruntime.Poller[VirtualMachinesClientRedeployResponse], error)` to `(*runtime.Poller[VirtualMachinesClientRedeployResponse], error)` +- Function `*UsersClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[UsersClientDeleteResponse], error)` to `(*runtime.Poller[UsersClientDeleteResponse], error)` +- Function `*VirtualMachinesClient.BeginReimage` return value(s) have been changed from `(*armruntime.Poller[VirtualMachinesClientReimageResponse], error)` to `(*runtime.Poller[VirtualMachinesClientReimageResponse], error)` +- Function `*UsersClient.BeginUpdate` return value(s) have been changed from `(*armruntime.Poller[UsersClientUpdateResponse], error)` to `(*runtime.Poller[UsersClientUpdateResponse], error)` +- Function `*UsersClient.BeginCreateOrUpdate` return value(s) have been changed from `(*armruntime.Poller[UsersClientCreateOrUpdateResponse], error)` to `(*runtime.Poller[UsersClientCreateOrUpdateResponse], error)` +- Function `*VirtualMachinesClient.BeginStart` return value(s) have been changed from `(*armruntime.Poller[VirtualMachinesClientStartResponse], error)` to `(*runtime.Poller[VirtualMachinesClientStartResponse], error)` +- Function `*UsersClient.BeginInvite` return value(s) have been changed from `(*armruntime.Poller[UsersClientInviteResponse], error)` to `(*runtime.Poller[UsersClientInviteResponse], error)` +- Function `*LabsClient.BeginPublish` return value(s) have been changed from `(*armruntime.Poller[LabsClientPublishResponse], error)` to `(*runtime.Poller[LabsClientPublishResponse], error)` +- Function `*VirtualMachinesClient.BeginResetPassword` return value(s) have been changed from `(*armruntime.Poller[VirtualMachinesClientResetPasswordResponse], error)` to `(*runtime.Poller[VirtualMachinesClientResetPasswordResponse], error)` +- Function `*LabPlansClient.BeginCreateOrUpdate` return value(s) have been changed from `(*armruntime.Poller[LabPlansClientCreateOrUpdateResponse], error)` to `(*runtime.Poller[LabPlansClientCreateOrUpdateResponse], error)` +- Function `*LabsClient.BeginUpdate` return value(s) have been changed from `(*armruntime.Poller[LabsClientUpdateResponse], error)` to `(*runtime.Poller[LabsClientUpdateResponse], error)` +- Function `*LabPlansClient.BeginSaveImage` return value(s) have been changed from `(*armruntime.Poller[LabPlansClientSaveImageResponse], error)` to `(*runtime.Poller[LabPlansClientSaveImageResponse], error)` +- Function `*SchedulesClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[SchedulesClientDeleteResponse], error)` to `(*runtime.Poller[SchedulesClientDeleteResponse], error)` +- Function `*LabsClient.BeginDelete` return value(s) have been changed from `(*armruntime.Poller[LabsClientDeleteResponse], error)` to `(*runtime.Poller[LabsClientDeleteResponse], error)` +- Function `*LabsClient.BeginSyncGroup` return value(s) have been changed from `(*armruntime.Poller[LabsClientSyncGroupResponse], error)` to `(*runtime.Poller[LabsClientSyncGroupResponse], error)` +- Function `OperationListResult.MarshalJSON` has been removed +- Function `ErrorDetail.MarshalJSON` has been removed +- Function `PagedSchedules.MarshalJSON` has been removed +- Function `PagedLabPlans.MarshalJSON` has been removed +- Function `PagedSKUInfos.MarshalJSON` has been removed +- Function `PagedVirtualMachines.MarshalJSON` has been removed +- Function `PagedUsers.MarshalJSON` has been removed +- Function `ListUsagesResult.MarshalJSON` has been removed +- Function `SKUInfo.MarshalJSON` has been removed +- Function `PagedLabs.MarshalJSON` has been removed +- Function `SKURestrictions.MarshalJSON` has been removed +- Function `PagedImages.MarshalJSON` has been removed +- Function `OperationResult.MarshalJSON` has been removed + + ## 0.4.0 (2022-04-15) ### Breaking Changes diff --git a/sdk/resourcemanager/labservices/armlabservices/autorest.md b/sdk/resourcemanager/labservices/armlabservices/autorest.md index f26ebbe2c176..0f0af2347c23 100644 --- a/sdk/resourcemanager/labservices/armlabservices/autorest.md +++ b/sdk/resourcemanager/labservices/armlabservices/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cc26f1d28c939bbcde00a29aa8958b3eebb10cea/specification/labservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cc26f1d28c939bbcde00a29aa8958b3eebb10cea/specification/labservices/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/labservices/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/labservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.4.0 +module-version: 0.5.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/labservices/armlabservices/go.mod b/sdk/resourcemanager/labservices/armlabservices/go.mod index 0ad35a298cea..09789581ec02 100644 --- a/sdk/resourcemanager/labservices/armlabservices/go.mod +++ b/sdk/resourcemanager/labservices/armlabservices/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabs go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.14.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.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 - 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 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect golang.org/x/text v0.3.7 // indirect ) diff --git a/sdk/resourcemanager/labservices/armlabservices/go.sum b/sdk/resourcemanager/labservices/armlabservices/go.sum index 56d1c32628ae..3f874a3bc5a6 100644 --- a/sdk/resourcemanager/labservices/armlabservices/go.sum +++ b/sdk/resourcemanager/labservices/armlabservices/go.sum @@ -1,53 +1,12 @@ -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/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= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -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/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= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -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-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-20210124154548-22da62e12c0c/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/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/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 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= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_images_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_images_client_test.go deleted file mode 100644 index c445b347cc56..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_images_client_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Images/listImages.json -func ExampleImagesClient_NewListByLabPlanPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewImagesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLabPlanPager("", - "", - &armlabservices.ImagesClientListByLabPlanOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Images/getImage.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewImagesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Images/putImage.json -func ExampleImagesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewImagesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "", - "", - "", - armlabservices.Image{ - Properties: &armlabservices.ImageProperties{ - EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Images/patchImage.json -func ExampleImagesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewImagesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "", - "", - "", - armlabservices.ImageUpdate{ - Properties: &armlabservices.ImageUpdateProperties{ - EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labplans_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labplans_client_test.go deleted file mode 100644 index 77048c3da0b9..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labplans_client_test.go +++ /dev/null @@ -1,236 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_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/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/listLabPlans.json -func ExampleLabPlansClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armlabservices.LabPlansClientListBySubscriptionOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/listResourceGroupLabPlans.json -func ExampleLabPlansClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/getLabPlan.json -func ExampleLabPlansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/putLabPlan.json -func ExampleLabPlansClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - armlabservices.LabPlan{ - Location: to.Ptr(""), - Properties: &armlabservices.LabPlanProperties{ - DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - DisconnectDelay: to.Ptr(""), - IdleDelay: to.Ptr(""), - NoConnectDelay: to.Ptr(""), - ShutdownOnDisconnect: to.Ptr(armlabservices.EnableStateEnabled), - ShutdownOnIdle: to.Ptr(armlabservices.ShutdownOnIdleModeUserAbsence), - ShutdownWhenNotConnected: to.Ptr(armlabservices.EnableStateEnabled), - }, - DefaultConnectionProfile: &armlabservices.ConnectionProfile{ - ClientRdpAccess: to.Ptr(armlabservices.ConnectionTypePublic), - ClientSSHAccess: to.Ptr(armlabservices.ConnectionTypePublic), - WebRdpAccess: to.Ptr(armlabservices.ConnectionTypeNone), - WebSSHAccess: to.Ptr(armlabservices.ConnectionTypeNone), - }, - DefaultNetworkProfile: &armlabservices.LabPlanNetworkProfile{ - SubnetID: to.Ptr(""), - }, - SharedGalleryID: to.Ptr(""), - SupportInfo: &armlabservices.SupportInfo{ - Email: to.Ptr(""), - Instructions: to.Ptr(""), - Phone: to.Ptr(""), - URL: to.Ptr(""), - }, - }, - }, - &armlabservices.LabPlansClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/patchLabPlan.json -func ExampleLabPlansClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "", - "", - armlabservices.LabPlanUpdate{ - Properties: &armlabservices.LabPlanUpdateProperties{ - DefaultConnectionProfile: &armlabservices.ConnectionProfile{ - ClientRdpAccess: to.Ptr(armlabservices.ConnectionTypePublic), - ClientSSHAccess: to.Ptr(armlabservices.ConnectionTypePublic), - WebRdpAccess: to.Ptr(armlabservices.ConnectionTypeNone), - WebSSHAccess: to.Ptr(armlabservices.ConnectionTypeNone), - }, - }, - }, - &armlabservices.LabPlansClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/deleteLabPlan.json -func ExampleLabPlansClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "", - "", - &armlabservices.LabPlansClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabPlans/saveImageVirtualMachine.json -func ExampleLabPlansClient_BeginSaveImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabPlansClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSaveImage(ctx, - "", - "", - armlabservices.SaveImageBody{ - Name: to.Ptr(""), - LabVirtualMachineID: to.Ptr(""), - }, - &armlabservices.LabPlansClientBeginSaveImageOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labs_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labs_client_test.go deleted file mode 100644 index 6889914226fa..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_labs_client_test.go +++ /dev/null @@ -1,273 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_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/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/listLabs.json -func ExampleLabsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armlabservices.LabsClientListBySubscriptionOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/listResourceGroupLabs.json -func ExampleLabsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/getLab.json -func ExampleLabsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/putLab.json -func ExampleLabsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "", - "", - armlabservices.Lab{ - Location: to.Ptr(""), - Properties: &armlabservices.LabProperties{ - Description: to.Ptr(""), - AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - DisconnectDelay: to.Ptr(""), - IdleDelay: to.Ptr(""), - NoConnectDelay: to.Ptr(""), - ShutdownOnDisconnect: to.Ptr(armlabservices.EnableStateEnabled), - ShutdownOnIdle: to.Ptr(armlabservices.ShutdownOnIdleModeUserAbsence), - ShutdownWhenNotConnected: to.Ptr(armlabservices.EnableStateEnabled), - }, - ConnectionProfile: &armlabservices.ConnectionProfile{ - ClientRdpAccess: to.Ptr(armlabservices.ConnectionTypePublic), - ClientSSHAccess: to.Ptr(armlabservices.ConnectionTypePublic), - WebRdpAccess: to.Ptr(armlabservices.ConnectionTypeNone), - WebSSHAccess: to.Ptr(armlabservices.ConnectionTypeNone), - }, - LabPlanID: to.Ptr(""), - SecurityProfile: &armlabservices.SecurityProfile{ - OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - }, - Title: to.Ptr(""), - VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - }, - AdminUser: &armlabservices.Credentials{ - Username: to.Ptr("<username>"), - }, - CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - ImageReference: &armlabservices.ImageReference{ - Offer: to.Ptr("<offer>"), - Publisher: to.Ptr("<publisher>"), - SKU: to.Ptr("<sku>"), - Version: to.Ptr("<version>"), - }, - SKU: &armlabservices.SKU{ - Name: to.Ptr("<name>"), - }, - UsageQuota: to.Ptr("<usage-quota>"), - UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - }, - NetworkProfile: &armlabservices.LabNetworkProfile{ - SubnetID: to.Ptr("<subnet-id>"), - }, - State: to.Ptr(armlabservices.LabStateDraft), - }, - }, - &armlabservices.LabsClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/patchLab.json -func ExampleLabsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "<resource-group-name>", - "<lab-name>", - armlabservices.LabUpdate{ - Properties: &armlabservices.LabUpdateProperties{ - SecurityProfile: &armlabservices.SecurityProfile{ - OpenAccess: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, - }, - &armlabservices.LabsClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/deleteLab.json -func ExampleLabsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "<resource-group-name>", - "<lab-name>", - &armlabservices.LabsClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/publishLab.json -func ExampleLabsClient_BeginPublish() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPublish(ctx, - "<resource-group-name>", - "<lab-name>", - &armlabservices.LabsClientBeginPublishOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Labs/syncLab.json -func ExampleLabsClient_BeginSyncGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewLabsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSyncGroup(ctx, - "<resource-group-name>", - "<lab-name>", - &armlabservices.LabsClientBeginSyncGroupOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operationresults_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operationresults_client_test.go deleted file mode 100644 index 92a2b171bb56..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operationresults_client_test.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/OperationResults/getOperationResult.json -func ExampleOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewOperationResultsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "<operation-result-id>", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operations_client_test.go deleted file mode 100644 index aa73a26863cf..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/LabServices/listOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_schedules_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_schedules_client_test.go deleted file mode 100644 index 8d42e6034a28..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_schedules_client_test.go +++ /dev/null @@ -1,163 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_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/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Schedules/listSchedule.json -func ExampleSchedulesClient_NewListByLabPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSchedulesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLabPager("<resource-group-name>", - "<lab-name>", - &armlabservices.SchedulesClientListByLabOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Schedules/getSchedule.json -func ExampleSchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSchedulesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "<resource-group-name>", - "<lab-name>", - "<schedule-name>", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Schedules/putSchedule.json -func ExampleSchedulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSchedulesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "<resource-group-name>", - "<lab-name>", - "<schedule-name>", - armlabservices.Schedule{ - Properties: &armlabservices.ScheduleProperties{ - Notes: to.Ptr("<notes>"), - RecurrencePattern: &armlabservices.RecurrencePattern{ - ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2020-08-14"); return t }()), - Frequency: to.Ptr(armlabservices.RecurrenceFrequencyDaily), - Interval: to.Ptr[int32](2), - }, - StartAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-26T12:00:00Z"); return t }()), - StopAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-26T18:00:00Z"); return t }()), - TimeZoneID: to.Ptr("<time-zone-id>"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Schedules/patchSchedule.json -func ExampleSchedulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSchedulesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "<resource-group-name>", - "<lab-name>", - "<schedule-name>", - armlabservices.ScheduleUpdate{ - Properties: &armlabservices.ScheduleUpdateProperties{ - RecurrencePattern: &armlabservices.RecurrencePattern{ - ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2020-08-14"); return t }()), - Frequency: to.Ptr(armlabservices.RecurrenceFrequencyDaily), - Interval: to.Ptr[int32](2), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Schedules/deleteSchedule.json -func ExampleSchedulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSchedulesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "<resource-group-name>", - "<lab-name>", - "<schedule-name>", - &armlabservices.SchedulesClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_skus_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_skus_client_test.go deleted file mode 100644 index cee00539d783..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_skus_client_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Skus/listSkus.json -func ExampleSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewSKUsClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armlabservices.SKUsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_usages_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_usages_client_test.go deleted file mode 100644 index 601cc97a2402..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_usages_client_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Usages/getUsages.json -func ExampleUsagesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsagesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("<location>", - &armlabservices.UsagesClientListByLocationOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_users_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_users_client_test.go deleted file mode 100644 index f61a2d12ea49..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_users_client_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_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/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/listUser.json -func ExampleUsersClient_NewListByLabPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLabPager("<resource-group-name>", - "<lab-name>", - &armlabservices.UsersClientListByLabOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/getUser.json -func ExampleUsersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "<resource-group-name>", - "<lab-name>", - "<user-name>", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/putUser.json -func ExampleUsersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "<resource-group-name>", - "<lab-name>", - "<user-name>", - armlabservices.User{ - Properties: &armlabservices.UserProperties{ - AdditionalUsageQuota: to.Ptr("<additional-usage-quota>"), - Email: to.Ptr("<email>"), - }, - }, - &armlabservices.UsersClientBeginCreateOrUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/patchUser.json -func ExampleUsersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "<resource-group-name>", - "<lab-name>", - "<user-name>", - armlabservices.UserUpdate{ - Properties: &armlabservices.UserUpdateProperties{ - AdditionalUsageQuota: to.Ptr("<additional-usage-quota>"), - }, - }, - &armlabservices.UsersClientBeginUpdateOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/deleteUser.json -func ExampleUsersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "<resource-group-name>", - "<lab-name>", - "<user-name>", - &armlabservices.UsersClientBeginDeleteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/Users/inviteUser.json -func ExampleUsersClient_BeginInvite() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewUsersClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginInvite(ctx, - "<resource-group-name>", - "<lab-name>", - "<user-name>", - armlabservices.InviteBody{ - Text: to.Ptr("<text>"), - }, - &armlabservices.UsersClientBeginInviteOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_virtualmachines_client_test.go b/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_virtualmachines_client_test.go deleted file mode 100644 index 942574568442..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/ze_generated_example_virtualmachines_client_test.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armlabservices_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/labservices/armlabservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/listVirtualMachine.json -func ExampleVirtualMachinesClient_NewListByLabPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLabPager("<resource-group-name>", - "<lab-name>", - &armlabservices.VirtualMachinesClientListByLabOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - return - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/getVirtualMachine.json -func ExampleVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/startVirtualMachine.json -func ExampleVirtualMachinesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - &armlabservices.VirtualMachinesClientBeginStartOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/stopVirtualMachine.json -func ExampleVirtualMachinesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStop(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - &armlabservices.VirtualMachinesClientBeginStopOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/reimageVirtualMachine.json -func ExampleVirtualMachinesClient_BeginReimage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginReimage(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - &armlabservices.VirtualMachinesClientBeginReimageOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/redeployVirtualMachine.json -func ExampleVirtualMachinesClient_BeginRedeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - &armlabservices.VirtualMachinesClientBeginRedeployOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/labservices/resource-manager/Microsoft.LabServices/preview/2021-11-15-preview/examples/VirtualMachines/resetPasswordVirtualMachine.json -func ExampleVirtualMachinesClient_BeginResetPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armlabservices.NewVirtualMachinesClient("<subscription-id>", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginResetPassword(ctx, - "<resource-group-name>", - "<lab-name>", - "<virtual-machine-name>", - armlabservices.ResetPasswordBody{ - Password: to.Ptr("<password>"), - Username: to.Ptr("<username>"), - }, - &armlabservices.VirtualMachinesClientBeginResetPasswordOptions{ResumeToken: ""}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, 30*time.Second) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_constants.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_constants.go index 851755fe5ee7..4b21f5c1ae76 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_constants.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_constants.go @@ -10,7 +10,7 @@ package armlabservices const ( moduleName = "armlabservices" - moduleVersion = "v0.4.0" + moduleVersion = "v0.5.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_date_type.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_date_type.go index 5772dcc1a339..58d3114911f4 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_date_type.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_date_type.go @@ -46,13 +46,13 @@ func populateDateType(m map[string]interface{}, k string, t *time.Time) { m[k] = (*dateType)(t) } -func unpopulateDateType(data json.RawMessage, t **time.Time) error { +func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } var aux dateType if err := json.Unmarshal(data, &aux); err != nil { - return err + return fmt.Errorf("struct field %s: %v", fn, err) } *t = (*time.Time)(&aux) return nil diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_images_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_images_client.go index d7c3aff0b493..0fce968c72c6 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_images_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_images_client.go @@ -38,7 +38,7 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,6 +56,7 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o // CreateOrUpdate - Updates an image resource via PUT. Creating new resources via PUT will not function. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. @@ -103,7 +104,7 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } @@ -118,6 +119,7 @@ func (client *ImagesClient) createOrUpdateHandleResponse(resp *http.Response) (I // Get - Gets an image resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. @@ -164,7 +166,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -179,12 +181,13 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient // NewListByLabPlanPager - Gets all images from galleries attached to a lab plan. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. // options - ImagesClientListByLabPlanOptions contains the optional parameters for the ImagesClient.ListByLabPlan method. func (client *ImagesClient) NewListByLabPlanPager(resourceGroupName string, labPlanName string, options *ImagesClientListByLabPlanOptions) *runtime.Pager[ImagesClientListByLabPlanResponse] { - return runtime.NewPager(runtime.PageProcessor[ImagesClientListByLabPlanResponse]{ + return runtime.NewPager(runtime.PagingHandler[ImagesClientListByLabPlanResponse]{ More: func(page ImagesClientListByLabPlanResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -236,7 +239,7 @@ func (client *ImagesClient) listByLabPlanCreateRequest(ctx context.Context, reso reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -251,6 +254,7 @@ func (client *ImagesClient) listByLabPlanHandleResponse(resp *http.Response) (Im // Update - Updates an image resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. @@ -298,7 +302,7 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_labplans_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_labplans_client.go index 525ecabf5fdd..4140fe9118cd 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_labplans_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_labplans_client.go @@ -38,7 +38,7 @@ func NewLabPlansClient(subscriptionID string, credential azcore.TokenCredential, if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,28 +56,30 @@ func NewLabPlansClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Operation to create or update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. // body - The request body. // options - LabPlansClientBeginCreateOrUpdateOptions contains the optional parameters for the LabPlansClient.BeginCreateOrUpdate // method. -func (client *LabPlansClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlan, options *LabPlansClientBeginCreateOrUpdateOptions) (*armruntime.Poller[LabPlansClientCreateOrUpdateResponse], error) { +func (client *LabPlansClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlan, options *LabPlansClientBeginCreateOrUpdateOptions) (*runtime.Poller[LabPlansClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabPlansClientCreateOrUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaOriginalURI, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabPlansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, }) } else { - return armruntime.NewPollerFromResumeToken[LabPlansClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabPlansClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } } // CreateOrUpdate - Operation to create or update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabPlansClient) createOrUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlan, options *LabPlansClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { @@ -115,34 +117,36 @@ func (client *LabPlansClient) createOrUpdateCreateRequest(ctx context.Context, r reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // BeginDelete - Operation to delete a Lab Plan resource. Deleting a lab plan does not delete labs associated with a lab plan, // nor does it delete shared images added to a gallery via the lab plan permission container. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. // options - LabPlansClientBeginDeleteOptions contains the optional parameters for the LabPlansClient.BeginDelete method. -func (client *LabPlansClient) BeginDelete(ctx context.Context, resourceGroupName string, labPlanName string, options *LabPlansClientBeginDeleteOptions) (*armruntime.Poller[LabPlansClientDeleteResponse], error) { +func (client *LabPlansClient) BeginDelete(ctx context.Context, resourceGroupName string, labPlanName string, options *LabPlansClientBeginDeleteOptions) (*runtime.Poller[LabPlansClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, labPlanName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabPlansClientDeleteResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabPlansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabPlansClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabPlansClientDeleteResponse](options.ResumeToken, client.pl, nil) } } // Delete - Operation to delete a Lab Plan resource. Deleting a lab plan does not delete labs associated with a lab plan, // nor does it delete shared images added to a gallery via the lab plan permission container. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, labPlanName string, options *LabPlansClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, labPlanName, options) if err != nil { @@ -180,12 +184,13 @@ func (client *LabPlansClient) deleteCreateRequest(ctx context.Context, resourceG reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Retrieves the properties of a Lab Plan. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. @@ -227,7 +232,7 @@ func (client *LabPlansClient) getCreateRequest(ctx context.Context, resourceGrou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -242,11 +247,12 @@ func (client *LabPlansClient) getHandleResponse(resp *http.Response) (LabPlansCl // NewListByResourceGroupPager - Returns a list of all lab plans for a subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // options - LabPlansClientListByResourceGroupOptions contains the optional parameters for the LabPlansClient.ListByResourceGroup // method. func (client *LabPlansClient) NewListByResourceGroupPager(resourceGroupName string, options *LabPlansClientListByResourceGroupOptions) *runtime.Pager[LabPlansClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PageProcessor[LabPlansClientListByResourceGroupResponse]{ + return runtime.NewPager(runtime.PagingHandler[LabPlansClientListByResourceGroupResponse]{ More: func(page LabPlansClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -291,7 +297,7 @@ func (client *LabPlansClient) listByResourceGroupCreateRequest(ctx context.Conte reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -306,10 +312,11 @@ func (client *LabPlansClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Returns a list of all lab plans within a subscription // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // options - LabPlansClientListBySubscriptionOptions contains the optional parameters for the LabPlansClient.ListBySubscription // method. func (client *LabPlansClient) NewListBySubscriptionPager(options *LabPlansClientListBySubscriptionOptions) *runtime.Pager[LabPlansClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PageProcessor[LabPlansClientListBySubscriptionResponse]{ + return runtime.NewPager(runtime.PagingHandler[LabPlansClientListBySubscriptionResponse]{ More: func(page LabPlansClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -353,7 +360,7 @@ func (client *LabPlansClient) listBySubscriptionCreateRequest(ctx context.Contex reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -368,27 +375,29 @@ func (client *LabPlansClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginSaveImage - Saves an image from a lab VM to the attached shared image gallery. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. // body - The request body. // options - LabPlansClientBeginSaveImageOptions contains the optional parameters for the LabPlansClient.BeginSaveImage method. -func (client *LabPlansClient) BeginSaveImage(ctx context.Context, resourceGroupName string, labPlanName string, body SaveImageBody, options *LabPlansClientBeginSaveImageOptions) (*armruntime.Poller[LabPlansClientSaveImageResponse], error) { +func (client *LabPlansClient) BeginSaveImage(ctx context.Context, resourceGroupName string, labPlanName string, body SaveImageBody, options *LabPlansClientBeginSaveImageOptions) (*runtime.Poller[LabPlansClientSaveImageResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.saveImage(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabPlansClientSaveImageResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabPlansClientSaveImageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabPlansClientSaveImageResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabPlansClientSaveImageResponse](options.ResumeToken, client.pl, nil) } } // SaveImage - Saves an image from a lab VM to the attached shared image gallery. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabPlansClient) saveImage(ctx context.Context, resourceGroupName string, labPlanName string, body SaveImageBody, options *LabPlansClientBeginSaveImageOptions) (*http.Response, error) { req, err := client.saveImageCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { @@ -426,33 +435,35 @@ func (client *LabPlansClient) saveImageCreateRequest(ctx context.Context, resour reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // BeginUpdate - Operation to update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labPlanName - The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs // and in UI. // body - The request body. // options - LabPlansClientBeginUpdateOptions contains the optional parameters for the LabPlansClient.BeginUpdate method. -func (client *LabPlansClient) BeginUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlanUpdate, options *LabPlansClientBeginUpdateOptions) (*armruntime.Poller[LabPlansClientUpdateResponse], error) { +func (client *LabPlansClient) BeginUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlanUpdate, options *LabPlansClientBeginUpdateOptions) (*runtime.Poller[LabPlansClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabPlansClientUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabPlansClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabPlansClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabPlansClientUpdateResponse](options.ResumeToken, client.pl, nil) } } // Update - Operation to update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabPlansClient) update(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlanUpdate, options *LabPlansClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { @@ -490,6 +501,6 @@ func (client *LabPlansClient) updateCreateRequest(ctx context.Context, resourceG reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_labs_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_labs_client.go index 1973b8b08911..e52701b96120 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_labs_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_labs_client.go @@ -38,7 +38,7 @@ func NewLabsClient(subscriptionID string, credential azcore.TokenCredential, opt if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,27 +56,29 @@ func NewLabsClient(subscriptionID string, credential azcore.TokenCredential, opt // BeginCreateOrUpdate - Operation to create or update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // body - The request body. // options - LabsClientBeginCreateOrUpdateOptions contains the optional parameters for the LabsClient.BeginCreateOrUpdate // method. -func (client *LabsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, body Lab, options *LabsClientBeginCreateOrUpdateOptions) (*armruntime.Poller[LabsClientCreateOrUpdateResponse], error) { +func (client *LabsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, body Lab, options *LabsClientBeginCreateOrUpdateOptions) (*runtime.Poller[LabsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, labName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabsClientCreateOrUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaOriginalURI, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, }) } else { - return armruntime.NewPollerFromResumeToken[LabsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } } // CreateOrUpdate - Operation to create or update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabsClient) createOrUpdate(ctx context.Context, resourceGroupName string, labName string, body Lab, options *LabsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labName, body, options) if err != nil { @@ -114,31 +116,33 @@ func (client *LabsClient) createOrUpdateCreateRequest(ctx context.Context, resou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // BeginDelete - Operation to delete a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - LabsClientBeginDeleteOptions contains the optional parameters for the LabsClient.BeginDelete method. -func (client *LabsClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginDeleteOptions) (*armruntime.Poller[LabsClientDeleteResponse], error) { +func (client *LabsClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginDeleteOptions) (*runtime.Poller[LabsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabsClientDeleteResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabsClientDeleteResponse](options.ResumeToken, client.pl, nil) } } // Delete - Operation to delete a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabsClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { @@ -176,12 +180,13 @@ func (client *LabsClient) deleteCreateRequest(ctx context.Context, resourceGroup reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Returns the properties of a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - LabsClientGetOptions contains the optional parameters for the LabsClient.Get method. @@ -222,7 +227,7 @@ func (client *LabsClient) getCreateRequest(ctx context.Context, resourceGroupNam reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -237,11 +242,12 @@ func (client *LabsClient) getHandleResponse(resp *http.Response) (LabsClientGetR // NewListByResourceGroupPager - Returns a list of all labs in a resource group. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // options - LabsClientListByResourceGroupOptions contains the optional parameters for the LabsClient.ListByResourceGroup // method. func (client *LabsClient) NewListByResourceGroupPager(resourceGroupName string, options *LabsClientListByResourceGroupOptions) *runtime.Pager[LabsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PageProcessor[LabsClientListByResourceGroupResponse]{ + return runtime.NewPager(runtime.PagingHandler[LabsClientListByResourceGroupResponse]{ More: func(page LabsClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -286,7 +292,7 @@ func (client *LabsClient) listByResourceGroupCreateRequest(ctx context.Context, reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -301,9 +307,10 @@ func (client *LabsClient) listByResourceGroupHandleResponse(resp *http.Response) // NewListBySubscriptionPager - Returns a list of all labs for a subscription. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // options - LabsClientListBySubscriptionOptions contains the optional parameters for the LabsClient.ListBySubscription method. func (client *LabsClient) NewListBySubscriptionPager(options *LabsClientListBySubscriptionOptions) *runtime.Pager[LabsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PageProcessor[LabsClientListBySubscriptionResponse]{ + return runtime.NewPager(runtime.PagingHandler[LabsClientListBySubscriptionResponse]{ More: func(page LabsClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -347,7 +354,7 @@ func (client *LabsClient) listBySubscriptionCreateRequest(ctx context.Context, o reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -362,25 +369,27 @@ func (client *LabsClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginPublish - Publish or re-publish a lab. This will create or update all lab resources, such as virtual machines. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - LabsClientBeginPublishOptions contains the optional parameters for the LabsClient.BeginPublish method. -func (client *LabsClient) BeginPublish(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginPublishOptions) (*armruntime.Poller[LabsClientPublishResponse], error) { +func (client *LabsClient) BeginPublish(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginPublishOptions) (*runtime.Poller[LabsClientPublishResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.publish(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabsClientPublishResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabsClientPublishResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabsClientPublishResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabsClientPublishResponse](options.ResumeToken, client.pl, nil) } } // Publish - Publish or re-publish a lab. This will create or update all lab resources, such as virtual machines. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabsClient) publish(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginPublishOptions) (*http.Response, error) { req, err := client.publishCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { @@ -418,31 +427,33 @@ func (client *LabsClient) publishCreateRequest(ctx context.Context, resourceGrou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginSyncGroup - Action used to manually kick off an AAD group sync job. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - LabsClientBeginSyncGroupOptions contains the optional parameters for the LabsClient.BeginSyncGroup method. -func (client *LabsClient) BeginSyncGroup(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginSyncGroupOptions) (*armruntime.Poller[LabsClientSyncGroupResponse], error) { +func (client *LabsClient) BeginSyncGroup(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginSyncGroupOptions) (*runtime.Poller[LabsClientSyncGroupResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.syncGroup(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabsClientSyncGroupResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabsClientSyncGroupResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabsClientSyncGroupResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabsClientSyncGroupResponse](options.ResumeToken, client.pl, nil) } } // SyncGroup - Action used to manually kick off an AAD group sync job. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabsClient) syncGroup(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginSyncGroupOptions) (*http.Response, error) { req, err := client.syncGroupCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { @@ -480,32 +491,34 @@ func (client *LabsClient) syncGroupCreateRequest(ctx context.Context, resourceGr reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginUpdate - Operation to update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // body - The request body. // options - LabsClientBeginUpdateOptions contains the optional parameters for the LabsClient.BeginUpdate method. -func (client *LabsClient) BeginUpdate(ctx context.Context, resourceGroupName string, labName string, body LabUpdate, options *LabsClientBeginUpdateOptions) (*armruntime.Poller[LabsClientUpdateResponse], error) { +func (client *LabsClient) BeginUpdate(ctx context.Context, resourceGroupName string, labName string, body LabUpdate, options *LabsClientBeginUpdateOptions) (*runtime.Poller[LabsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, labName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[LabsClientUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[LabsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[LabsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[LabsClientUpdateResponse](options.ResumeToken, client.pl, nil) } } // Update - Operation to update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *LabsClient) update(ctx context.Context, resourceGroupName string, labName string, body LabUpdate, options *LabsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, labName, body, options) if err != nil { @@ -543,6 +556,6 @@ func (client *LabsClient) updateCreateRequest(ctx context.Context, resourceGroup reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_models_serde.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_models_serde.go index d2226fcc06e9..2525b4c4af39 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_models_serde.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_models_serde.go @@ -10,21 +10,11 @@ package armlabservices import ( "encoding/json" + "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) 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 ImageProperties. func (i ImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -123,129 +113,44 @@ func (l LabUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. -func (l ListUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.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 OperationResult. -func (o OperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "percentComplete", o.PercentComplete) - populateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - // UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. func (o *OperationResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "endTime": - err = unpopulateTimeRFC3339(val, &o.EndTime) + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": - err = unpopulate(val, &o.Error) + err = unpopulate(val, "Error", &o.Error) delete(rawMsg, key) case "id": - err = unpopulate(val, &o.ID) + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, &o.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "percentComplete": - err = unpopulate(val, &o.PercentComplete) + err = unpopulate(val, "PercentComplete", &o.PercentComplete) delete(rawMsg, key) case "startTime": - err = unpopulateTimeRFC3339(val, &o.StartTime) + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": - err = unpopulate(val, &o.Status) + err = unpopulate(val, "Status", &o.Status) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PagedImages. -func (p PagedImages) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedLabPlans. -func (p PagedLabPlans) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedLabs. -func (p PagedLabs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedSKUInfos. -func (p PagedSKUInfos) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedSchedules. -func (p PagedSchedules) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedUsers. -func (p PagedUsers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PagedVirtualMachines. -func (p PagedVirtualMachines) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - // MarshalJSON implements the json.Marshaller interface for type RecurrencePattern. func (r RecurrencePattern) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -260,56 +165,31 @@ func (r RecurrencePattern) MarshalJSON() ([]byte, error) { func (r *RecurrencePattern) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "expirationDate": - err = unpopulateDateType(val, &r.ExpirationDate) + err = unpopulateDateType(val, "ExpirationDate", &r.ExpirationDate) delete(rawMsg, key) case "frequency": - err = unpopulate(val, &r.Frequency) + err = unpopulate(val, "Frequency", &r.Frequency) delete(rawMsg, key) case "interval": - err = unpopulate(val, &r.Interval) + err = unpopulate(val, "Interval", &r.Interval) delete(rawMsg, key) case "weekDays": - err = unpopulate(val, &r.WeekDays) + err = unpopulate(val, "WeekDays", &r.WeekDays) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SKUInfo. -func (s SKUInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "capabilities", s.Capabilities) - populate(objectMap, "capacity", s.Capacity) - populate(objectMap, "costs", s.Costs) - populate(objectMap, "family", s.Family) - populate(objectMap, "locations", s.Locations) - populate(objectMap, "name", s.Name) - populate(objectMap, "resourceType", s.ResourceType) - populate(objectMap, "restrictions", s.Restrictions) - populate(objectMap, "size", s.Size) - populate(objectMap, "tier", s.Tier) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SKURestrictions. -func (s SKURestrictions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "reasonCode", s.ReasonCode) - populate(objectMap, "type", s.Type) - populate(objectMap, "values", s.Values) - return json.Marshal(objectMap) -} - // MarshalJSON implements the json.Marshaller interface for type ScheduleProperties. func (s ScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -326,32 +206,32 @@ func (s ScheduleProperties) MarshalJSON() ([]byte, error) { func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "notes": - err = unpopulate(val, &s.Notes) + err = unpopulate(val, "Notes", &s.Notes) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, &s.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) case "recurrencePattern": - err = unpopulate(val, &s.RecurrencePattern) + err = unpopulate(val, "RecurrencePattern", &s.RecurrencePattern) delete(rawMsg, key) case "startAt": - err = unpopulateTimeRFC3339(val, &s.StartAt) + err = unpopulateTimeRFC3339(val, "StartAt", &s.StartAt) delete(rawMsg, key) case "stopAt": - err = unpopulateTimeRFC3339(val, &s.StopAt) + err = unpopulateTimeRFC3339(val, "StopAt", &s.StopAt) delete(rawMsg, key) case "timeZoneId": - err = unpopulate(val, &s.TimeZoneID) + err = unpopulate(val, "TimeZoneID", &s.TimeZoneID) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -379,29 +259,29 @@ func (s ScheduleUpdateProperties) MarshalJSON() ([]byte, error) { func (s *ScheduleUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "notes": - err = unpopulate(val, &s.Notes) + err = unpopulate(val, "Notes", &s.Notes) delete(rawMsg, key) case "recurrencePattern": - err = unpopulate(val, &s.RecurrencePattern) + err = unpopulate(val, "RecurrencePattern", &s.RecurrencePattern) delete(rawMsg, key) case "startAt": - err = unpopulateTimeRFC3339(val, &s.StartAt) + err = unpopulateTimeRFC3339(val, "StartAt", &s.StartAt) delete(rawMsg, key) case "stopAt": - err = unpopulateTimeRFC3339(val, &s.StopAt) + err = unpopulateTimeRFC3339(val, "StopAt", &s.StopAt) delete(rawMsg, key) case "timeZoneId": - err = unpopulate(val, &s.TimeZoneID) + err = unpopulate(val, "TimeZoneID", &s.TimeZoneID) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -423,32 +303,32 @@ func (s SystemData) MarshalJSON() ([]byte, error) { func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, &s.CreatedAt) + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": - err = unpopulate(val, &s.CreatedBy) + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) case "createdByType": - err = unpopulate(val, &s.CreatedByType) + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": - err = unpopulate(val, &s.LastModifiedBy) + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedByType": - err = unpopulate(val, &s.LastModifiedByType) + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -490,38 +370,38 @@ func (u UserProperties) MarshalJSON() ([]byte, error) { func (u *UserProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { case "additionalUsageQuota": - err = unpopulate(val, &u.AdditionalUsageQuota) + err = unpopulate(val, "AdditionalUsageQuota", &u.AdditionalUsageQuota) delete(rawMsg, key) case "displayName": - err = unpopulate(val, &u.DisplayName) + err = unpopulate(val, "DisplayName", &u.DisplayName) delete(rawMsg, key) case "email": - err = unpopulate(val, &u.Email) + err = unpopulate(val, "Email", &u.Email) delete(rawMsg, key) case "invitationSent": - err = unpopulateTimeRFC3339(val, &u.InvitationSent) + err = unpopulateTimeRFC3339(val, "InvitationSent", &u.InvitationSent) delete(rawMsg, key) case "invitationState": - err = unpopulate(val, &u.InvitationState) + err = unpopulate(val, "InvitationState", &u.InvitationState) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, &u.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &u.ProvisioningState) delete(rawMsg, key) case "registrationState": - err = unpopulate(val, &u.RegistrationState) + err = unpopulate(val, "RegistrationState", &u.RegistrationState) delete(rawMsg, key) case "totalUsage": - err = unpopulate(val, &u.TotalUsage) + err = unpopulate(val, "TotalUsage", &u.TotalUsage) delete(rawMsg, key) } if err != nil { - return err + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil @@ -544,9 +424,12 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v interface{}) error { if data == nil { return nil } - return json.Unmarshal(data, v) + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_operationresults_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_operationresults_client.go index c2dfd43185fe..4a241f40926d 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_operationresults_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_operationresults_client.go @@ -38,7 +38,7 @@ func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCre if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,6 +56,7 @@ func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCre // Get - Returns an azure operation result. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // operationResultID - The operation result ID / name. // options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. func (client *OperationResultsClient) Get(ctx context.Context, operationResultID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { @@ -91,7 +92,7 @@ func (client *OperationResultsClient) getCreateRequest(ctx context.Context, oper reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_operations_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_operations_client.go index 006d582daa1d..61398fe3741c 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_operations_client.go @@ -33,7 +33,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -50,9 +50,10 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Returns a list of all operations. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { - return runtime.NewPager(runtime.PageProcessor[OperationsClientListResponse]{ + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -89,7 +90,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_schedules_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_schedules_client.go index b3fb34196756..82811baf86e4 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_schedules_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_schedules_client.go @@ -38,7 +38,7 @@ func NewSchedulesClient(subscriptionID string, credential azcore.TokenCredential if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,6 +56,7 @@ func NewSchedulesClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Operation to create or update a lab schedule. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. @@ -103,7 +104,7 @@ func (client *SchedulesClient) createOrUpdateCreateRequest(ctx context.Context, reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } @@ -118,26 +119,28 @@ func (client *SchedulesClient) createOrUpdateHandleResponse(resp *http.Response) // BeginDelete - Operation to delete a schedule resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. // options - SchedulesClientBeginDeleteOptions contains the optional parameters for the SchedulesClient.BeginDelete method. -func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*armruntime.Poller[SchedulesClientDeleteResponse], error) { +func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*runtime.Poller[SchedulesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, labName, scheduleName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[SchedulesClientDeleteResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SchedulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[SchedulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SchedulesClientDeleteResponse](options.ResumeToken, client.pl, nil) } } // Delete - Operation to delete a schedule resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *SchedulesClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, scheduleName, options) if err != nil { @@ -179,12 +182,13 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Returns the properties of a lab Schedule. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. @@ -230,7 +234,7 @@ func (client *SchedulesClient) getCreateRequest(ctx context.Context, resourceGro reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -245,11 +249,12 @@ func (client *SchedulesClient) getHandleResponse(resp *http.Response) (Schedules // NewListByLabPager - Returns a list of all schedules for a lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - SchedulesClientListByLabOptions contains the optional parameters for the SchedulesClient.ListByLab method. func (client *SchedulesClient) NewListByLabPager(resourceGroupName string, labName string, options *SchedulesClientListByLabOptions) *runtime.Pager[SchedulesClientListByLabResponse] { - return runtime.NewPager(runtime.PageProcessor[SchedulesClientListByLabResponse]{ + return runtime.NewPager(runtime.PagingHandler[SchedulesClientListByLabResponse]{ More: func(page SchedulesClientListByLabResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -301,7 +306,7 @@ func (client *SchedulesClient) listByLabCreateRequest(ctx context.Context, resou reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -316,6 +321,7 @@ func (client *SchedulesClient) listByLabHandleResponse(resp *http.Response) (Sch // Update - Operation to update a lab schedule. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. @@ -362,7 +368,7 @@ func (client *SchedulesClient) updateCreateRequest(ctx context.Context, resource reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_skus_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_skus_client.go index cbd9ee771e3f..edb503346f1c 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_skus_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_skus_client.go @@ -38,7 +38,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,9 +56,10 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - Returns a list of all the Azure Lab Services resource SKUs. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // options - SKUsClientListOptions contains the optional parameters for the SKUsClient.List method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { - return runtime.NewPager(runtime.PageProcessor[SKUsClientListResponse]{ + return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ More: func(page SKUsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -102,7 +103,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_time_rfc3339.go index e038a1cffdf6..e0f24fb3700a 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_time_rfc3339.go @@ -10,6 +10,7 @@ package armlabservices import ( "encoding/json" + "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" @@ -72,13 +73,13 @@ func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { m[k] = (*timeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } var aux timeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { - return err + return fmt.Errorf("struct field %s: %v", fn, err) } *t = (*time.Time)(&aux) return nil diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_usages_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_usages_client.go index 019c4841005a..a80814eb65a3 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_usages_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_usages_client.go @@ -38,7 +38,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,10 +56,11 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByLocationPager - Returns list of usage per SKU family for the specified subscription in the specified region. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // location - The location name. // options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.ListByLocation method. func (client *UsagesClient) NewListByLocationPager(location string, options *UsagesClientListByLocationOptions) *runtime.Pager[UsagesClientListByLocationResponse] { - return runtime.NewPager(runtime.PageProcessor[UsagesClientListByLocationResponse]{ + return runtime.NewPager(runtime.PagingHandler[UsagesClientListByLocationResponse]{ More: func(page UsagesClientListByLocationResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -107,7 +108,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_users_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_users_client.go index 0759b899e831..426619f01e2f 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_users_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_users_client.go @@ -38,7 +38,7 @@ func NewUsersClient(subscriptionID string, credential azcore.TokenCredential, op if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,28 +56,30 @@ func NewUsersClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Operation to create or update a lab user. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. // body - The request body. // options - UsersClientBeginCreateOrUpdateOptions contains the optional parameters for the UsersClient.BeginCreateOrUpdate // method. -func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body User, options *UsersClientBeginCreateOrUpdateOptions) (*armruntime.Poller[UsersClientCreateOrUpdateResponse], error) { +func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body User, options *UsersClientBeginCreateOrUpdateOptions) (*runtime.Poller[UsersClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[UsersClientCreateOrUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaOriginalURI, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[UsersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, }) } else { - return armruntime.NewPollerFromResumeToken[UsersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[UsersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } } // CreateOrUpdate - Operation to create or update a lab user. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *UsersClient) createOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body User, options *UsersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { @@ -119,32 +121,34 @@ func (client *UsersClient) createOrUpdateCreateRequest(ctx context.Context, reso reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // BeginDelete - Operation to delete a user resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. // options - UsersClientBeginDeleteOptions contains the optional parameters for the UsersClient.BeginDelete method. -func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, userName string, options *UsersClientBeginDeleteOptions) (*armruntime.Poller[UsersClientDeleteResponse], error) { +func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName string, labName string, userName string, options *UsersClientBeginDeleteOptions) (*runtime.Poller[UsersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, labName, userName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[UsersClientDeleteResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[UsersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[UsersClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[UsersClientDeleteResponse](options.ResumeToken, client.pl, nil) } } // Delete - Operation to delete a user resource. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *UsersClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, userName string, options *UsersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, userName, options) if err != nil { @@ -186,12 +190,13 @@ func (client *UsersClient) deleteCreateRequest(ctx context.Context, resourceGrou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Returns the properties of a lab user. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. @@ -237,7 +242,7 @@ func (client *UsersClient) getCreateRequest(ctx context.Context, resourceGroupNa reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -252,27 +257,29 @@ func (client *UsersClient) getHandleResponse(resp *http.Response) (UsersClientGe // BeginInvite - Operation to invite a user to a lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. // body - The request body. // options - UsersClientBeginInviteOptions contains the optional parameters for the UsersClient.BeginInvite method. -func (client *UsersClient) BeginInvite(ctx context.Context, resourceGroupName string, labName string, userName string, body InviteBody, options *UsersClientBeginInviteOptions) (*armruntime.Poller[UsersClientInviteResponse], error) { +func (client *UsersClient) BeginInvite(ctx context.Context, resourceGroupName string, labName string, userName string, body InviteBody, options *UsersClientBeginInviteOptions) (*runtime.Poller[UsersClientInviteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.invite(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[UsersClientInviteResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[UsersClientInviteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[UsersClientInviteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[UsersClientInviteResponse](options.ResumeToken, client.pl, nil) } } // Invite - Operation to invite a user to a lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *UsersClient) invite(ctx context.Context, resourceGroupName string, labName string, userName string, body InviteBody, options *UsersClientBeginInviteOptions) (*http.Response, error) { req, err := client.inviteCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { @@ -314,17 +321,18 @@ func (client *UsersClient) inviteCreateRequest(ctx context.Context, resourceGrou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // NewListByLabPager - Returns a list of all users for a lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - UsersClientListByLabOptions contains the optional parameters for the UsersClient.ListByLab method. func (client *UsersClient) NewListByLabPager(resourceGroupName string, labName string, options *UsersClientListByLabOptions) *runtime.Pager[UsersClientListByLabResponse] { - return runtime.NewPager(runtime.PageProcessor[UsersClientListByLabResponse]{ + return runtime.NewPager(runtime.PagingHandler[UsersClientListByLabResponse]{ More: func(page UsersClientListByLabResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -376,7 +384,7 @@ func (client *UsersClient) listByLabCreateRequest(ctx context.Context, resourceG reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -391,27 +399,29 @@ func (client *UsersClient) listByLabHandleResponse(resp *http.Response) (UsersCl // BeginUpdate - Operation to update a lab user. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. // body - The request body. // options - UsersClientBeginUpdateOptions contains the optional parameters for the UsersClient.BeginUpdate method. -func (client *UsersClient) BeginUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body UserUpdate, options *UsersClientBeginUpdateOptions) (*armruntime.Poller[UsersClientUpdateResponse], error) { +func (client *UsersClient) BeginUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body UserUpdate, options *UsersClientBeginUpdateOptions) (*runtime.Poller[UsersClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[UsersClientUpdateResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[UsersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[UsersClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[UsersClientUpdateResponse](options.ResumeToken, client.pl, nil) } } // Update - Operation to update a lab user. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *UsersClient) update(ctx context.Context, resourceGroupName string, labName string, userName string, body UserUpdate, options *UsersClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { @@ -453,6 +463,6 @@ func (client *UsersClient) updateCreateRequest(ctx context.Context, resourceGrou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } diff --git a/sdk/resourcemanager/labservices/armlabservices/zz_generated_virtualmachines_client.go b/sdk/resourcemanager/labservices/armlabservices/zz_generated_virtualmachines_client.go index 5c6fa68d22fd..80f80ece84e2 100644 --- a/sdk/resourcemanager/labservices/armlabservices/zz_generated_virtualmachines_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/zz_generated_virtualmachines_client.go @@ -38,7 +38,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred if options == nil { options = &arm.ClientOptions{} } - ep := cloud.AzurePublicCloud.Services[cloud.ResourceManager].Endpoint + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { ep = c.Endpoint } @@ -56,6 +56,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // Get - Returns the properties for a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -102,7 +103,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -117,12 +118,13 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // NewListByLabPager - Returns a list of all virtual machines for a lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // options - VirtualMachinesClientListByLabOptions contains the optional parameters for the VirtualMachinesClient.ListByLab // method. func (client *VirtualMachinesClient) NewListByLabPager(resourceGroupName string, labName string, options *VirtualMachinesClientListByLabOptions) *runtime.Pager[VirtualMachinesClientListByLabResponse] { - return runtime.NewPager(runtime.PageProcessor[VirtualMachinesClientListByLabResponse]{ + return runtime.NewPager(runtime.PagingHandler[VirtualMachinesClientListByLabResponse]{ More: func(page VirtualMachinesClientListByLabResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, @@ -174,7 +176,7 @@ func (client *VirtualMachinesClient) listByLabCreateRequest(ctx context.Context, reqQP.Set("$filter", *options.Filter) } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -189,28 +191,30 @@ func (client *VirtualMachinesClient) listByLabHandleResponse(resp *http.Response // BeginRedeploy - Action to redeploy a lab virtual machine to a different compute node. For troubleshooting connectivity. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource // URIs. // options - VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy // method. -func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginRedeployOptions) (*armruntime.Poller[VirtualMachinesClientRedeployResponse], error) { +func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginRedeployOptions) (*runtime.Poller[VirtualMachinesClientRedeployResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.redeploy(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachinesClientRedeployResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientRedeployResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[VirtualMachinesClientRedeployResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientRedeployResponse](options.ResumeToken, client.pl, nil) } } // Redeploy - Action to redeploy a lab virtual machine to a different compute node. For troubleshooting connectivity. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { @@ -252,36 +256,38 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginReimage - Re-image a lab virtual machine. The virtual machine will be deleted and recreated using the latest published // snapshot of the reference environment of the lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource // URIs. // options - VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage // method. -func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginReimageOptions) (*armruntime.Poller[VirtualMachinesClientReimageResponse], error) { +func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginReimageOptions) (*runtime.Poller[VirtualMachinesClientReimageResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.reimage(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachinesClientReimageResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientReimageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[VirtualMachinesClientReimageResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientReimageResponse](options.ResumeToken, client.pl, nil) } } // Reimage - Re-image a lab virtual machine. The virtual machine will be deleted and recreated using the latest published // snapshot of the reference environment of the lab. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { @@ -323,12 +329,13 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginResetPassword - Resets a lab virtual machine password. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -336,22 +343,23 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r // body - The request body. // options - VirtualMachinesClientBeginResetPasswordOptions contains the optional parameters for the VirtualMachinesClient.BeginResetPassword // method. -func (client *VirtualMachinesClient) BeginResetPassword(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, body ResetPasswordBody, options *VirtualMachinesClientBeginResetPasswordOptions) (*armruntime.Poller[VirtualMachinesClientResetPasswordResponse], error) { +func (client *VirtualMachinesClient) BeginResetPassword(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, body ResetPasswordBody, options *VirtualMachinesClientBeginResetPasswordOptions) (*runtime.Poller[VirtualMachinesClientResetPasswordResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.resetPassword(ctx, resourceGroupName, labName, virtualMachineName, body, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachinesClientResetPasswordResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientResetPasswordResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[VirtualMachinesClientResetPasswordResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientResetPasswordResponse](options.ResumeToken, client.pl, nil) } } // ResetPassword - Resets a lab virtual machine password. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *VirtualMachinesClient) resetPassword(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, body ResetPasswordBody, options *VirtualMachinesClientBeginResetPasswordOptions) (*http.Response, error) { req, err := client.resetPasswordCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, body, options) if err != nil { @@ -393,34 +401,36 @@ func (client *VirtualMachinesClient) resetPasswordCreateRequest(ctx context.Cont reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) } // BeginStart - Action to start a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource // URIs. // options - VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart // method. -func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*armruntime.Poller[VirtualMachinesClientStartResponse], error) { +func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*runtime.Poller[VirtualMachinesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.start(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachinesClientStartResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.pl, nil) } } // Start - Action to start a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { @@ -462,34 +472,36 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginStop - Action to stop a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // labName - The name of the lab that uniquely identifies it within containing lab account. Used in resource URIs. // virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource // URIs. // options - VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop // method. -func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*armruntime.Poller[VirtualMachinesClientStopResponse], error) { +func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*runtime.Poller[VirtualMachinesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.stop(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - return armruntime.NewPoller(resp, client.pl, &armruntime.NewPollerOptions[VirtualMachinesClientStopResponse]{ - FinalStateVia: armruntime.FinalStateViaLocation, + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[VirtualMachinesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return armruntime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.pl, nil) } } // Stop - Action to stop a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-11-15-preview func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { @@ -531,6 +543,6 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-11-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil }