From b3f46853ff58e59d3553234e20ba62c34f396b02 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 27 Jul 2023 02:28:27 +0000 Subject: [PATCH] CodeGen from PR 24981 in Azure/azure-rest-api-specs Merge 03438660727e91684d420a3a8d71d7cc0df2f8dc into 085eba571478433e5c29f7ed5e15aebfdfd8d1d3 --- .../labservices/armlabservices/CHANGELOG.md | 11 + .../labservices/armlabservices/autorest.md | 6 +- .../armlabservices/client_factory.go | 17 +- .../labservices/armlabservices/constants.go | 145 +++-- .../labservices/armlabservices/go.mod | 20 +- .../labservices/armlabservices/go.sum | 38 +- .../armlabservices/images_client.go | 62 +- .../images_client_example_test.go | 233 ------- .../armlabservices/labplans_client.go | 117 ++-- .../labplans_client_example_test.go | 440 ------------- .../labservices/armlabservices/labs_client.go | 131 ++-- .../labs_client_example_test.go | 579 ------------------ .../labservices/armlabservices/models.go | 270 +------- .../armlabservices/models_serde.go | 62 +- .../armlabservices/operationresults_client.go | 18 +- .../operationresults_client_example_test.go | 44 -- .../armlabservices/operations_client.go | 7 +- .../operations_client_example_test.go | 57 -- .../labservices/armlabservices/options.go | 246 ++++++++ .../armlabservices/response_types.go | 34 +- .../armlabservices/schedules_client.go | 81 ++- .../schedules_client_example_test.go | 280 --------- .../labservices/armlabservices/skus_client.go | 7 +- .../skus_client_example_test.go | 290 --------- .../armlabservices/time_rfc3339.go | 3 +- .../armlabservices/usages_client.go | 7 +- .../usages_client_example_test.go | 64 -- .../armlabservices/users_client.go | 113 ++-- .../users_client_example_test.go | 256 -------- .../armlabservices/virtualmachines_client.go | 122 ++-- .../virtualmachines_client_example_test.go | 229 ------- 31 files changed, 873 insertions(+), 3116 deletions(-) delete mode 100644 sdk/resourcemanager/labservices/armlabservices/images_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/labplans_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/labs_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/operationresults_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/operations_client_example_test.go create mode 100644 sdk/resourcemanager/labservices/armlabservices/options.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/schedules_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/skus_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/usages_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/users_client_example_test.go delete mode 100644 sdk/resourcemanager/labservices/armlabservices/virtualmachines_client_example_test.go diff --git a/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md b/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md index b29596b5cdad..deeb6a8a0c33 100644 --- a/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md +++ b/sdk/resourcemanager/labservices/armlabservices/CHANGELOG.md @@ -1,5 +1,16 @@ # Release History +## 1.2.0 (2023-07-27) +### Features Added + +- New struct `ResourceOperationError` +- New field `ResourceOperationError` in struct `LabPlanProperties` +- New field `ResourceOperationError` in struct `LabProperties` +- New field `ResourceOperationError` in struct `ScheduleProperties` +- New field `ResourceOperationError` in struct `UserProperties` +- New field `ResourceOperationError` in struct `VirtualMachineProperties` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/labservices/armlabservices/autorest.md b/sdk/resourcemanager/labservices/armlabservices/autorest.md index 4a33bb4f7f7c..1ea5d082fe94 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/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/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: 1.1.1 +module-version: 1.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/labservices/armlabservices/client_factory.go b/sdk/resourcemanager/labservices/armlabservices/client_factory.go index d36b60aa74b3..f5fb77bc2d3f 100644 --- a/sdk/resourcemanager/labservices/armlabservices/client_factory.go +++ b/sdk/resourcemanager/labservices/armlabservices/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -48,11 +47,6 @@ func (c *ClientFactory) NewLabPlansClient() *LabPlansClient { return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewLabsClient() *LabsClient { subClient, _ := NewLabsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -63,8 +57,8 @@ func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { return subClient } -func (c *ClientFactory) NewSchedulesClient() *SchedulesClient { - subClient, _ := NewSchedulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } @@ -73,6 +67,11 @@ func (c *ClientFactory) NewSKUsClient() *SKUsClient { return subClient } +func (c *ClientFactory) NewSchedulesClient() *SchedulesClient { + subClient, _ := NewSchedulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewUsagesClient() *UsagesClient { subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/labservices/armlabservices/constants.go b/sdk/resourcemanager/labservices/armlabservices/constants.go index 362703c16a4e..5fa2e71cd15b 100644 --- a/sdk/resourcemanager/labservices/armlabservices/constants.go +++ b/sdk/resourcemanager/labservices/armlabservices/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices const ( moduleName = "armlabservices" - moduleVersion = "v1.1.1" + moduleVersion = "v1.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -32,17 +31,17 @@ func PossibleActionTypeValues() []ActionType { type ConnectionType string const ( - ConnectionTypePublic ConnectionType = "Public" - ConnectionTypePrivate ConnectionType = "Private" ConnectionTypeNone ConnectionType = "None" + ConnectionTypePrivate ConnectionType = "Private" + ConnectionTypePublic ConnectionType = "Public" ) // PossibleConnectionTypeValues returns the possible values for the ConnectionType const type. func PossibleConnectionTypeValues() []ConnectionType { return []ConnectionType{ - ConnectionTypePublic, - ConnectionTypePrivate, ConnectionTypeNone, + ConnectionTypePrivate, + ConnectionTypePublic, } } @@ -89,15 +88,15 @@ func PossibleCreatedByTypeValues() []CreatedByType { type EnableState string const ( - EnableStateEnabled EnableState = "Enabled" EnableStateDisabled EnableState = "Disabled" + EnableStateEnabled EnableState = "Enabled" ) // PossibleEnableStateValues returns the possible values for the EnableState const type. func PossibleEnableStateValues() []EnableState { return []EnableState{ - EnableStateEnabled, EnableStateDisabled, + EnableStateEnabled, } } @@ -105,23 +104,23 @@ func PossibleEnableStateValues() []EnableState { type InvitationState string const ( + // InvitationStateFailed - There was an error while sending the invitation. + InvitationStateFailed InvitationState = "Failed" // InvitationStateNotSent - The invitation has not been sent. InvitationStateNotSent InvitationState = "NotSent" // InvitationStateSending - Currently sending the invitation. InvitationStateSending InvitationState = "Sending" // InvitationStateSent - The invitation has been successfully sent. InvitationStateSent InvitationState = "Sent" - // InvitationStateFailed - There was an error while sending the invitation. - InvitationStateFailed InvitationState = "Failed" ) // PossibleInvitationStateValues returns the possible values for the InvitationState const type. func PossibleInvitationStateValues() []InvitationState { return []InvitationState{ + InvitationStateFailed, InvitationStateNotSent, InvitationStateSending, InvitationStateSent, - InvitationStateFailed, } } @@ -147,24 +146,24 @@ type LabState string const ( // LabStateDraft - The lab is currently in draft (has not been published). LabStateDraft LabState = "Draft" + // LabStatePublished - The lab has been published. + LabStatePublished LabState = "Published" // LabStatePublishing - The lab is publishing. LabStatePublishing LabState = "Publishing" // LabStateScaling - The lab is scaling. LabStateScaling LabState = "Scaling" // LabStateSyncing - The lab is syncing users. LabStateSyncing LabState = "Syncing" - // LabStatePublished - The lab has been published. - LabStatePublished LabState = "Published" ) // PossibleLabStateValues returns the possible values for the LabState const type. func PossibleLabStateValues() []LabState { return []LabState{ LabStateDraft, + LabStatePublished, LabStatePublishing, LabStateScaling, LabStateSyncing, - LabStatePublished, } } @@ -172,26 +171,26 @@ func PossibleLabStateValues() []LabState { type OperationStatus string const ( - // OperationStatusNotStarted - The operation has been accepted but hasn't started. - OperationStatusNotStarted OperationStatus = "NotStarted" + // OperationStatusCanceled - Not supported yet + OperationStatusCanceled OperationStatus = "Canceled" + // OperationStatusFailed - The operation failed + OperationStatusFailed OperationStatus = "Failed" // OperationStatusInProgress - The operation is running OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusNotStarted - The operation has been accepted but hasn't started. + OperationStatusNotStarted OperationStatus = "NotStarted" // OperationStatusSucceeded - The operation Succeeded OperationStatusSucceeded OperationStatus = "Succeeded" - // OperationStatusFailed - The operation failed - OperationStatusFailed OperationStatus = "Failed" - // OperationStatusCanceled - Not supported yet - OperationStatusCanceled OperationStatus = "Canceled" ) // PossibleOperationStatusValues returns the possible values for the OperationStatus const type. func PossibleOperationStatusValues() []OperationStatus { return []OperationStatus{ - OperationStatusNotStarted, + OperationStatusCanceled, + OperationStatusFailed, OperationStatusInProgress, + OperationStatusNotStarted, OperationStatusSucceeded, - OperationStatusFailed, - OperationStatusCanceled, } } @@ -236,15 +235,15 @@ func PossibleOsStateValues() []OsState { type OsType string const ( - OsTypeWindows OsType = "Windows" OsTypeLinux OsType = "Linux" + OsTypeWindows OsType = "Windows" ) // PossibleOsTypeValues returns the possible values for the OsType const type. func PossibleOsTypeValues() []OsType { return []OsType{ - OsTypeWindows, OsTypeLinux, + OsTypeWindows, } } @@ -254,28 +253,28 @@ type ProvisioningState string const ( // ProvisioningStateCreating - Resource is in the process of being created. ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateUpdating - New property values are being applied to the resource. - ProvisioningStateUpdating ProvisioningState = "Updating" // ProvisioningStateDeleting - Resource is in the process of being deleted. ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateSucceeded - Resource is in healthy state after creation or update operation. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" // ProvisioningStateFailed - Previous operation on the resource has failed leaving resource in unhealthy state. ProvisioningStateFailed ProvisioningState = "Failed" // ProvisioningStateLocked - The resource is locked and changes are currently blocked. This could be due to maintenance or // a scheduled operation. The state will go back to succeeded once the locking operation has finished. ProvisioningStateLocked ProvisioningState = "Locked" + // ProvisioningStateSucceeded - Resource is in healthy state after creation or update operation. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - New property values are being applied to the resource. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ ProvisioningStateCreating, - ProvisioningStateUpdating, ProvisioningStateDeleting, - ProvisioningStateSucceeded, ProvisioningStateFailed, ProvisioningStateLocked, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, } } @@ -301,17 +300,17 @@ func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { type RegistrationState string const ( - // RegistrationStateRegistered - User has not yet registered with the lab. - RegistrationStateRegistered RegistrationState = "Registered" // RegistrationStateNotRegistered - User has registered with the lab. RegistrationStateNotRegistered RegistrationState = "NotRegistered" + // RegistrationStateRegistered - User has not yet registered with the lab. + RegistrationStateRegistered RegistrationState = "Registered" ) // PossibleRegistrationStateValues returns the possible values for the RegistrationState const type. func PossibleRegistrationStateValues() []RegistrationState { return []RegistrationState{ - RegistrationStateRegistered, RegistrationStateNotRegistered, + RegistrationStateRegistered, } } @@ -350,19 +349,19 @@ func PossibleRestrictionTypeValues() []RestrictionType { type SKUTier string const ( - SKUTierFree SKUTier = "Free" SKUTierBasic SKUTier = "Basic" - SKUTierStandard SKUTier = "Standard" + SKUTierFree SKUTier = "Free" SKUTierPremium SKUTier = "Premium" + SKUTierStandard SKUTier = "Standard" ) // PossibleSKUTierValues returns the possible values for the SKUTier const type. func PossibleSKUTierValues() []SKUTier { return []SKUTier{ - SKUTierFree, SKUTierBasic, - SKUTierStandard, + SKUTierFree, SKUTierPremium, + SKUTierStandard, } } @@ -391,21 +390,21 @@ func PossibleScaleTypeValues() []ScaleType { type ShutdownOnIdleMode string const ( + // ShutdownOnIdleModeLowUsage - The VM will be considered as idle when user is absent and the resource (CPU and disk) consumption + // is low. + ShutdownOnIdleModeLowUsage ShutdownOnIdleMode = "LowUsage" // ShutdownOnIdleModeNone - The VM won't be shut down when it is idle. ShutdownOnIdleModeNone ShutdownOnIdleMode = "None" // ShutdownOnIdleModeUserAbsence - The VM will be considered as idle when there is no keyboard or mouse input. ShutdownOnIdleModeUserAbsence ShutdownOnIdleMode = "UserAbsence" - // ShutdownOnIdleModeLowUsage - The VM will be considered as idle when user is absent and the resource (CPU and disk) consumption - // is low. - ShutdownOnIdleModeLowUsage ShutdownOnIdleMode = "LowUsage" ) // PossibleShutdownOnIdleModeValues returns the possible values for the ShutdownOnIdleMode const type. func PossibleShutdownOnIdleModeValues() []ShutdownOnIdleMode { return []ShutdownOnIdleMode{ + ShutdownOnIdleModeLowUsage, ShutdownOnIdleModeNone, ShutdownOnIdleModeUserAbsence, - ShutdownOnIdleModeLowUsage, } } @@ -427,32 +426,32 @@ func PossibleUsageUnitValues() []UsageUnit { type VirtualMachineState string const ( - // VirtualMachineStateStopped - The VM is currently stopped. - VirtualMachineStateStopped VirtualMachineState = "Stopped" - // VirtualMachineStateStarting - The VM is starting. - VirtualMachineStateStarting VirtualMachineState = "Starting" + // VirtualMachineStateRedeploying - The VM is being redeployed. + VirtualMachineStateRedeploying VirtualMachineState = "Redeploying" + // VirtualMachineStateReimaging - The VM is being reimaged. + VirtualMachineStateReimaging VirtualMachineState = "Reimaging" + // VirtualMachineStateResettingPassword - The VM password is being reset. + VirtualMachineStateResettingPassword VirtualMachineState = "ResettingPassword" // VirtualMachineStateRunning - The VM is running. VirtualMachineStateRunning VirtualMachineState = "Running" + // VirtualMachineStateStarting - The VM is starting. + VirtualMachineStateStarting VirtualMachineState = "Starting" + // VirtualMachineStateStopped - The VM is currently stopped. + VirtualMachineStateStopped VirtualMachineState = "Stopped" // VirtualMachineStateStopping - The VM is stopping. VirtualMachineStateStopping VirtualMachineState = "Stopping" - // VirtualMachineStateResettingPassword - The VM password is being reset. - VirtualMachineStateResettingPassword VirtualMachineState = "ResettingPassword" - // VirtualMachineStateReimaging - The VM is being reimaged. - VirtualMachineStateReimaging VirtualMachineState = "Reimaging" - // VirtualMachineStateRedeploying - The VM is being redeployed. - VirtualMachineStateRedeploying VirtualMachineState = "Redeploying" ) // PossibleVirtualMachineStateValues returns the possible values for the VirtualMachineState const type. func PossibleVirtualMachineStateValues() []VirtualMachineState { return []VirtualMachineState{ - VirtualMachineStateStopped, - VirtualMachineStateStarting, + VirtualMachineStateRedeploying, + VirtualMachineStateReimaging, + VirtualMachineStateResettingPassword, VirtualMachineStateRunning, + VirtualMachineStateStarting, + VirtualMachineStateStopped, VirtualMachineStateStopping, - VirtualMachineStateResettingPassword, - VirtualMachineStateReimaging, - VirtualMachineStateRedeploying, } } @@ -460,17 +459,17 @@ func PossibleVirtualMachineStateValues() []VirtualMachineState { type VirtualMachineType string const ( - // VirtualMachineTypeUser - A user VM - VirtualMachineTypeUser VirtualMachineType = "User" // VirtualMachineTypeTemplate - A template VM VirtualMachineTypeTemplate VirtualMachineType = "Template" + // VirtualMachineTypeUser - A user VM + VirtualMachineTypeUser VirtualMachineType = "User" ) // PossibleVirtualMachineTypeValues returns the possible values for the VirtualMachineType const type. func PossibleVirtualMachineTypeValues() []VirtualMachineType { return []VirtualMachineType{ - VirtualMachineTypeUser, VirtualMachineTypeTemplate, + VirtualMachineTypeUser, } } @@ -478,31 +477,31 @@ func PossibleVirtualMachineTypeValues() []VirtualMachineType { type WeekDay string const ( - // WeekDaySunday - Schedule will run on Sunday - WeekDaySunday WeekDay = "Sunday" + // WeekDayFriday - Schedule will run on Friday + WeekDayFriday WeekDay = "Friday" // WeekDayMonday - Schedule will run on Monday WeekDayMonday WeekDay = "Monday" + // WeekDaySaturday - Schedule will run on Saturday + WeekDaySaturday WeekDay = "Saturday" + // WeekDaySunday - Schedule will run on Sunday + WeekDaySunday WeekDay = "Sunday" + // WeekDayThursday - Schedule will run on Thursday + WeekDayThursday WeekDay = "Thursday" // WeekDayTuesday - Schedule will run on Tuesday WeekDayTuesday WeekDay = "Tuesday" // WeekDayWednesday - Schedule will run on Wednesday WeekDayWednesday WeekDay = "Wednesday" - // WeekDayThursday - Schedule will run on Thursday - WeekDayThursday WeekDay = "Thursday" - // WeekDayFriday - Schedule will run on Friday - WeekDayFriday WeekDay = "Friday" - // WeekDaySaturday - Schedule will run on Saturday - WeekDaySaturday WeekDay = "Saturday" ) // PossibleWeekDayValues returns the possible values for the WeekDay const type. func PossibleWeekDayValues() []WeekDay { return []WeekDay{ - WeekDaySunday, + WeekDayFriday, WeekDayMonday, + WeekDaySaturday, + WeekDaySunday, + WeekDayThursday, WeekDayTuesday, WeekDayWednesday, - WeekDayThursday, - WeekDayFriday, - WeekDaySaturday, } } diff --git a/sdk/resourcemanager/labservices/armlabservices/go.mod b/sdk/resourcemanager/labservices/armlabservices/go.mod index de29c121d722..b078d84d6152 100644 --- a/sdk/resourcemanager/labservices/armlabservices/go.mod +++ b/sdk/resourcemanager/labservices/armlabservices/go.mod @@ -2,20 +2,12 @@ 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 v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/labservices/armlabservices/go.sum b/sdk/resourcemanager/labservices/armlabservices/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/labservices/armlabservices/go.sum +++ b/sdk/resourcemanager/labservices/armlabservices/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/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/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/labservices/armlabservices/images_client.go b/sdk/resourcemanager/labservices/armlabservices/images_client.go index dab2b0c378ca..c117d4f69bf4 100644 --- a/sdk/resourcemanager/labservices/armlabservices/images_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/images_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,7 +46,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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -55,18 +54,21 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o // - body - The request body. // - options - ImagesClientCreateOrUpdateOptions contains the optional parameters for the ImagesClient.CreateOrUpdate method. func (client *ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labPlanName string, imageName string, body Image, options *ImagesClientCreateOrUpdateOptions) (ImagesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labPlanName, imageName, body, options) if err != nil { return ImagesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImagesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -93,10 +95,13 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -111,25 +116,28 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. // - imageName - The image name. // - options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, labPlanName string, imageName string, options *ImagesClientGetOptions) (ImagesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labPlanName, imageName, options) if err != nil { return ImagesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImagesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -156,7 +164,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,7 +181,7 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient // NewListByLabPlanPager - Gets all images from galleries attached to a lab plan. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 +235,7 @@ func (client *ImagesClient) listByLabPlanCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -248,7 +256,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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -256,18 +264,21 @@ func (client *ImagesClient) listByLabPlanHandleResponse(resp *http.Response) (Im // - body - The request body. // - options - ImagesClientUpdateOptions contains the optional parameters for the ImagesClient.Update method. func (client *ImagesClient) Update(ctx context.Context, resourceGroupName string, labPlanName string, imageName string, body ImageUpdate, options *ImagesClientUpdateOptions) (ImagesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, labPlanName, imageName, body, options) if err != nil { return ImagesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImagesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -294,10 +305,13 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/labservices/armlabservices/images_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/images_client_example_test.go deleted file mode 100644 index 0babacbf8c31..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/images_client_example_test.go +++ /dev/null @@ -1,233 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByLabPlanPager("testrg123", "testlabplan", &armlabservices.ImagesClientListByLabPlanOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedImages = armlabservices.PagedImages{ - // Value: []*armlabservices.Image{ - // { - // Name: to.Ptr("image1"), - // Type: to.Ptr("Microsoft.LabServices/Image"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan/images/image1"), - // Properties: &armlabservices.ImageProperties{ - // EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - // Description: to.Ptr("A description of the image"), - // DisplayName: to.Ptr("Windows Server 2019 Datacenter"), - // Offer: to.Ptr("WindowsServer"), - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("image2"), - // Type: to.Ptr("Microsoft.LabServices/Image"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan/images/image2"), - // Properties: &armlabservices.ImageProperties{ - // EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - // Description: to.Ptr("An example custom image response"), - // DisplayName: to.Ptr("A custom image"), - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/sig/images/test-1"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "testrg123", "testlabplan", "image1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armlabservices.Image{ - // Name: to.Ptr("image1"), - // Type: to.Ptr("Microsoft.LabServices/Image"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan/images/image1"), - // Properties: &armlabservices.ImageProperties{ - // EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - // Description: to.Ptr("A description of the image"), - // DisplayName: to.Ptr("Windows Server 2019 Datacenter"), - // Offer: to.Ptr("WindowsServer"), - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // Publisher: to.Ptr("Microsoft"), - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/2019.0.20190410"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().CreateOrUpdate(ctx, "testrg123", "testlabplan", "image1", armlabservices.Image{ - Properties: &armlabservices.ImageProperties{ - EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armlabservices.Image{ - // Name: to.Ptr("image1"), - // Type: to.Ptr("Microsoft.LabServices/Image"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan/images/image1"), - // Properties: &armlabservices.ImageProperties{ - // EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - // Description: to.Ptr("A description of the image"), - // DisplayName: to.Ptr("Windows Server 2019 Datacenter"), - // Offer: to.Ptr("WindowsServer"), - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Update(ctx, "testrg123", "testlabplan", "image1", armlabservices.ImageUpdate{ - Properties: &armlabservices.ImageUpdateProperties{ - EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armlabservices.Image{ - // Name: to.Ptr("image1"), - // Type: to.Ptr("Microsoft.LabServices/Image"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan/images/image1"), - // Properties: &armlabservices.ImageProperties{ - // EnabledState: to.Ptr(armlabservices.EnableStateEnabled), - // Description: to.Ptr("A description of the image"), - // DisplayName: to.Ptr("Windows Server 2019 Datacenter"), - // Offer: to.Ptr("WindowsServer"), - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/labplans_client.go b/sdk/resourcemanager/labservices/armlabservices/labplans_client.go index e2ca38be5deb..f3ce9518103b 100644 --- a/sdk/resourcemanager/labservices/armlabservices/labplans_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/labplans_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,7 +46,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -60,9 +59,10 @@ func (client *LabPlansClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabPlansClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *LabPlansClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Operation to create or update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabPlansClient) createOrUpdate(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlan, options *LabPlansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -107,17 +109,20 @@ func (client *LabPlansClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -128,9 +133,10 @@ func (client *LabPlansClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabPlansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ func (client *LabPlansClient) BeginDelete(ctx context.Context, resourceGroupName // 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 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, labPlanName string, options *LabPlansClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, labPlanName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -176,7 +184,7 @@ func (client *LabPlansClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,24 +193,27 @@ func (client *LabPlansClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Retrieves the properties of a Lab Plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 - LabPlansClientGetOptions contains the optional parameters for the LabPlansClient.Get method. func (client *LabPlansClient) Get(ctx context.Context, resourceGroupName string, labPlanName string, options *LabPlansClientGetOptions) (LabPlansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labPlanName, options) if err != nil { return LabPlansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LabPlansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LabPlansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LabPlansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -225,7 +236,7 @@ func (client *LabPlansClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +253,7 @@ func (client *LabPlansClient) getHandleResponse(resp *http.Response) (LabPlansCl // NewListByResourceGroupPager - Returns a list of all lab plans for a subscription and resource group. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - LabPlansClientListByResourceGroupOptions contains the optional parameters for the LabPlansClient.NewListByResourceGroupPager // method. @@ -290,7 +301,7 @@ func (client *LabPlansClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +318,7 @@ func (client *LabPlansClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Returns a list of all lab plans within a subscription // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - options - LabPlansClientListBySubscriptionOptions contains the optional parameters for the LabPlansClient.NewListBySubscriptionPager // method. func (client *LabPlansClient) NewListBySubscriptionPager(options *LabPlansClientListBySubscriptionOptions) *runtime.Pager[LabPlansClientListBySubscriptionResponse] { @@ -350,7 +361,7 @@ func (client *LabPlansClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -371,7 +382,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -383,9 +394,10 @@ func (client *LabPlansClient) BeginSaveImage(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientSaveImageResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientSaveImageResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabPlansClientSaveImageResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -394,20 +406,22 @@ func (client *LabPlansClient) BeginSaveImage(ctx context.Context, resourceGroupN // 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 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabPlansClient) saveImage(ctx context.Context, resourceGroupName string, labPlanName string, body SaveImageBody, options *LabPlansClientBeginSaveImageOptions) (*http.Response, error) { + var err error req, err := client.saveImageCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // saveImageCreateRequest creates the SaveImage request. @@ -430,16 +444,19 @@ func (client *LabPlansClient) saveImageCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginUpdate - Operation to update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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. @@ -451,9 +468,10 @@ func (client *LabPlansClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabPlansClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabPlansClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -462,20 +480,22 @@ func (client *LabPlansClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Operation to update a Lab Plan resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabPlansClient) update(ctx context.Context, resourceGroupName string, labPlanName string, body LabPlanUpdate, options *LabPlansClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, labPlanName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -498,8 +518,11 @@ func (client *LabPlansClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/labplans_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/labplans_client_example_test.go deleted file mode 100644 index ec76d158e176..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/labplans_client_example_test.go +++ /dev/null @@ -1,440 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLabPlansClient().NewListBySubscriptionPager(&armlabservices.LabPlansClientListBySubscriptionOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedLabPlans = armlabservices.PagedLabPlans{ - // Value: []*armlabservices.LabPlan{ - // { - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/LabPlan"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // Location: to.Ptr("westus"), - // Identity: &armlabservices.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("a799d834-d3c9-4554-ba5d-3771a995aa6a"), - // TenantID: to.Ptr("8c33e124-0581-45e0-84d4-f80d59de7806"), - // }, - // Properties: &armlabservices.LabPlanProperties{ - // DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT15M"), - // NoConnectDelay: to.Ptr("PT15M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - // SupportInfo: &armlabservices.SupportInfo{ - // Email: to.Ptr("help@contoso.com"), - // Instructions: to.Ptr("Contact support for help."), - // Phone: to.Ptr("+1-202-555-0123"), - // URL: to.Ptr("help.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLabPlansClient().NewListByResourceGroupPager("testrg123", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedLabPlans = armlabservices.PagedLabPlans{ - // Value: []*armlabservices.LabPlan{ - // { - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/LabPlan"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabPlanProperties{ - // DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - // SupportInfo: &armlabservices.SupportInfo{ - // Email: to.Ptr("help@contoso.com"), - // Instructions: to.Ptr("Contact support for help."), - // Phone: to.Ptr("+1-202-555-0123"), - // URL: to.Ptr("help.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLabPlansClient().Get(ctx, "testrg123", "testlabplan", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LabPlan = armlabservices.LabPlan{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/LabPlan"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // Location: to.Ptr("westus"), - // Identity: &armlabservices.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("a799d834-d3c9-4554-ba5d-3771a995aa6a"), - // TenantID: to.Ptr("8c33e124-0581-45e0-84d4-f80d59de7806"), - // }, - // Properties: &armlabservices.LabPlanProperties{ - // DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - // SupportInfo: &armlabservices.SupportInfo{ - // Email: to.Ptr("help@contoso.com"), - // Instructions: to.Ptr("Contact support for help."), - // Phone: to.Ptr("+1-202-555-0123"), - // URL: to.Ptr("help.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabPlansClient().BeginCreateOrUpdate(ctx, "testrg123", "testlabplan", armlabservices.LabPlan{ - Location: to.Ptr("westus"), - Properties: &armlabservices.LabPlanProperties{ - DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - DisconnectDelay: to.Ptr("PT5M"), - IdleDelay: to.Ptr("PT5M"), - NoConnectDelay: to.Ptr("PT5M"), - 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - SupportInfo: &armlabservices.SupportInfo{ - Email: to.Ptr("help@contoso.com"), - Instructions: to.Ptr("Contact support for help."), - Phone: to.Ptr("+1-202-555-0123"), - URL: to.Ptr("help.contoso.com"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LabPlan = armlabservices.LabPlan{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/LabPlan"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabPlanProperties{ - // DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - // SupportInfo: &armlabservices.SupportInfo{ - // Email: to.Ptr("help@contoso.com"), - // Instructions: to.Ptr("Contact support for help."), - // Phone: to.Ptr("+1-202-555-0123"), - // URL: to.Ptr("help.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabPlansClient().BeginUpdate(ctx, "testrg123", "testlabplan", 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), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LabPlan = armlabservices.LabPlan{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/LabPlan"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabPlanProperties{ - // DefaultAutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // SharedGalleryID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Compute/galleries/testsig"), - // SupportInfo: &armlabservices.SupportInfo{ - // Email: to.Ptr("help@contoso.com"), - // Instructions: to.Ptr("Contact support for help."), - // Phone: to.Ptr("+1-202-555-0123"), - // URL: to.Ptr("help.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabPlansClient().BeginDelete(ctx, "testrg123", "testlabplan", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabPlansClient().BeginSaveImage(ctx, "testrg123", "testlabplan", armlabservices.SaveImageBody{ - Name: to.Ptr("Test Image"), - LabVirtualMachineID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines/template"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/labs_client.go b/sdk/resourcemanager/labservices/armlabservices/labs_client.go index 25f3496d71aa..44bf9bb4201d 100644 --- a/sdk/resourcemanager/labservices/armlabservices/labs_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/labs_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,7 +46,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - body - The request body. @@ -59,9 +58,10 @@ func (client *LabsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *LabsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroup // CreateOrUpdate - Operation to create or update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabsClient) createOrUpdate(ctx context.Context, resourceGroupName string, labName string, body Lab, options *LabsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +108,19 @@ func (client *LabsClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Operation to delete a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - LabsClientBeginDeleteOptions contains the optional parameters for the LabsClient.BeginDelete method. @@ -125,9 +130,10 @@ func (client *LabsClient) BeginDelete(ctx context.Context, resourceGroupName str if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -136,20 +142,22 @@ func (client *LabsClient) BeginDelete(ctx context.Context, resourceGroupName str // Delete - Operation to delete a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabsClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -172,7 +180,7 @@ func (client *LabsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,23 +189,26 @@ func (client *LabsClient) deleteCreateRequest(ctx context.Context, resourceGroup // Get - Returns the properties of a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - LabsClientGetOptions contains the optional parameters for the LabsClient.Get method. func (client *LabsClient) Get(ctx context.Context, resourceGroupName string, labName string, options *LabsClientGetOptions) (LabsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { return LabsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LabsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LabsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LabsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -220,7 +231,7 @@ func (client *LabsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -237,7 +248,7 @@ func (client *LabsClient) getHandleResponse(resp *http.Response) (LabsClientGetR // NewListByResourceGroupPager - Returns a list of all labs in a resource group. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - LabsClientListByResourceGroupOptions contains the optional parameters for the LabsClient.NewListByResourceGroupPager // method. @@ -285,7 +296,7 @@ func (client *LabsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +313,7 @@ func (client *LabsClient) listByResourceGroupHandleResponse(resp *http.Response) // NewListBySubscriptionPager - Returns a list of all labs for a subscription. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - options - LabsClientListBySubscriptionOptions contains the optional parameters for the LabsClient.NewListBySubscriptionPager // method. func (client *LabsClient) NewListBySubscriptionPager(options *LabsClientListBySubscriptionOptions) *runtime.Pager[LabsClientListBySubscriptionResponse] { @@ -345,7 +356,7 @@ func (client *LabsClient) listBySubscriptionCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -366,7 +377,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - LabsClientBeginPublishOptions contains the optional parameters for the LabsClient.BeginPublish method. @@ -376,9 +387,10 @@ func (client *LabsClient) BeginPublish(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientPublishResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientPublishResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabsClientPublishResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -387,20 +399,22 @@ func (client *LabsClient) BeginPublish(ctx context.Context, resourceGroupName st // 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 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabsClient) publish(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginPublishOptions) (*http.Response, error) { + var err error req, err := client.publishCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // publishCreateRequest creates the Publish request. @@ -423,7 +437,7 @@ func (client *LabsClient) publishCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -432,7 +446,7 @@ func (client *LabsClient) publishCreateRequest(ctx context.Context, resourceGrou // 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - LabsClientBeginSyncGroupOptions contains the optional parameters for the LabsClient.BeginSyncGroup method. @@ -442,9 +456,10 @@ func (client *LabsClient) BeginSyncGroup(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientSyncGroupResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientSyncGroupResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabsClientSyncGroupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -453,20 +468,22 @@ func (client *LabsClient) BeginSyncGroup(ctx context.Context, resourceGroupName // 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 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabsClient) syncGroup(ctx context.Context, resourceGroupName string, labName string, options *LabsClientBeginSyncGroupOptions) (*http.Response, error) { + var err error req, err := client.syncGroupCreateRequest(ctx, resourceGroupName, labName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // syncGroupCreateRequest creates the SyncGroup request. @@ -489,7 +506,7 @@ func (client *LabsClient) syncGroupCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +515,7 @@ func (client *LabsClient) syncGroupCreateRequest(ctx context.Context, resourceGr // BeginUpdate - Operation to update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - body - The request body. @@ -509,9 +526,10 @@ func (client *LabsClient) BeginUpdate(ctx context.Context, resourceGroupName str if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LabsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[LabsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -520,20 +538,22 @@ func (client *LabsClient) BeginUpdate(ctx context.Context, resourceGroupName str // Update - Operation to update a lab resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *LabsClient) update(ctx context.Context, resourceGroupName string, labName string, body LabUpdate, options *LabsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, labName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -556,8 +576,11 @@ func (client *LabsClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/labs_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/labs_client_example_test.go deleted file mode 100644 index 9c9cbc07d300..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/labs_client_example_test.go +++ /dev/null @@ -1,579 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLabsClient().NewListBySubscriptionPager(&armlabservices.LabsClientListBySubscriptionOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedLabs = armlabservices.PagedLabs{ - // Value: []*armlabservices.Lab{ - // { - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/Lab"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabProperties{ - // Description: to.Ptr("This is a test lab."), - // AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // SecurityProfile: &armlabservices.SecurityProfile{ - // OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - // RegistrationCode: to.Ptr("fAkEcodE"), - // }, - // Title: to.Ptr("Test Lab"), - // VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - // AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - // InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // AdminUser: &armlabservices.Credentials{ - // Username: to.Ptr("test-user"), - // }, - // CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - // ImageReference: &armlabservices.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // SKU: &armlabservices.SKU{ - // Name: to.Ptr("Medium"), - // Capacity: to.Ptr[int32](20), - // }, - // UsageQuota: to.Ptr("PT10H"), - // UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // NetworkProfile: &armlabservices.LabNetworkProfile{ - // SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.LabStateDraft), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLabsClient().NewListByResourceGroupPager("testrg123", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedLabs = armlabservices.PagedLabs{ - // Value: []*armlabservices.Lab{ - // { - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/Lab"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabProperties{ - // Description: to.Ptr("This is a test lab."), - // AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // SecurityProfile: &armlabservices.SecurityProfile{ - // OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - // RegistrationCode: to.Ptr("fAkEcodE"), - // }, - // Title: to.Ptr("Test Lab"), - // VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - // AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - // InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // AdminUser: &armlabservices.Credentials{ - // Username: to.Ptr("test-user"), - // }, - // CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - // ImageReference: &armlabservices.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // SKU: &armlabservices.SKU{ - // Name: to.Ptr("Medium"), - // Capacity: to.Ptr[int32](20), - // }, - // UsageQuota: to.Ptr("PT10H"), - // UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // NetworkProfile: &armlabservices.LabNetworkProfile{ - // SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.LabStateDraft), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLabsClient().Get(ctx, "testrg123", "testlab", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Lab = armlabservices.Lab{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/Lab"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabProperties{ - // Description: to.Ptr("This is a test lab."), - // AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // SecurityProfile: &armlabservices.SecurityProfile{ - // OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - // RegistrationCode: to.Ptr("fAkEcodE"), - // }, - // Title: to.Ptr("Test Lab"), - // VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - // AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - // InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // AdminUser: &armlabservices.Credentials{ - // Username: to.Ptr("test-user"), - // }, - // CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - // ImageReference: &armlabservices.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // SKU: &armlabservices.SKU{ - // Name: to.Ptr("Medium"), - // Capacity: to.Ptr[int32](20), - // }, - // UsageQuota: to.Ptr("PT10H"), - // UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // NetworkProfile: &armlabservices.LabNetworkProfile{ - // SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.LabStateDraft), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabsClient().BeginCreateOrUpdate(ctx, "testrg123", "testlab", armlabservices.Lab{ - Location: to.Ptr("westus"), - Properties: &armlabservices.LabProperties{ - Description: to.Ptr("This is a test lab."), - AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - DisconnectDelay: to.Ptr("PT5M"), - IdleDelay: to.Ptr("PT5M"), - NoConnectDelay: to.Ptr("PT5M"), - 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - SecurityProfile: &armlabservices.SecurityProfile{ - OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - }, - Title: to.Ptr("Test Lab"), - VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - }, - AdminUser: &armlabservices.Credentials{ - Username: to.Ptr("test-user"), - }, - CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - ImageReference: &armlabservices.ImageReference{ - Offer: to.Ptr("WindowsServer"), - Publisher: to.Ptr("Microsoft"), - SKU: to.Ptr("2019-Datacenter"), - Version: to.Ptr("2019.0.20190410"), - }, - SKU: &armlabservices.SKU{ - Name: to.Ptr("Medium"), - }, - UsageQuota: to.Ptr("PT10H"), - UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - }, - NetworkProfile: &armlabservices.LabNetworkProfile{ - SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - State: to.Ptr(armlabservices.LabStateDraft), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Lab = armlabservices.Lab{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/Lab"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabProperties{ - // Description: to.Ptr("This is a test lab."), - // AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // SecurityProfile: &armlabservices.SecurityProfile{ - // OpenAccess: to.Ptr(armlabservices.EnableStateDisabled), - // RegistrationCode: to.Ptr("fAkEcodE"), - // }, - // Title: to.Ptr("Test Lab"), - // VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - // AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - // InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // AdminUser: &armlabservices.Credentials{ - // Username: to.Ptr("test-user"), - // }, - // CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - // ImageReference: &armlabservices.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // OSType: to.Ptr(armlabservices.OsTypeWindows), - // SKU: &armlabservices.SKU{ - // Name: to.Ptr("Medium"), - // Capacity: to.Ptr[int32](20), - // }, - // UsageQuota: to.Ptr("PT10H"), - // UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // NetworkProfile: &armlabservices.LabNetworkProfile{ - // SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.LabStateDraft), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabsClient().BeginUpdate(ctx, "testrg123", "testlab", armlabservices.LabUpdate{ - Properties: &armlabservices.LabUpdateProperties{ - SecurityProfile: &armlabservices.SecurityProfile{ - OpenAccess: to.Ptr(armlabservices.EnableStateEnabled), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Lab = armlabservices.Lab{ - // Name: to.Ptr("testlabplan"), - // Type: to.Ptr("Microsoft.LabServices/Lab"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab"), - // Location: to.Ptr("westus"), - // Properties: &armlabservices.LabProperties{ - // Description: to.Ptr("This is a test lab."), - // AutoShutdownProfile: &armlabservices.AutoShutdownProfile{ - // DisconnectDelay: to.Ptr("PT5M"), - // IdleDelay: to.Ptr("PT5M"), - // NoConnectDelay: to.Ptr("PT5M"), - // 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("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labPlans/testlabplan"), - // SecurityProfile: &armlabservices.SecurityProfile{ - // OpenAccess: to.Ptr(armlabservices.EnableStateEnabled), - // RegistrationCode: to.Ptr("fAkEcodE"), - // }, - // Title: to.Ptr("Test Lab"), - // VirtualMachineProfile: &armlabservices.VirtualMachineProfile{ - // AdditionalCapabilities: &armlabservices.VirtualMachineAdditionalCapabilities{ - // InstallGpuDrivers: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // AdminUser: &armlabservices.Credentials{ - // Username: to.Ptr("test-user"), - // }, - // CreateOption: to.Ptr(armlabservices.CreateOptionTemplateVM), - // ImageReference: &armlabservices.ImageReference{ - // Offer: to.Ptr("WindowsServer"), - // Publisher: to.Ptr("Microsoft"), - // SKU: to.Ptr("2019-Datacenter"), - // Version: to.Ptr("2019.0.20190410"), - // }, - // SKU: &armlabservices.SKU{ - // Name: to.Ptr("Medium"), - // Capacity: to.Ptr[int32](20), - // }, - // UsageQuota: to.Ptr("PT10H"), - // UseSharedPassword: to.Ptr(armlabservices.EnableStateDisabled), - // }, - // NetworkProfile: &armlabservices.LabNetworkProfile{ - // SubnetID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/id"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.LabStateDraft), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabsClient().BeginDelete(ctx, "testrg123", "testlab", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabsClient().BeginPublish(ctx, "testrg123", "testlab", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLabsClient().BeginSyncGroup(ctx, "testrg123", "testlab", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/models.go b/sdk/resourcemanager/labservices/armlabservices/models.go index 973b057a1843..6015b7690d32 100644 --- a/sdk/resourcemanager/labservices/armlabservices/models.go +++ b/sdk/resourcemanager/labservices/armlabservices/models.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -204,27 +203,6 @@ type ImageUpdateProperties struct { EnabledState *EnableState } -// ImagesClientCreateOrUpdateOptions contains the optional parameters for the ImagesClient.CreateOrUpdate method. -type ImagesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. -type ImagesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ImagesClientListByLabPlanOptions contains the optional parameters for the ImagesClient.NewListByLabPlanPager method. -type ImagesClientListByLabPlanOptions struct { - // The filter to apply to the operation. - Filter *string -} - -// ImagesClientUpdateOptions contains the optional parameters for the ImagesClient.Update method. -type ImagesClientUpdateOptions struct { - // placeholder for future optional parameters -} - // InviteBody - Body for a user invite request type InviteBody struct { // Custom text for the invite email. @@ -331,6 +309,9 @@ type LabPlanProperties struct { // READ-ONLY; Current provisioning state of the lab plan. ProvisioningState *ProvisioningState + + // READ-ONLY; Error details of last operation done on lab plan. + ResourceOperationError *ResourceOperationError } // LabPlanUpdate - Contains lab configuration and default settings. This variant is used for PATCH. @@ -373,48 +354,6 @@ type LabPlanUpdateProperties struct { SupportInfo *SupportInfo } -// LabPlansClientBeginCreateOrUpdateOptions contains the optional parameters for the LabPlansClient.BeginCreateOrUpdate method. -type LabPlansClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabPlansClientBeginDeleteOptions contains the optional parameters for the LabPlansClient.BeginDelete method. -type LabPlansClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabPlansClientBeginSaveImageOptions contains the optional parameters for the LabPlansClient.BeginSaveImage method. -type LabPlansClientBeginSaveImageOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabPlansClientBeginUpdateOptions contains the optional parameters for the LabPlansClient.BeginUpdate method. -type LabPlansClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabPlansClientGetOptions contains the optional parameters for the LabPlansClient.Get method. -type LabPlansClientGetOptions struct { - // placeholder for future optional parameters -} - -// LabPlansClientListByResourceGroupOptions contains the optional parameters for the LabPlansClient.NewListByResourceGroupPager -// method. -type LabPlansClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// LabPlansClientListBySubscriptionOptions contains the optional parameters for the LabPlansClient.NewListBySubscriptionPager -// method. -type LabPlansClientListBySubscriptionOptions struct { - // The filter to apply to the operation. - Filter *string -} - // LabProperties - Properties of a lab resource. type LabProperties struct { // The resource auto shutdown configuration for the lab. This controls whether actions are taken on resources that are sitting @@ -452,6 +391,9 @@ type LabProperties struct { // READ-ONLY; Current provisioning state of the lab. ProvisioningState *ProvisioningState + // READ-ONLY; Error details of last operation done on lab. + ResourceOperationError *ResourceOperationError + // READ-ONLY; The lab state. State *LabState } @@ -496,52 +438,6 @@ type LabUpdateProperties struct { VirtualMachineProfile *VirtualMachineProfile } -// LabsClientBeginCreateOrUpdateOptions contains the optional parameters for the LabsClient.BeginCreateOrUpdate method. -type LabsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabsClientBeginDeleteOptions contains the optional parameters for the LabsClient.BeginDelete method. -type LabsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabsClientBeginPublishOptions contains the optional parameters for the LabsClient.BeginPublish method. -type LabsClientBeginPublishOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabsClientBeginSyncGroupOptions contains the optional parameters for the LabsClient.BeginSyncGroup method. -type LabsClientBeginSyncGroupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabsClientBeginUpdateOptions contains the optional parameters for the LabsClient.BeginUpdate method. -type LabsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LabsClientGetOptions contains the optional parameters for the LabsClient.Get method. -type LabsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LabsClientListByResourceGroupOptions contains the optional parameters for the LabsClient.NewListByResourceGroupPager method. -type LabsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// LabsClientListBySubscriptionOptions contains the optional parameters for the LabsClient.NewListBySubscriptionPager method. -type LabsClientListBySubscriptionOptions struct { - // The filter to apply to the operation. - Filter *string -} - // ListUsagesResult - List of Core Usages. type ListUsagesResult struct { // The array page of Usages. @@ -624,16 +520,6 @@ type OperationResult struct { Name *string } -// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. -type OperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PagedImages - Paged list of Lab services virtual machine images. type PagedImages struct { // READ-ONLY; The link to get the next page of image results. @@ -747,6 +633,21 @@ type Resource struct { Type *string } +// ResourceOperationError - Error details of the latest operation failure on this resource +type ResourceOperationError struct { + // The operation action that failed + Action *string + + // The code that corresponds to the type of operation failure + Code *string + + // The operation failure message + Message *string + + // The datetime of when the error occured + Timestamp *time.Time +} + // RosterProfile - The lab user list management profile. type RosterProfile struct { // The AAD group ID which this lab roster is populated from. Having this set enables AAD sync mode. @@ -866,12 +767,6 @@ type SKURestrictions struct { Values []*string } -// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. -type SKUsClientListOptions struct { - // The filter to apply to the operation. - Filter *string -} - // SaveImageBody - Body for the save image POST type SaveImageBody struct { // The ID of the lab virtual machine you want to save an image from. @@ -918,6 +813,9 @@ type ScheduleProperties struct { // READ-ONLY; Current provisioning state of the schedule. ProvisioningState *ProvisioningState + + // READ-ONLY; Error details of last operation done on schedule. + ResourceOperationError *ResourceOperationError } // ScheduleUpdate - Schedule for automatically turning virtual machines in a lab on and off at specified times. Used for updates. @@ -944,33 +842,6 @@ type ScheduleUpdateProperties struct { TimeZoneID *string } -// SchedulesClientBeginDeleteOptions contains the optional parameters for the SchedulesClient.BeginDelete method. -type SchedulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SchedulesClientCreateOrUpdateOptions contains the optional parameters for the SchedulesClient.CreateOrUpdate method. -type SchedulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// SchedulesClientGetOptions contains the optional parameters for the SchedulesClient.Get method. -type SchedulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// SchedulesClientListByLabOptions contains the optional parameters for the SchedulesClient.NewListByLabPager method. -type SchedulesClientListByLabOptions struct { - // The filter to apply to the operation. - Filter *string -} - -// SchedulesClientUpdateOptions contains the optional parameters for the SchedulesClient.Update method. -type SchedulesClientUpdateOptions struct { - // placeholder for future optional parameters -} - // SecurityProfile - The lab security profile. type SecurityProfile struct { // Whether any user or only specified users can register to a lab. @@ -1071,12 +942,6 @@ type UsageName struct { Value *string } -// UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager method. -type UsagesClientListByLocationOptions struct { - // The filter to apply to the operation. - Filter *string -} - // User of a lab that can register for and use virtual machines within the lab. type User struct { // REQUIRED; User resource properties @@ -1118,6 +983,9 @@ type UserProperties struct { // READ-ONLY; State of the user's registration within the lab. RegistrationState *RegistrationState + // READ-ONLY; Error details of last operation done on lab plan. + ResourceOperationError *ResourceOperationError + // READ-ONLY; How long the user has used their virtual machines in this lab. TotalUsage *string } @@ -1134,41 +1002,6 @@ type UserUpdateProperties struct { AdditionalUsageQuota *string } -// UsersClientBeginCreateOrUpdateOptions contains the optional parameters for the UsersClient.BeginCreateOrUpdate method. -type UsersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// UsersClientBeginDeleteOptions contains the optional parameters for the UsersClient.BeginDelete method. -type UsersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// UsersClientBeginInviteOptions contains the optional parameters for the UsersClient.BeginInvite method. -type UsersClientBeginInviteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// UsersClientBeginUpdateOptions contains the optional parameters for the UsersClient.BeginUpdate method. -type UsersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// UsersClientGetOptions contains the optional parameters for the UsersClient.Get method. -type UsersClientGetOptions struct { - // placeholder for future optional parameters -} - -// UsersClientListByLabOptions contains the optional parameters for the UsersClient.NewListByLabPager method. -type UsersClientListByLabOptions struct { - // The filter to apply to the operation. - Filter *string -} - // VirtualMachine - A lab virtual machine resource. type VirtualMachine struct { // REQUIRED; Virtual machine resource properties @@ -1258,53 +1091,12 @@ type VirtualMachineProperties struct { // READ-ONLY; Current provisioning state of the virtual machine. ProvisioningState *ProvisioningState + // READ-ONLY; Error details of last operation done on lab plan. + ResourceOperationError *ResourceOperationError + // READ-ONLY; The current state of the virtual machine State *VirtualMachineState // READ-ONLY; The type of this VM resource VMType *VirtualMachineType } - -// VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy -// method. -type VirtualMachinesClientBeginRedeployOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage method. -type VirtualMachinesClientBeginReimageOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginResetPasswordOptions contains the optional parameters for the VirtualMachinesClient.BeginResetPassword -// method. -type VirtualMachinesClientBeginResetPasswordOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart method. -type VirtualMachinesClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop method. -type VirtualMachinesClientBeginStopOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. -type VirtualMachinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualMachinesClientListByLabOptions contains the optional parameters for the VirtualMachinesClient.NewListByLabPager -// method. -type VirtualMachinesClientListByLabOptions struct { - // The filter to apply to the operation. - Filter *string -} diff --git a/sdk/resourcemanager/labservices/armlabservices/models_serde.go b/sdk/resourcemanager/labservices/armlabservices/models_serde.go index 567411920122..c9f9047e5e53 100644 --- a/sdk/resourcemanager/labservices/armlabservices/models_serde.go +++ b/sdk/resourcemanager/labservices/armlabservices/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -704,6 +703,7 @@ func (l LabPlanProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "defaultNetworkProfile", l.DefaultNetworkProfile) populate(objectMap, "linkedLmsInstance", l.LinkedLmsInstance) populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceOperationError", l.ResourceOperationError) populate(objectMap, "sharedGalleryId", l.SharedGalleryID) populate(objectMap, "supportInfo", l.SupportInfo) return json.Marshal(objectMap) @@ -736,6 +736,9 @@ func (l *LabPlanProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &l.ResourceOperationError) + delete(rawMsg, key) case "sharedGalleryId": err = unpopulate(val, "SharedGalleryID", &l.SharedGalleryID) delete(rawMsg, key) @@ -845,6 +848,7 @@ func (l LabProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "labPlanId", l.LabPlanID) populate(objectMap, "networkProfile", l.NetworkProfile) populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceOperationError", l.ResourceOperationError) populate(objectMap, "rosterProfile", l.RosterProfile) populate(objectMap, "securityProfile", l.SecurityProfile) populate(objectMap, "state", l.State) @@ -880,6 +884,9 @@ func (l *LabProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &l.ResourceOperationError) + delete(rawMsg, key) case "rosterProfile": err = unpopulate(val, "RosterProfile", &l.RosterProfile) delete(rawMsg, key) @@ -1541,6 +1548,45 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceOperationError. +func (r ResourceOperationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", r.Action) + populate(objectMap, "code", r.Code) + populate(objectMap, "message", r.Message) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceOperationError. +func (r *ResourceOperationError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &r.Action) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RosterProfile. func (r RosterProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1910,6 +1956,7 @@ func (s ScheduleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "notes", s.Notes) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "recurrencePattern", s.RecurrencePattern) + populate(objectMap, "resourceOperationError", s.ResourceOperationError) populateTimeRFC3339(objectMap, "startAt", s.StartAt) populateTimeRFC3339(objectMap, "stopAt", s.StopAt) populate(objectMap, "timeZoneId", s.TimeZoneID) @@ -1934,6 +1981,9 @@ func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { case "recurrencePattern": err = unpopulate(val, "RecurrencePattern", &s.RecurrencePattern) delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &s.ResourceOperationError) + delete(rawMsg, key) case "startAt": err = unpopulateTimeRFC3339(val, "StartAt", &s.StartAt) delete(rawMsg, key) @@ -2339,6 +2389,7 @@ func (u UserProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "invitationState", u.InvitationState) populate(objectMap, "provisioningState", u.ProvisioningState) populate(objectMap, "registrationState", u.RegistrationState) + populate(objectMap, "resourceOperationError", u.ResourceOperationError) populate(objectMap, "totalUsage", u.TotalUsage) return json.Marshal(objectMap) } @@ -2373,6 +2424,9 @@ func (u *UserProperties) UnmarshalJSON(data []byte) error { case "registrationState": err = unpopulate(val, "RegistrationState", &u.RegistrationState) delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &u.ResourceOperationError) + delete(rawMsg, key) case "totalUsage": err = unpopulate(val, "TotalUsage", &u.TotalUsage) delete(rawMsg, key) @@ -2624,6 +2678,7 @@ func (v VirtualMachineProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "claimedByUserId", v.ClaimedByUserID) populate(objectMap, "connectionProfile", v.ConnectionProfile) populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "resourceOperationError", v.ResourceOperationError) populate(objectMap, "state", v.State) populate(objectMap, "vmType", v.VMType) return json.Marshal(objectMap) @@ -2647,6 +2702,9 @@ func (v *VirtualMachineProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) delete(rawMsg, key) + case "resourceOperationError": + err = unpopulate(val, "ResourceOperationError", &v.ResourceOperationError) + delete(rawMsg, key) case "state": err = unpopulate(val, "State", &v.State) delete(rawMsg, key) diff --git a/sdk/resourcemanager/labservices/armlabservices/operationresults_client.go b/sdk/resourcemanager/labservices/armlabservices/operationresults_client.go index b784b8117c4d..5c83e635fe08 100644 --- a/sdk/resourcemanager/labservices/armlabservices/operationresults_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/operationresults_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,22 +46,25 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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) { + var err error req, err := client.getCreateRequest(ctx, operationResultID, options) if err != nil { return OperationResultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationResultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return OperationResultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return OperationResultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -81,7 +83,7 @@ func (client *OperationResultsClient) getCreateRequest(ctx context.Context, oper return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/labservices/armlabservices/operationresults_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/operationresults_client_example_test.go deleted file mode 100644 index fd979eba1466..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/operationresults_client_example_test.go +++ /dev/null @@ -1,44 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationResultsClient().Get(ctx, "a64149d8-84cb-4566-ab8e-b4ee1a074174", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResult = armlabservices.OperationResult{ - // Name: to.Ptr("a64149d8-84cb-4566-ab8e-b4ee1a074174"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.LabServices/operationresults/a64149d8-84cb-4566-ab8e-b4ee1a074174"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // Status: to.Ptr(armlabservices.OperationStatusInProgress), - // } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/operations_client.go b/sdk/resourcemanager/labservices/armlabservices/operations_client.go index 2053af24b453..adcceedb4ca9 100644 --- a/sdk/resourcemanager/labservices/armlabservices/operations_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Returns a list of all operations. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/labservices/armlabservices/operations_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/operations_client_example_test.go deleted file mode 100644 index a843f98240c3..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/operations_client_example_test.go +++ /dev/null @@ -1,57 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armlabservices.OperationListResult{ - // Value: []*armlabservices.Operation{ - // { - // Name: to.Ptr("Microsoft.LabServices/labPlans/write"), - // Display: &armlabservices.OperationDisplay{ - // Description: to.Ptr("Create new or update an existing lab plan."), - // Operation: to.Ptr("Create or Update Lab Plan"), - // Provider: to.Ptr("Microsoft Azure Lab Services"), - // Resource: to.Ptr("Microsoft.LabServices/labPlans"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armlabservices.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/options.go b/sdk/resourcemanager/labservices/armlabservices/options.go new file mode 100644 index 000000000000..74298d6bc6bf --- /dev/null +++ b/sdk/resourcemanager/labservices/armlabservices/options.go @@ -0,0 +1,246 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armlabservices + +// ImagesClientCreateOrUpdateOptions contains the optional parameters for the ImagesClient.CreateOrUpdate method. +type ImagesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. +type ImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientListByLabPlanOptions contains the optional parameters for the ImagesClient.NewListByLabPlanPager method. +type ImagesClientListByLabPlanOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// ImagesClientUpdateOptions contains the optional parameters for the ImagesClient.Update method. +type ImagesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// LabPlansClientBeginCreateOrUpdateOptions contains the optional parameters for the LabPlansClient.BeginCreateOrUpdate method. +type LabPlansClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabPlansClientBeginDeleteOptions contains the optional parameters for the LabPlansClient.BeginDelete method. +type LabPlansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabPlansClientBeginSaveImageOptions contains the optional parameters for the LabPlansClient.BeginSaveImage method. +type LabPlansClientBeginSaveImageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabPlansClientBeginUpdateOptions contains the optional parameters for the LabPlansClient.BeginUpdate method. +type LabPlansClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabPlansClientGetOptions contains the optional parameters for the LabPlansClient.Get method. +type LabPlansClientGetOptions struct { + // placeholder for future optional parameters +} + +// LabPlansClientListByResourceGroupOptions contains the optional parameters for the LabPlansClient.NewListByResourceGroupPager +// method. +type LabPlansClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LabPlansClientListBySubscriptionOptions contains the optional parameters for the LabPlansClient.NewListBySubscriptionPager +// method. +type LabPlansClientListBySubscriptionOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// LabsClientBeginCreateOrUpdateOptions contains the optional parameters for the LabsClient.BeginCreateOrUpdate method. +type LabsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabsClientBeginDeleteOptions contains the optional parameters for the LabsClient.BeginDelete method. +type LabsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabsClientBeginPublishOptions contains the optional parameters for the LabsClient.BeginPublish method. +type LabsClientBeginPublishOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabsClientBeginSyncGroupOptions contains the optional parameters for the LabsClient.BeginSyncGroup method. +type LabsClientBeginSyncGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabsClientBeginUpdateOptions contains the optional parameters for the LabsClient.BeginUpdate method. +type LabsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LabsClientGetOptions contains the optional parameters for the LabsClient.Get method. +type LabsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LabsClientListByResourceGroupOptions contains the optional parameters for the LabsClient.NewListByResourceGroupPager method. +type LabsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LabsClientListBySubscriptionOptions contains the optional parameters for the LabsClient.NewListBySubscriptionPager method. +type LabsClientListBySubscriptionOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// SchedulesClientBeginDeleteOptions contains the optional parameters for the SchedulesClient.BeginDelete method. +type SchedulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SchedulesClientCreateOrUpdateOptions contains the optional parameters for the SchedulesClient.CreateOrUpdate method. +type SchedulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SchedulesClientGetOptions contains the optional parameters for the SchedulesClient.Get method. +type SchedulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SchedulesClientListByLabOptions contains the optional parameters for the SchedulesClient.NewListByLabPager method. +type SchedulesClientListByLabOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// SchedulesClientUpdateOptions contains the optional parameters for the SchedulesClient.Update method. +type SchedulesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager method. +type UsagesClientListByLocationOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// UsersClientBeginCreateOrUpdateOptions contains the optional parameters for the UsersClient.BeginCreateOrUpdate method. +type UsersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UsersClientBeginDeleteOptions contains the optional parameters for the UsersClient.BeginDelete method. +type UsersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UsersClientBeginInviteOptions contains the optional parameters for the UsersClient.BeginInvite method. +type UsersClientBeginInviteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UsersClientBeginUpdateOptions contains the optional parameters for the UsersClient.BeginUpdate method. +type UsersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// UsersClientGetOptions contains the optional parameters for the UsersClient.Get method. +type UsersClientGetOptions struct { + // placeholder for future optional parameters +} + +// UsersClientListByLabOptions contains the optional parameters for the UsersClient.NewListByLabPager method. +type UsersClientListByLabOptions struct { + // The filter to apply to the operation. + Filter *string +} + +// VirtualMachinesClientBeginRedeployOptions contains the optional parameters for the VirtualMachinesClient.BeginRedeploy +// method. +type VirtualMachinesClientBeginRedeployOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginReimageOptions contains the optional parameters for the VirtualMachinesClient.BeginReimage method. +type VirtualMachinesClientBeginReimageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginResetPasswordOptions contains the optional parameters for the VirtualMachinesClient.BeginResetPassword +// method. +type VirtualMachinesClientBeginResetPasswordOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginStartOptions contains the optional parameters for the VirtualMachinesClient.BeginStart method. +type VirtualMachinesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientBeginStopOptions contains the optional parameters for the VirtualMachinesClient.BeginStop method. +type VirtualMachinesClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. +type VirtualMachinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualMachinesClientListByLabOptions contains the optional parameters for the VirtualMachinesClient.NewListByLabPager +// method. +type VirtualMachinesClientListByLabOptions struct { + // The filter to apply to the operation. + Filter *string +} diff --git a/sdk/resourcemanager/labservices/armlabservices/response_types.go b/sdk/resourcemanager/labservices/armlabservices/response_types.go index eba3a1683e57..24bcbf200f8d 100644 --- a/sdk/resourcemanager/labservices/armlabservices/response_types.go +++ b/sdk/resourcemanager/labservices/armlabservices/response_types.go @@ -3,34 +3,39 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices // ImagesClientCreateOrUpdateResponse contains the response from method ImagesClient.CreateOrUpdate. type ImagesClientCreateOrUpdateResponse struct { + // Lab services virtual machine image Image } // ImagesClientGetResponse contains the response from method ImagesClient.Get. type ImagesClientGetResponse struct { + // Lab services virtual machine image Image } // ImagesClientListByLabPlanResponse contains the response from method ImagesClient.NewListByLabPlanPager. type ImagesClientListByLabPlanResponse struct { + // Paged list of Lab services virtual machine images. PagedImages } // ImagesClientUpdateResponse contains the response from method ImagesClient.Update. type ImagesClientUpdateResponse struct { + // Lab services virtual machine image Image } // LabPlansClientCreateOrUpdateResponse contains the response from method LabPlansClient.BeginCreateOrUpdate. type LabPlansClientCreateOrUpdateResponse struct { + // Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of default + // configurations that will apply at the time of creating a lab, but these defaults can still be overwritten. LabPlan } @@ -41,16 +46,20 @@ type LabPlansClientDeleteResponse struct { // LabPlansClientGetResponse contains the response from method LabPlansClient.Get. type LabPlansClientGetResponse struct { + // Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of default + // configurations that will apply at the time of creating a lab, but these defaults can still be overwritten. LabPlan } // LabPlansClientListByResourceGroupResponse contains the response from method LabPlansClient.NewListByResourceGroupPager. type LabPlansClientListByResourceGroupResponse struct { + // Paged list of lab plans. PagedLabPlans } // LabPlansClientListBySubscriptionResponse contains the response from method LabPlansClient.NewListBySubscriptionPager. type LabPlansClientListBySubscriptionResponse struct { + // Paged list of lab plans. PagedLabPlans } @@ -61,11 +70,14 @@ type LabPlansClientSaveImageResponse struct { // LabPlansClientUpdateResponse contains the response from method LabPlansClient.BeginUpdate. type LabPlansClientUpdateResponse struct { + // Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of default + // configurations that will apply at the time of creating a lab, but these defaults can still be overwritten. LabPlan } // LabsClientCreateOrUpdateResponse contains the response from method LabsClient.BeginCreateOrUpdate. type LabsClientCreateOrUpdateResponse struct { + // The lab resource. Lab } @@ -76,16 +88,19 @@ type LabsClientDeleteResponse struct { // LabsClientGetResponse contains the response from method LabsClient.Get. type LabsClientGetResponse struct { + // The lab resource. Lab } // LabsClientListByResourceGroupResponse contains the response from method LabsClient.NewListByResourceGroupPager. type LabsClientListByResourceGroupResponse struct { + // Paged list of labs. PagedLabs } // LabsClientListBySubscriptionResponse contains the response from method LabsClient.NewListBySubscriptionPager. type LabsClientListBySubscriptionResponse struct { + // Paged list of labs. PagedLabs } @@ -101,26 +116,31 @@ type LabsClientSyncGroupResponse struct { // LabsClientUpdateResponse contains the response from method LabsClient.BeginUpdate. type LabsClientUpdateResponse struct { + // The lab resource. Lab } // OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. type OperationResultsClientGetResponse struct { + // A long running operation result OperationResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // SKUsClientListResponse contains the response from method SKUsClient.NewListPager. type SKUsClientListResponse struct { + // Paged list of lab services skus. PagedSKUInfos } // SchedulesClientCreateOrUpdateResponse contains the response from method SchedulesClient.CreateOrUpdate. type SchedulesClientCreateOrUpdateResponse struct { + // Schedule for automatically turning virtual machines in a lab on and off at specified times. Schedule } @@ -131,26 +151,31 @@ type SchedulesClientDeleteResponse struct { // SchedulesClientGetResponse contains the response from method SchedulesClient.Get. type SchedulesClientGetResponse struct { + // Schedule for automatically turning virtual machines in a lab on and off at specified times. Schedule } // SchedulesClientListByLabResponse contains the response from method SchedulesClient.NewListByLabPager. type SchedulesClientListByLabResponse struct { + // Paged list of schedules. PagedSchedules } // SchedulesClientUpdateResponse contains the response from method SchedulesClient.Update. type SchedulesClientUpdateResponse struct { + // Schedule for automatically turning virtual machines in a lab on and off at specified times. Schedule } // UsagesClientListByLocationResponse contains the response from method UsagesClient.NewListByLocationPager. type UsagesClientListByLocationResponse struct { + // List of Core Usages. ListUsagesResult } // UsersClientCreateOrUpdateResponse contains the response from method UsersClient.BeginCreateOrUpdate. type UsersClientCreateOrUpdateResponse struct { + // User of a lab that can register for and use virtual machines within the lab. User } @@ -161,6 +186,7 @@ type UsersClientDeleteResponse struct { // UsersClientGetResponse contains the response from method UsersClient.Get. type UsersClientGetResponse struct { + // User of a lab that can register for and use virtual machines within the lab. User } @@ -171,21 +197,25 @@ type UsersClientInviteResponse struct { // UsersClientListByLabResponse contains the response from method UsersClient.NewListByLabPager. type UsersClientListByLabResponse struct { + // Paged list of users. PagedUsers } // UsersClientUpdateResponse contains the response from method UsersClient.BeginUpdate. type UsersClientUpdateResponse struct { + // User of a lab that can register for and use virtual machines within the lab. User } // VirtualMachinesClientGetResponse contains the response from method VirtualMachinesClient.Get. type VirtualMachinesClientGetResponse struct { + // A lab virtual machine resource. VirtualMachine } // VirtualMachinesClientListByLabResponse contains the response from method VirtualMachinesClient.NewListByLabPager. type VirtualMachinesClientListByLabResponse struct { + // Paged list of lab services virtual machines. PagedVirtualMachines } diff --git a/sdk/resourcemanager/labservices/armlabservices/schedules_client.go b/sdk/resourcemanager/labservices/armlabservices/schedules_client.go index 65f82b68090c..55b95cb06f2b 100644 --- a/sdk/resourcemanager/labservices/armlabservices/schedules_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/schedules_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,7 +46,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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. @@ -55,18 +54,21 @@ func NewSchedulesClient(subscriptionID string, credential azcore.TokenCredential // - options - SchedulesClientCreateOrUpdateOptions contains the optional parameters for the SchedulesClient.CreateOrUpdate // method. func (client *SchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labName string, scheduleName string, body Schedule, options *SchedulesClientCreateOrUpdateOptions) (SchedulesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labName, scheduleName, body, options) if err != nil { return SchedulesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SchedulesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SchedulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SchedulesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -93,10 +95,13 @@ func (client *SchedulesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -111,7 +116,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. @@ -122,9 +127,10 @@ func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SchedulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,20 +139,22 @@ func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Operation to delete a schedule resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *SchedulesClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, scheduleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -173,7 +181,7 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,24 +190,27 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource // Get - Returns the properties of a lab Schedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. // - options - SchedulesClientGetOptions contains the optional parameters for the SchedulesClient.Get method. func (client *SchedulesClient) Get(ctx context.Context, resourceGroupName string, labName string, scheduleName string, options *SchedulesClientGetOptions) (SchedulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labName, scheduleName, options) if err != nil { return SchedulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SchedulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SchedulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SchedulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -226,7 +237,7 @@ func (client *SchedulesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +254,7 @@ func (client *SchedulesClient) getHandleResponse(resp *http.Response) (Schedules // NewListByLabPager - Returns a list of all schedules for a lab. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - SchedulesClientListByLabOptions contains the optional parameters for the SchedulesClient.NewListByLabPager method. @@ -295,7 +306,7 @@ func (client *SchedulesClient) listByLabCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -316,25 +327,28 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - scheduleName - The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. // - body - The request body. // - options - SchedulesClientUpdateOptions contains the optional parameters for the SchedulesClient.Update method. func (client *SchedulesClient) Update(ctx context.Context, resourceGroupName string, labName string, scheduleName string, body ScheduleUpdate, options *SchedulesClientUpdateOptions) (SchedulesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, labName, scheduleName, body, options) if err != nil { return SchedulesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SchedulesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SchedulesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SchedulesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -361,10 +375,13 @@ func (client *SchedulesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/labservices/armlabservices/schedules_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/schedules_client_example_test.go deleted file mode 100644 index 95c6d6028ccd..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/schedules_client_example_test.go +++ /dev/null @@ -1,280 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSchedulesClient().NewListByLabPager("testrg123", "testlab", &armlabservices.SchedulesClientListByLabOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedSchedules = armlabservices.PagedSchedules{ - // Value: []*armlabservices.Schedule{ - // { - // Name: to.Ptr("schedule1"), - // Type: to.Ptr("Microsoft.LabServices/Schedule"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/schedules/schedule1"), - // Properties: &armlabservices.ScheduleProperties{ - // Notes: to.Ptr("Schedule 1 for students"), - // RecurrencePattern: &armlabservices.RecurrencePattern{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); return t}()), - // Frequency: to.Ptr(armlabservices.RecurrenceFrequencyDaily), - // Interval: to.Ptr[int32](1), - // }, - // 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("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("schedule2"), - // Type: to.Ptr("Microsoft.LabServices/Schedule"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/schedules/schedule2"), - // Properties: &armlabservices.ScheduleProperties{ - // Notes: to.Ptr("Schedule 2 for students"), - // RecurrencePattern: &armlabservices.RecurrencePattern{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); return t}()), - // Frequency: to.Ptr(armlabservices.RecurrenceFrequencyWeekly), - // WeekDays: []*armlabservices.WeekDay{ - // to.Ptr(armlabservices.WeekDayMonday), - // to.Ptr(armlabservices.WeekDayTuesday), - // to.Ptr(armlabservices.WeekDayWednesday), - // to.Ptr(armlabservices.WeekDayThursday), - // to.Ptr(armlabservices.WeekDayFriday)}, - // }, - // 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("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchedulesClient().Get(ctx, "testrg123", "testlab", "schedule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armlabservices.Schedule{ - // Name: to.Ptr("schedule1"), - // Type: to.Ptr("Microsoft.LabServices/Schedule"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/schedules/schedule1"), - // Properties: &armlabservices.ScheduleProperties{ - // Notes: to.Ptr("Schedule 1 for students"), - // RecurrencePattern: &armlabservices.RecurrencePattern{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); return t}()), - // Frequency: to.Ptr(armlabservices.RecurrenceFrequencyDaily), - // Interval: to.Ptr[int32](1), - // }, - // 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("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchedulesClient().CreateOrUpdate(ctx, "testrg123", "testlab", "schedule1", armlabservices.Schedule{ - Properties: &armlabservices.ScheduleProperties{ - Notes: to.Ptr("Schedule 1 for students"), - RecurrencePattern: &armlabservices.RecurrencePattern{ - ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); 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("America/Los_Angeles"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armlabservices.Schedule{ - // Name: to.Ptr("schedule1"), - // Type: to.Ptr("Microsoft.LabServices/Schedule"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/schedules/schedule1"), - // Properties: &armlabservices.ScheduleProperties{ - // Notes: to.Ptr("Schedule 1 for students"), - // RecurrencePattern: &armlabservices.RecurrencePattern{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); 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("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchedulesClient().Update(ctx, "testrg123", "testlab", "schedule1", armlabservices.ScheduleUpdate{ - Properties: &armlabservices.ScheduleUpdateProperties{ - RecurrencePattern: &armlabservices.RecurrencePattern{ - ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armlabservices.Schedule{ - // Name: to.Ptr("schedule1"), - // Type: to.Ptr("Microsoft.LabServices/Schedule"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/schedules/schedule1"), - // Properties: &armlabservices.ScheduleProperties{ - // Notes: to.Ptr("Schedule 1 for students"), - // RecurrencePattern: &armlabservices.RecurrencePattern{ - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-14T23:59:59Z"); 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("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSchedulesClient().BeginDelete(ctx, "testrg123", "testlab", "schedule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/skus_client.go b/sdk/resourcemanager/labservices/armlabservices/skus_client.go index b2d7ea9d75de..fd41c7c85608 100644 --- a/sdk/resourcemanager/labservices/armlabservices/skus_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/skus_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -46,7 +45,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - Returns a list of Azure Lab Services resource SKUs. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -88,7 +87,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/labservices/armlabservices/skus_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/skus_client_example_test.go deleted file mode 100644 index 64d4dc72f611..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/skus_client_example_test.go +++ /dev/null @@ -1,290 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager(&armlabservices.SKUsClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedSKUInfos = armlabservices.PagedSKUInfos{ - // Value: []*armlabservices.SKUInfo{ - // { - // Name: to.Ptr("Standard_Fv2_2_4GB_64_S_SSD"), - // Capabilities: []*armlabservices.SKUCapabilities{ - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("StorageGB"), - // Value: to.Ptr("64"), - // }, - // { - // Name: to.Ptr("StorageType"), - // Value: to.Ptr("StandardSSD"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1,V2"), - // }, - // { - // Name: to.Ptr("IsGpu"), - // Value: to.Ptr("False"), - // }}, - // Capacity: &armlabservices.SKUCapacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](400), - // Minimum: to.Ptr[int64](0), - // ScaleType: to.Ptr(armlabservices.ScaleTypeAutomatic), - // }, - // Costs: []*armlabservices.SKUCost{ - // { - // ExtendedUnit: to.Ptr("WindowsHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](20.4), - // }, - // { - // ExtendedUnit: to.Ptr("HybridBenefitHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](20.4), - // }, - // { - // ExtendedUnit: to.Ptr("InactiveHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](0.7), - // }, - // { - // ExtendedUnit: to.Ptr("LinuxHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](20.4), - // }}, - // Family: to.Ptr("Fv2"), - // Locations: []*string{ - // to.Ptr("eastus2")}, - // ResourceType: to.Ptr("labs"), - // Size: to.Ptr("Fv2_2_4GB_64_S_SSD"), - // Tier: to.Ptr(armlabservices.LabServicesSKUTierStandard), - // }, - // { - // Name: to.Ptr("Standard_Fv2_2_4GB_256_S_SSD"), - // Capabilities: []*armlabservices.SKUCapabilities{ - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("4"), - // }, - // { - // Name: to.Ptr("StorageGB"), - // Value: to.Ptr("256"), - // }, - // { - // Name: to.Ptr("StorageType"), - // Value: to.Ptr("StandardSSD"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1,V2"), - // }, - // { - // Name: to.Ptr("IsGpu"), - // Value: to.Ptr("False"), - // }}, - // Capacity: &armlabservices.SKUCapacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](400), - // Minimum: to.Ptr[int64](0), - // ScaleType: to.Ptr(armlabservices.ScaleTypeAutomatic), - // }, - // Costs: []*armlabservices.SKUCost{ - // { - // ExtendedUnit: to.Ptr("WindowsHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](22.8), - // }, - // { - // ExtendedUnit: to.Ptr("HybridBenefitHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](22.8), - // }, - // { - // ExtendedUnit: to.Ptr("InactiveHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](2.7), - // }, - // { - // ExtendedUnit: to.Ptr("LinuxHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](22.8), - // }}, - // Family: to.Ptr("Fv2"), - // Locations: []*string{ - // to.Ptr("eastus2")}, - // ResourceType: to.Ptr("labs"), - // Size: to.Ptr("Fv2_2_4GB_256_S_SSD"), - // Tier: to.Ptr(armlabservices.LabServicesSKUTierStandard), - // }, - // { - // Name: to.Ptr("Standard_Dv4_2_8GB_128_S_SSD"), - // Capabilities: []*armlabservices.SKUCapabilities{ - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("8"), - // }, - // { - // Name: to.Ptr("StorageGB"), - // Value: to.Ptr("128"), - // }, - // { - // Name: to.Ptr("StorageType"), - // Value: to.Ptr("StandardSSD"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1,V2"), - // }, - // { - // Name: to.Ptr("IsGpu"), - // Value: to.Ptr("False"), - // }}, - // Capacity: &armlabservices.SKUCapacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](400), - // Minimum: to.Ptr[int64](0), - // ScaleType: to.Ptr(armlabservices.ScaleTypeAutomatic), - // }, - // Costs: []*armlabservices.SKUCost{ - // { - // ExtendedUnit: to.Ptr("WindowsHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](24.2), - // }, - // { - // ExtendedUnit: to.Ptr("HybridBenefitHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](24.2), - // }, - // { - // ExtendedUnit: to.Ptr("InactiveHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](1.4), - // }, - // { - // ExtendedUnit: to.Ptr("LinuxHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](24.2), - // }}, - // Family: to.Ptr("Dv4"), - // Locations: []*string{ - // to.Ptr("eastus2")}, - // ResourceType: to.Ptr("labs"), - // Size: to.Ptr("Dv4_2_8GB_128_S_SSD"), - // Tier: to.Ptr(armlabservices.LabServicesSKUTierStandard), - // }, - // { - // Name: to.Ptr("Standard_Dv4_2_8GB_256_S_SSD"), - // Capabilities: []*armlabservices.SKUCapabilities{ - // { - // Name: to.Ptr("vCPUs"), - // Value: to.Ptr("2"), - // }, - // { - // Name: to.Ptr("MemoryGB"), - // Value: to.Ptr("8"), - // }, - // { - // Name: to.Ptr("StorageGB"), - // Value: to.Ptr("256"), - // }, - // { - // Name: to.Ptr("StorageType"), - // Value: to.Ptr("StandardSSD"), - // }, - // { - // Name: to.Ptr("HyperVGenerations"), - // Value: to.Ptr("V1,V2"), - // }, - // { - // Name: to.Ptr("IsGpu"), - // Value: to.Ptr("False"), - // }}, - // Capacity: &armlabservices.SKUCapacity{ - // Default: to.Ptr[int64](1), - // Maximum: to.Ptr[int64](400), - // Minimum: to.Ptr[int64](0), - // ScaleType: to.Ptr(armlabservices.ScaleTypeAutomatic), - // }, - // Costs: []*armlabservices.SKUCost{ - // { - // ExtendedUnit: to.Ptr("WindowsHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](25.8), - // }, - // { - // ExtendedUnit: to.Ptr("HybridBenefitHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](25.8), - // }, - // { - // ExtendedUnit: to.Ptr("InactiveHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](2.7), - // }, - // { - // ExtendedUnit: to.Ptr("LinuxHourly"), - // MeterID: to.Ptr(""), - // Quantity: to.Ptr[float32](25.8), - // }}, - // Family: to.Ptr("Dv4"), - // Locations: []*string{ - // to.Ptr("eastus2")}, - // ResourceType: to.Ptr("labs"), - // Size: to.Ptr("Dv4_2_8GB_256_S_SSD"), - // Tier: to.Ptr(armlabservices.LabServicesSKUTierStandard), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/time_rfc3339.go b/sdk/resourcemanager/labservices/armlabservices/time_rfc3339.go index 88ecf6a4a80e..aa255a145f17 100644 --- a/sdk/resourcemanager/labservices/armlabservices/time_rfc3339.go +++ b/sdk/resourcemanager/labservices/armlabservices/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices diff --git a/sdk/resourcemanager/labservices/armlabservices/usages_client.go b/sdk/resourcemanager/labservices/armlabservices/usages_client.go index 2e2cb9a76826..825936f100fe 100644 --- a/sdk/resourcemanager/labservices/armlabservices/usages_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/usages_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -46,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByLocationPager - Returns list of usage per SKU family for the specified subscription in the specified region. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - location - The location name. // - options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager // method. @@ -94,7 +93,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/labservices/armlabservices/usages_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/usages_client_example_test.go deleted file mode 100644 index 1436f65f8fe5..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/usages_client_example_test.go +++ /dev/null @@ -1,64 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListByLocationPager("eastus2", &armlabservices.UsagesClientListByLocationOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armlabservices.ListUsagesResult{ - // Value: []*armlabservices.Usage{ - // { - // Name: &armlabservices.UsageName{ - // Value: to.Ptr("NCasv3T4"), - // }, - // CurrentValue: to.Ptr[int64](10), - // ID: to.Ptr(""), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr(armlabservices.UsageUnitCount), - // }, - // { - // Name: &armlabservices.UsageName{ - // Value: to.Ptr("ESv4"), - // }, - // CurrentValue: to.Ptr[int64](5), - // ID: to.Ptr(""), - // Limit: to.Ptr[int64](30), - // Unit: to.Ptr(armlabservices.UsageUnitCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/users_client.go b/sdk/resourcemanager/labservices/armlabservices/users_client.go index fa58528dd6c8..f4ce92b98bce 100644 --- a/sdk/resourcemanager/labservices/armlabservices/users_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/users_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,7 +46,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. @@ -60,9 +59,10 @@ func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UsersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *UsersClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Operation to create or update a lab user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *UsersClient) createOrUpdate(ctx context.Context, resourceGroupName string, labName string, userName string, body User, options *UsersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,16 +113,19 @@ func (client *UsersClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Operation to delete a user resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. @@ -131,9 +136,10 @@ func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UsersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +148,22 @@ func (client *UsersClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Operation to delete a user resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *UsersClient) deleteOperation(ctx context.Context, resourceGroupName string, labName string, userName string, options *UsersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, labName, userName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -182,7 +190,7 @@ func (client *UsersClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,24 +199,27 @@ func (client *UsersClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Returns the properties of a lab user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. // - options - UsersClientGetOptions contains the optional parameters for the UsersClient.Get method. func (client *UsersClient) Get(ctx context.Context, resourceGroupName string, labName string, userName string, options *UsersClientGetOptions) (UsersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labName, userName, options) if err != nil { return UsersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UsersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UsersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UsersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,7 +246,7 @@ func (client *UsersClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +264,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. @@ -265,9 +276,10 @@ func (client *UsersClient) BeginInvite(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientInviteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientInviteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UsersClientInviteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -276,20 +288,22 @@ func (client *UsersClient) BeginInvite(ctx context.Context, resourceGroupName st // Invite - Operation to invite a user to a lab. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *UsersClient) invite(ctx context.Context, resourceGroupName string, labName string, userName string, body InviteBody, options *UsersClientBeginInviteOptions) (*http.Response, error) { + var err error req, err := client.inviteCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // inviteCreateRequest creates the Invite request. @@ -316,15 +330,18 @@ func (client *UsersClient) inviteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // NewListByLabPager - Returns a list of all users for a lab. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - UsersClientListByLabOptions contains the optional parameters for the UsersClient.NewListByLabPager method. @@ -376,7 +393,7 @@ func (client *UsersClient) listByLabCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -397,7 +414,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - userName - The name of the user that uniquely identifies it within containing lab. Used in resource URIs. @@ -409,9 +426,10 @@ func (client *UsersClient) BeginUpdate(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UsersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UsersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -420,20 +438,22 @@ func (client *UsersClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Operation to update a lab user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *UsersClient) update(ctx context.Context, resourceGroupName string, labName string, userName string, body UserUpdate, options *UsersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, labName, userName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -460,8 +480,11 @@ func (client *UsersClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/labservices/armlabservices/users_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/users_client_example_test.go deleted file mode 100644 index 3e4c6e2b915e..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/users_client_example_test.go +++ /dev/null @@ -1,256 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsersClient().NewListByLabPager("testrg123", "testlab", &armlabservices.UsersClientListByLabOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedUsers = armlabservices.PagedUsers{ - // Value: []*armlabservices.User{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/User"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/users/testuser"), - // Properties: &armlabservices.UserProperties{ - // AdditionalUsageQuota: to.Ptr("PT10H"), - // DisplayName: to.Ptr("Test User"), - // Email: to.Ptr("testuser@contoso.com"), - // InvitationState: to.Ptr(armlabservices.InvitationStateSent), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // RegistrationState: to.Ptr(armlabservices.RegistrationStateRegistered), - // TotalUsage: to.Ptr("PT10H"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewUsersClient().Get(ctx, "testrg123", "testlab", "testuser", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.User = armlabservices.User{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/User"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/users/testuser"), - // Properties: &armlabservices.UserProperties{ - // AdditionalUsageQuota: to.Ptr("PT10H"), - // DisplayName: to.Ptr("Test User"), - // Email: to.Ptr("testuser@contoso.com"), - // InvitationState: to.Ptr(armlabservices.InvitationStateSent), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // RegistrationState: to.Ptr(armlabservices.RegistrationStateRegistered), - // TotalUsage: to.Ptr("PT10H"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUsersClient().BeginCreateOrUpdate(ctx, "testrg123", "testlab", "testuser", armlabservices.User{ - Properties: &armlabservices.UserProperties{ - AdditionalUsageQuota: to.Ptr("PT10H"), - Email: to.Ptr("testuser@contoso.com"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.User = armlabservices.User{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/User"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/users/testuser"), - // Properties: &armlabservices.UserProperties{ - // AdditionalUsageQuota: to.Ptr("PT10H"), - // DisplayName: to.Ptr("Test User"), - // Email: to.Ptr("testuser@contoso.com"), - // InvitationState: to.Ptr(armlabservices.InvitationStateSent), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // RegistrationState: to.Ptr(armlabservices.RegistrationStateRegistered), - // TotalUsage: to.Ptr("PT10H"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUsersClient().BeginUpdate(ctx, "testrg123", "testlab", "testuser", armlabservices.UserUpdate{ - Properties: &armlabservices.UserUpdateProperties{ - AdditionalUsageQuota: to.Ptr("PT10H"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.User = armlabservices.User{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/User"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/users/testuser"), - // Properties: &armlabservices.UserProperties{ - // AdditionalUsageQuota: to.Ptr("PT10H"), - // DisplayName: to.Ptr("Test User"), - // Email: to.Ptr("testuser@contoso.com"), - // InvitationState: to.Ptr(armlabservices.InvitationStateSent), - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // RegistrationState: to.Ptr(armlabservices.RegistrationStateRegistered), - // TotalUsage: to.Ptr("PT10H"), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUsersClient().BeginDelete(ctx, "testrg123", "testlab", "testuser", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewUsersClient().BeginInvite(ctx, "testrg123", "testlab", "testuser", armlabservices.InviteBody{ - Text: to.Ptr("Invitation to lab testlab"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client.go b/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client.go index d5a07c33a35b..92cd4792e814 100644 --- a/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client.go +++ b/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armlabservices @@ -47,25 +46,28 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource // URIs. // - options - VirtualMachinesClientGetOptions contains the optional parameters for the VirtualMachinesClient.Get method. func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientGetOptions) (VirtualMachinesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return VirtualMachinesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualMachinesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualMachinesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualMachinesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (Vir // NewListByLabPager - Returns a list of all virtual machines for a lab. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - options - VirtualMachinesClientListByLabOptions contains the optional parameters for the VirtualMachinesClient.NewListByLabPager @@ -162,7 +164,7 @@ func (client *VirtualMachinesClient) listByLabCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -183,7 +185,7 @@ 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 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -196,9 +198,10 @@ func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientRedeployResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientRedeployResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientRedeployResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -207,20 +210,22 @@ func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resource // 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 2022-08-01 +// Generated from API version 2023-06-07 func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { + var err error req, err := client.redeployCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // redeployCreateRequest creates the Redeploy request. @@ -247,7 +252,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +262,7 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, // snapshot of the reference environment of the lab. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -270,9 +275,10 @@ func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientReimageResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientReimageResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientReimageResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -282,20 +288,22 @@ func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceG // snapshot of the reference environment of the lab. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginReimageOptions) (*http.Response, error) { + var err error req, err := client.reimageCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // reimageCreateRequest creates the Reimage request. @@ -322,7 +330,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +339,7 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r // BeginResetPassword - Resets a lab virtual machine password. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -345,9 +353,10 @@ func (client *VirtualMachinesClient) BeginResetPassword(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientResetPasswordResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientResetPasswordResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientResetPasswordResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -356,20 +365,22 @@ func (client *VirtualMachinesClient) BeginResetPassword(ctx context.Context, res // ResetPassword - Resets a lab virtual machine password. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *VirtualMachinesClient) resetPassword(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, body ResetPasswordBody, options *VirtualMachinesClientBeginResetPasswordOptions) (*http.Response, error) { + var err error req, err := client.resetPasswordCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // resetPasswordCreateRequest creates the ResetPassword request. @@ -396,16 +407,19 @@ func (client *VirtualMachinesClient) resetPasswordCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginStart - Action to start a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -418,9 +432,10 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientStartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientStartResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -429,20 +444,22 @@ func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGro // Start - Action to start a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -469,7 +486,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -478,7 +495,7 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res // BeginStop - Action to stop a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 // - 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 plan. Used in resource URIs. // - virtualMachineName - The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource @@ -491,9 +508,10 @@ func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientStopResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualMachinesClientStopResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualMachinesClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -502,20 +520,22 @@ func (client *VirtualMachinesClient) BeginStop(ctx context.Context, resourceGrou // Stop - Action to stop a lab virtual machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01 +// Generated from API version 2023-06-07 func (client *VirtualMachinesClient) stop(ctx context.Context, resourceGroupName string, labName string, virtualMachineName string, options *VirtualMachinesClientBeginStopOptions) (*http.Response, error) { + var err error req, err := client.stopCreateRequest(ctx, resourceGroupName, labName, virtualMachineName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopCreateRequest creates the Stop request. @@ -542,7 +562,7 @@ func (client *VirtualMachinesClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01") + reqQP.Set("api-version", "2023-06-07") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client_example_test.go b/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client_example_test.go deleted file mode 100644 index 6514e60cd684..000000000000 --- a/sdk/resourcemanager/labservices/armlabservices/virtualmachines_client_example_test.go +++ /dev/null @@ -1,229 +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. -// DO NOT EDIT. - -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/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListByLabPager("testrg123", "testlab", &armlabservices.VirtualMachinesClientListByLabOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PagedVirtualMachines = armlabservices.PagedVirtualMachines{ - // Value: []*armlabservices.VirtualMachine{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/VirtualMachine"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines/template"), - // Properties: &armlabservices.VirtualMachineProperties{ - // ClaimedByUserID: to.Ptr("testuser567"), - // ConnectionProfile: &armlabservices.VirtualMachineConnectionProfile{ - // AdminUsername: to.Ptr("user123"), - // PrivateIPAddress: to.Ptr("192.168.2.1"), - // RdpAuthority: to.Ptr("vm-42.contoso.com:3389"), - // RdpInBrowserURL: to.Ptr("vm-42.contoso.com"), - // SSHAuthority: to.Ptr("vm-42.contoso.com:22"), - // SSHInBrowserURL: to.Ptr("vm-42.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.VirtualMachineStateRunning), - // VMType: to.Ptr(armlabservices.VirtualMachineTypeTemplate), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "testrg123", "testlab", "template", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualMachine = armlabservices.VirtualMachine{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.LabServices/VirtualMachine"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.LabServices/labs/testlab/virtualMachines/template"), - // Properties: &armlabservices.VirtualMachineProperties{ - // ClaimedByUserID: to.Ptr("testuser567"), - // ConnectionProfile: &armlabservices.VirtualMachineConnectionProfile{ - // AdminUsername: to.Ptr("user123"), - // PrivateIPAddress: to.Ptr("192.168.2.1"), - // RdpAuthority: to.Ptr("vm-42.contoso.com:3389"), - // RdpInBrowserURL: to.Ptr("vm-42.contoso.com"), - // SSHAuthority: to.Ptr("vm-42.contoso.com:22"), - // SSHInBrowserURL: to.Ptr("vm-42.contoso.com"), - // }, - // ProvisioningState: to.Ptr(armlabservices.ProvisioningStateSucceeded), - // State: to.Ptr(armlabservices.VirtualMachineStateRunning), - // VMType: to.Ptr(armlabservices.VirtualMachineTypeTemplate), - // }, - // SystemData: &armlabservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T10:00:00Z"); return t}()), - // CreatedBy: to.Ptr("identity123"), - // CreatedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-01T09:12:28Z"); return t}()), - // LastModifiedBy: to.Ptr("identity123"), - // LastModifiedByType: to.Ptr(armlabservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginStart(ctx, "testrg123", "testlab", "template", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginStop(ctx, "testrg123", "testlab", "template", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginReimage(ctx, "testrg123", "testlab", "template", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRedeploy(ctx, "testrg123", "testlab", "template", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4c2cdccf6ca3281dd50ed8788ce1de2e0d480973/specification/labservices/resource-manager/Microsoft.LabServices/stable/2022-08-01/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() - clientFactory, err := armlabservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginResetPassword(ctx, "testrg123", "testlab", "template", armlabservices.ResetPasswordBody{ - Password: to.Ptr("example-password"), - Username: to.Ptr("example-username"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -}