diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md index e8a875343893..ba32fadb887e 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md @@ -1,5 +1,115 @@ # Release History +## 2.0.0-beta.1 (2023-11-24) +### Breaking Changes + +- Type of `MachineExtensionProperties.ProtectedSettings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionProperties.Settings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionUpdateProperties.ProtectedSettings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionUpdateProperties.Settings` has been changed from `any` to `map[string]any` + +### Features Added + +- New enum type `AgentConfigurationMode` with values `AgentConfigurationModeFull`, `AgentConfigurationModeMonitor` +- New enum type `ArcKindEnum` with values `ArcKindEnumAVS`, `ArcKindEnumAWS`, `ArcKindEnumEPS`, `ArcKindEnumGCP`, `ArcKindEnumHCI`, `ArcKindEnumSCVMM`, `ArcKindEnumVMware` +- New enum type `EsuEligibility` with values `EsuEligibilityEligible`, `EsuEligibilityIneligible`, `EsuEligibilityUnknown` +- New enum type `EsuKeyState` with values `EsuKeyStateActive`, `EsuKeyStateInactive` +- New enum type `EsuServerType` with values `EsuServerTypeDatacenter`, `EsuServerTypeStandard` +- New enum type `LastAttemptStatusEnum` with values `LastAttemptStatusEnumFailed`, `LastAttemptStatusEnumSuccess` +- New enum type `LicenseAssignmentState` with values `LicenseAssignmentStateAssigned`, `LicenseAssignmentStateNotAssigned` +- New enum type `LicenseCoreType` with values `LicenseCoreTypePCore`, `LicenseCoreTypeVCore` +- New enum type `LicenseEdition` with values `LicenseEditionDatacenter`, `LicenseEditionStandard` +- New enum type `LicenseState` with values `LicenseStateActivated`, `LicenseStateDeactivated` +- New enum type `LicenseTarget` with values `LicenseTargetWindowsServer2012`, `LicenseTargetWindowsServer2012R2` +- New enum type `LicenseType` with values `LicenseTypeESU` +- New enum type `OsType` with values `OsTypeLinux`, `OsTypeWindows` +- New enum type `PatchOperationStartedBy` with values `PatchOperationStartedByPlatform`, `PatchOperationStartedByUser` +- New enum type `PatchOperationStatus` with values `PatchOperationStatusCompletedWithWarnings`, `PatchOperationStatusFailed`, `PatchOperationStatusInProgress`, `PatchOperationStatusSucceeded`, `PatchOperationStatusUnknown` +- New enum type `PatchServiceUsed` with values `PatchServiceUsedAPT`, `PatchServiceUsedUnknown`, `PatchServiceUsedWU`, `PatchServiceUsedWUWSUS`, `PatchServiceUsedYUM`, `PatchServiceUsedZypper` +- New enum type `ProvisioningState` with values `ProvisioningStateAccepted`, `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleted`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded`, `ProvisioningStateUpdating` +- New enum type `VMGuestPatchClassificationLinux` with values `VMGuestPatchClassificationLinuxCritical`, `VMGuestPatchClassificationLinuxOther`, `VMGuestPatchClassificationLinuxSecurity` +- New enum type `VMGuestPatchClassificationWindows` with values `VMGuestPatchClassificationWindowsCritical`, `VMGuestPatchClassificationWindowsDefinition`, `VMGuestPatchClassificationWindowsFeaturePack`, `VMGuestPatchClassificationWindowsSecurity`, `VMGuestPatchClassificationWindowsServicePack`, `VMGuestPatchClassificationWindowsTools`, `VMGuestPatchClassificationWindowsUpdateRollUp`, `VMGuestPatchClassificationWindowsUpdates` +- New enum type `VMGuestPatchRebootSetting` with values `VMGuestPatchRebootSettingAlways`, `VMGuestPatchRebootSettingIfRequired`, `VMGuestPatchRebootSettingNever` +- New enum type `VMGuestPatchRebootStatus` with values `VMGuestPatchRebootStatusCompleted`, `VMGuestPatchRebootStatusFailed`, `VMGuestPatchRebootStatusNotNeeded`, `VMGuestPatchRebootStatusRequired`, `VMGuestPatchRebootStatusStarted`, `VMGuestPatchRebootStatusUnknown` +- New function `NewAgentVersionClient(azcore.TokenCredential, *arm.ClientOptions) (*AgentVersionClient, error)` +- New function `*AgentVersionClient.Get(context.Context, string, string, *AgentVersionClientGetOptions) (AgentVersionClientGetResponse, error)` +- New function `*AgentVersionClient.List(context.Context, string, *AgentVersionClientListOptions) (AgentVersionClientListResponse, error)` +- New function `*ClientFactory.NewAgentVersionClient() *AgentVersionClient` +- New function `*ClientFactory.NewExtensionMetadataClient() *ExtensionMetadataClient` +- New function `*ClientFactory.NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient` +- New function `*ClientFactory.NewLicenseProfilesClient() *LicenseProfilesClient` +- New function `*ClientFactory.NewLicensesClient() *LicensesClient` +- New function `*ClientFactory.NewNetworkProfileClient() *NetworkProfileClient` +- New function `NewExtensionMetadataClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExtensionMetadataClient, error)` +- New function `*ExtensionMetadataClient.Get(context.Context, string, string, string, string, *ExtensionMetadataClientGetOptions) (ExtensionMetadataClientGetResponse, error)` +- New function `*ExtensionMetadataClient.NewListPager(string, string, string, *ExtensionMetadataClientListOptions) *runtime.Pager[ExtensionMetadataClientListResponse]` +- New function `NewHybridIdentityMetadataClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HybridIdentityMetadataClient, error)` +- New function `*HybridIdentityMetadataClient.Get(context.Context, string, string, string, *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error)` +- New function `*HybridIdentityMetadataClient.NewListByMachinesPager(string, string, *HybridIdentityMetadataClientListByMachinesOptions) *runtime.Pager[HybridIdentityMetadataClientListByMachinesResponse]` +- New function `NewLicenseProfilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LicenseProfilesClient, error)` +- New function `*LicenseProfilesClient.BeginCreateOrUpdate(context.Context, string, string, LicenseProfile, *LicenseProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicenseProfilesClientCreateOrUpdateResponse], error)` +- New function `*LicenseProfilesClient.BeginDelete(context.Context, string, string, *LicenseProfilesClientBeginDeleteOptions) (*runtime.Poller[LicenseProfilesClientDeleteResponse], error)` +- New function `*LicenseProfilesClient.Get(context.Context, string, string, *LicenseProfilesClientGetOptions) (LicenseProfilesClientGetResponse, error)` +- New function `*LicenseProfilesClient.NewListPager(string, string, *LicenseProfilesClientListOptions) *runtime.Pager[LicenseProfilesClientListResponse]` +- New function `*LicenseProfilesClient.BeginUpdate(context.Context, string, string, LicenseProfileUpdate, *LicenseProfilesClientBeginUpdateOptions) (*runtime.Poller[LicenseProfilesClientUpdateResponse], error)` +- New function `NewLicensesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LicensesClient, error)` +- New function `*LicensesClient.BeginCreateOrUpdate(context.Context, string, string, License, *LicensesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicensesClientCreateOrUpdateResponse], error)` +- New function `*LicensesClient.BeginDelete(context.Context, string, string, *LicensesClientBeginDeleteOptions) (*runtime.Poller[LicensesClientDeleteResponse], error)` +- New function `*LicensesClient.Get(context.Context, string, string, *LicensesClientGetOptions) (LicensesClientGetResponse, error)` +- New function `*LicensesClient.NewListByResourceGroupPager(string, *LicensesClientListByResourceGroupOptions) *runtime.Pager[LicensesClientListByResourceGroupResponse]` +- New function `*LicensesClient.NewListBySubscriptionPager(*LicensesClientListBySubscriptionOptions) *runtime.Pager[LicensesClientListBySubscriptionResponse]` +- New function `*LicensesClient.BeginUpdate(context.Context, string, string, LicenseUpdate, *LicensesClientBeginUpdateOptions) (*runtime.Poller[LicensesClientUpdateResponse], error)` +- New function `*LicensesClient.BeginValidateLicense(context.Context, License, *LicensesClientBeginValidateLicenseOptions) (*runtime.Poller[LicensesClientValidateLicenseResponse], error)` +- New function `*MachinesClient.BeginAssessPatches(context.Context, string, string, *MachinesClientBeginAssessPatchesOptions) (*runtime.Poller[MachinesClientAssessPatchesResponse], error)` +- New function `*MachinesClient.BeginInstallPatches(context.Context, string, string, MachineInstallPatchesParameters, *MachinesClientBeginInstallPatchesOptions) (*runtime.Poller[MachinesClientInstallPatchesResponse], error)` +- New function `NewNetworkProfileClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkProfileClient, error)` +- New function `*NetworkProfileClient.Get(context.Context, string, string, *NetworkProfileClientGetOptions) (NetworkProfileClientGetResponse, error)` +- New struct `AgentUpgrade` +- New struct `AgentVersion` +- New struct `AgentVersionsList` +- New struct `AvailablePatchCountByClassification` +- New struct `EsuKey` +- New struct `EsuProfileUpdateProperties` +- New struct `ExtensionValue` +- New struct `ExtensionValueListResult` +- New struct `ExtensionValueProperties` +- New struct `HybridIdentityMetadata` +- New struct `HybridIdentityMetadataList` +- New struct `HybridIdentityMetadataProperties` +- New struct `IPAddress` +- New struct `License` +- New struct `LicenseDetails` +- New struct `LicenseProfile` +- New struct `LicenseProfileArmEsuProperties` +- New struct `LicenseProfileMachineInstanceView` +- New struct `LicenseProfileMachineInstanceViewEsuProperties` +- New struct `LicenseProfileProperties` +- New struct `LicenseProfileUpdate` +- New struct `LicenseProfileUpdateProperties` +- New struct `LicenseProfilesListResult` +- New struct `LicenseProperties` +- New struct `LicenseUpdate` +- New struct `LicenseUpdateProperties` +- New struct `LicenseUpdatePropertiesLicenseDetails` +- New struct `LicensesListResult` +- New struct `LinuxParameters` +- New struct `MachineAssessPatchesResult` +- New struct `MachineInstallPatchesParameters` +- New struct `MachineInstallPatchesResult` +- New struct `NetworkInterface` +- New struct `NetworkProfile` +- New struct `Subnet` +- New struct `WindowsParameters` +- New field `ConfigMode` in struct `AgentConfiguration` +- New field `Kind`, `Resources` in struct `Machine` +- New field `EnableAutomaticUpgrade` in struct `MachineExtensionUpdateProperties` +- New field `AgentUpgrade`, `LicenseProfile`, `NetworkProfile` in struct `MachineProperties` +- New field `Kind` in struct `MachineUpdate` +- New field `AgentUpgrade` in struct `MachineUpdateProperties` +- New field `Expand` in struct `MachinesClientCreateOrUpdateOptions` +- New field `Expand` in struct `MachinesClientListByResourceGroupOptions` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go new file mode 100644 index 000000000000..61a0027e2c4b --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AgentVersionClient contains the methods for the AgentVersion group. +// Don't use this type directly, use NewAgentVersionClient() instead. +type AgentVersionClient struct { + internal *arm.Client +} + +// NewAgentVersionClient creates a new instance of AgentVersionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAgentVersionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentVersionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgentVersionClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets an Agent Version along with the download link currently present. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - osType - Defines the os type +// - version - Defines the agent version. To get latest, use latest or else a specific agent version. +// - options - AgentVersionClientGetOptions contains the optional parameters for the AgentVersionClient.Get method. +func (client *AgentVersionClient) Get(ctx context.Context, osType string, version string, options *AgentVersionClientGetOptions) (AgentVersionClientGetResponse, error) { + var err error + const operationName = "AgentVersionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, osType, version, options) + if err != nil { + return AgentVersionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentVersionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentVersionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgentVersionClient) getCreateRequest(ctx context.Context, osType string, version string, options *AgentVersionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}" + if osType == "" { + return nil, errors.New("parameter osType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osType}", url.PathEscape(osType)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AgentVersionClient) getHandleResponse(resp *http.Response) (AgentVersionClientGetResponse, error) { + result := AgentVersionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentVersion); err != nil { + return AgentVersionClientGetResponse{}, err + } + return result, nil +} + +// List - Gets all Agent Versions along with the download link currently present. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - osType - Defines the os type. +// - options - AgentVersionClientListOptions contains the optional parameters for the AgentVersionClient.List method. +func (client *AgentVersionClient) List(ctx context.Context, osType string, options *AgentVersionClientListOptions) (AgentVersionClientListResponse, error) { + var err error + const operationName = "AgentVersionClient.List" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listCreateRequest(ctx, osType, options) + if err != nil { + return AgentVersionClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentVersionClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentVersionClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *AgentVersionClient) listCreateRequest(ctx context.Context, osType string, options *AgentVersionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions" + if osType == "" { + return nil, errors.New("parameter osType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osType}", url.PathEscape(osType)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AgentVersionClient) listHandleResponse(resp *http.Response) (AgentVersionClientListResponse, error) { + result := AgentVersionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentVersionsList); err != nil { + return AgentVersionClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client_example_test.go new file mode 100644 index 000000000000..6ac059c61d0c --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client_example_test.go @@ -0,0 +1,76 @@ +//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 armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/AgentVersions_Get.json +func ExampleAgentVersionClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAgentVersionClient().List(ctx, "myOsType", 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.AgentVersionsList = armhybridcompute.AgentVersionsList{ + // Value: []*armhybridcompute.AgentVersion{ + // { + // AgentVersion: to.Ptr("1.26"), + // DownloadLink: to.Ptr("https://download.microsoft.com/download/8/4/5/845d5e04-bb09-4ed2-9ca8-bb51184cddc9/AzureConnectedMachineAgent.msi"), + // OSType: to.Ptr("myOsType"), + // }, + // { + // AgentVersion: to.Ptr("1.27"), + // DownloadLink: to.Ptr("https://download.microsoft.com/download/8/4/5/845d5e04-bb09-4ed2-9ca8-bb51184cddc9/AzureConnectedMachineAgent.msi"), + // OSType: to.Ptr("myOsType"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/AgentVersion_GetLatest.json +func ExampleAgentVersionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAgentVersionClient().Get(ctx, "myOsType", "1.27", 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.AgentVersion = armhybridcompute.AgentVersion{ + // AgentVersion: to.Ptr("1.27"), + // DownloadLink: to.Ptr("https://download.microsoft.com/download/8/4/5/845d5e04-bb09-4ed2-9ca8-bb51184cddc9/AzureConnectedMachineAgent.msi"), + // OSType: to.Ptr("myOsType"), + // } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md index 06f39f908314..c40f43f62ea1 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 - +module-version: 2.0.0-beta.1 +tag: package-preview-2023-06 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/build.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/build.go index e23dfa318359..220d54aa9951 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/build.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/hybridcompute/armhybridcompute +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/hybridcompute/armhybridcompute package armhybridcompute diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go index 85fe42876fc8..ebbefba66cef 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go @@ -37,6 +37,36 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAgentVersionClient creates a new instance of AgentVersionClient. +func (c *ClientFactory) NewAgentVersionClient() *AgentVersionClient { + subClient, _ := NewAgentVersionClient(c.credential, c.options) + return subClient +} + +// NewExtensionMetadataClient creates a new instance of ExtensionMetadataClient. +func (c *ClientFactory) NewExtensionMetadataClient() *ExtensionMetadataClient { + subClient, _ := NewExtensionMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient. +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewLicenseProfilesClient creates a new instance of LicenseProfilesClient. +func (c *ClientFactory) NewLicenseProfilesClient() *LicenseProfilesClient { + subClient, _ := NewLicenseProfilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewLicensesClient creates a new instance of LicensesClient. +func (c *ClientFactory) NewLicensesClient() *LicensesClient { + subClient, _ := NewLicensesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewMachineExtensionsClient creates a new instance of MachineExtensionsClient. func (c *ClientFactory) NewMachineExtensionsClient() *MachineExtensionsClient { subClient, _ := NewMachineExtensionsClient(c.subscriptionID, c.credential, c.options) @@ -55,6 +85,12 @@ func (c *ClientFactory) NewManagementClient() *ManagementClient { return subClient } +// NewNetworkProfileClient creates a new instance of NetworkProfileClient. +func (c *ClientFactory) NewNetworkProfileClient() *NetworkProfileClient { + subClient, _ := NewNetworkProfileClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go index f0698f8fa027..2ff1cd4c5458 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go @@ -10,9 +10,52 @@ package armhybridcompute const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.1" ) +// AgentConfigurationMode - Name of configuration mode to use. Modes are pre-defined configurations of security controls, +// extension allowlists and guest configuration, maintained by Microsoft. +type AgentConfigurationMode string + +const ( + AgentConfigurationModeFull AgentConfigurationMode = "full" + AgentConfigurationModeMonitor AgentConfigurationMode = "monitor" +) + +// PossibleAgentConfigurationModeValues returns the possible values for the AgentConfigurationMode const type. +func PossibleAgentConfigurationModeValues() []AgentConfigurationMode { + return []AgentConfigurationMode{ + AgentConfigurationModeFull, + AgentConfigurationModeMonitor, + } +} + +// ArcKindEnum - Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. +type ArcKindEnum string + +const ( + ArcKindEnumAVS ArcKindEnum = "AVS" + ArcKindEnumAWS ArcKindEnum = "AWS" + ArcKindEnumEPS ArcKindEnum = "EPS" + ArcKindEnumGCP ArcKindEnum = "GCP" + ArcKindEnumHCI ArcKindEnum = "HCI" + ArcKindEnumSCVMM ArcKindEnum = "SCVMM" + ArcKindEnumVMware ArcKindEnum = "VMware" +) + +// PossibleArcKindEnumValues returns the possible values for the ArcKindEnum const type. +func PossibleArcKindEnumValues() []ArcKindEnum { + return []ArcKindEnum{ + ArcKindEnumAVS, + ArcKindEnumAWS, + ArcKindEnumEPS, + ArcKindEnumGCP, + ArcKindEnumHCI, + ArcKindEnumSCVMM, + ArcKindEnumVMware, + } +} + // AssessmentModeTypes - Specifies the assessment mode. type AssessmentModeTypes string @@ -49,6 +92,56 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// EsuEligibility - The ESU eligibility. +type EsuEligibility string + +const ( + EsuEligibilityEligible EsuEligibility = "Eligible" + EsuEligibilityIneligible EsuEligibility = "Ineligible" + EsuEligibilityUnknown EsuEligibility = "Unknown" +) + +// PossibleEsuEligibilityValues returns the possible values for the EsuEligibility const type. +func PossibleEsuEligibilityValues() []EsuEligibility { + return []EsuEligibility{ + EsuEligibilityEligible, + EsuEligibilityIneligible, + EsuEligibilityUnknown, + } +} + +// EsuKeyState - The ESU key state. +type EsuKeyState string + +const ( + EsuKeyStateActive EsuKeyState = "Active" + EsuKeyStateInactive EsuKeyState = "Inactive" +) + +// PossibleEsuKeyStateValues returns the possible values for the EsuKeyState const type. +func PossibleEsuKeyStateValues() []EsuKeyState { + return []EsuKeyState{ + EsuKeyStateActive, + EsuKeyStateInactive, + } +} + +// EsuServerType - The server types for Esu. +type EsuServerType string + +const ( + EsuServerTypeDatacenter EsuServerType = "Datacenter" + EsuServerTypeStandard EsuServerType = "Standard" +) + +// PossibleEsuServerTypeValues returns the possible values for the EsuServerType const type. +func PossibleEsuServerTypeValues() []EsuServerType { + return []EsuServerType{ + EsuServerTypeDatacenter, + EsuServerTypeStandard, + } +} + type InstanceViewTypes string const ( @@ -62,6 +155,132 @@ func PossibleInstanceViewTypesValues() []InstanceViewTypes { } } +// LastAttemptStatusEnum - Specifies the status of Agent Upgrade. +type LastAttemptStatusEnum string + +const ( + LastAttemptStatusEnumFailed LastAttemptStatusEnum = "Failed" + LastAttemptStatusEnumSuccess LastAttemptStatusEnum = "Success" +) + +// PossibleLastAttemptStatusEnumValues returns the possible values for the LastAttemptStatusEnum const type. +func PossibleLastAttemptStatusEnumValues() []LastAttemptStatusEnum { + return []LastAttemptStatusEnum{ + LastAttemptStatusEnumFailed, + LastAttemptStatusEnumSuccess, + } +} + +// LicenseAssignmentState - Describes the license assignment state (Assigned or NotAssigned). +type LicenseAssignmentState string + +const ( + LicenseAssignmentStateAssigned LicenseAssignmentState = "Assigned" + LicenseAssignmentStateNotAssigned LicenseAssignmentState = "NotAssigned" +) + +// PossibleLicenseAssignmentStateValues returns the possible values for the LicenseAssignmentState const type. +func PossibleLicenseAssignmentStateValues() []LicenseAssignmentState { + return []LicenseAssignmentState{ + LicenseAssignmentStateAssigned, + LicenseAssignmentStateNotAssigned, + } +} + +// LicenseCoreType - Describes the license core type (pCore or vCore). +type LicenseCoreType string + +const ( + LicenseCoreTypePCore LicenseCoreType = "pCore" + LicenseCoreTypeVCore LicenseCoreType = "vCore" +) + +// PossibleLicenseCoreTypeValues returns the possible values for the LicenseCoreType const type. +func PossibleLicenseCoreTypeValues() []LicenseCoreType { + return []LicenseCoreType{ + LicenseCoreTypePCore, + LicenseCoreTypeVCore, + } +} + +// LicenseEdition - Describes the edition of the license. The values are either Standard or Datacenter. +type LicenseEdition string + +const ( + LicenseEditionDatacenter LicenseEdition = "Datacenter" + LicenseEditionStandard LicenseEdition = "Standard" +) + +// PossibleLicenseEditionValues returns the possible values for the LicenseEdition const type. +func PossibleLicenseEditionValues() []LicenseEdition { + return []LicenseEdition{ + LicenseEditionDatacenter, + LicenseEditionStandard, + } +} + +// LicenseState - Describes the state of the license. +type LicenseState string + +const ( + LicenseStateActivated LicenseState = "Activated" + LicenseStateDeactivated LicenseState = "Deactivated" +) + +// PossibleLicenseStateValues returns the possible values for the LicenseState const type. +func PossibleLicenseStateValues() []LicenseState { + return []LicenseState{ + LicenseStateActivated, + LicenseStateDeactivated, + } +} + +// LicenseTarget - Describes the license target server. +type LicenseTarget string + +const ( + LicenseTargetWindowsServer2012 LicenseTarget = "Windows Server 2012" + LicenseTargetWindowsServer2012R2 LicenseTarget = "Windows Server 2012 R2" +) + +// PossibleLicenseTargetValues returns the possible values for the LicenseTarget const type. +func PossibleLicenseTargetValues() []LicenseTarget { + return []LicenseTarget{ + LicenseTargetWindowsServer2012, + LicenseTargetWindowsServer2012R2, + } +} + +// LicenseType - The type of the license resource. +type LicenseType string + +const ( + LicenseTypeESU LicenseType = "ESU" +) + +// PossibleLicenseTypeValues returns the possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{ + LicenseTypeESU, + } +} + +// OsType - The operating system type of the machine. +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeWindows OsType = "Windows" +) + +// PossibleOsTypeValues returns the possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{ + OsTypeLinux, + OsTypeWindows, + } +} + // PatchModeTypes - Specifies the patch mode. type PatchModeTypes string @@ -82,6 +301,98 @@ func PossiblePatchModeTypesValues() []PatchModeTypes { } } +// PatchOperationStartedBy - Indicates if operation was triggered by user or by platform. +type PatchOperationStartedBy string + +const ( + PatchOperationStartedByPlatform PatchOperationStartedBy = "Platform" + PatchOperationStartedByUser PatchOperationStartedBy = "User" +) + +// PossiblePatchOperationStartedByValues returns the possible values for the PatchOperationStartedBy const type. +func PossiblePatchOperationStartedByValues() []PatchOperationStartedBy { + return []PatchOperationStartedBy{ + PatchOperationStartedByPlatform, + PatchOperationStartedByUser, + } +} + +// PatchOperationStatus - The overall success or failure status of the operation. It remains "InProgress" until the operation +// completes. At that point it will become "Unknown", "Failed", "Succeeded", or +// "CompletedWithWarnings." +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +// PossiblePatchOperationStatusValues returns the possible values for the PatchOperationStatus const type. +func PossiblePatchOperationStatusValues() []PatchOperationStatus { + return []PatchOperationStatus{ + PatchOperationStatusCompletedWithWarnings, + PatchOperationStatusFailed, + PatchOperationStatusInProgress, + PatchOperationStatusSucceeded, + PatchOperationStatusUnknown, + } +} + +// PatchServiceUsed - Specifies the patch service used for the operation. +type PatchServiceUsed string + +const ( + PatchServiceUsedAPT PatchServiceUsed = "APT" + PatchServiceUsedUnknown PatchServiceUsed = "Unknown" + PatchServiceUsedWU PatchServiceUsed = "WU" + PatchServiceUsedWUWSUS PatchServiceUsed = "WU_WSUS" + PatchServiceUsedYUM PatchServiceUsed = "YUM" + PatchServiceUsedZypper PatchServiceUsed = "Zypper" +) + +// PossiblePatchServiceUsedValues returns the possible values for the PatchServiceUsed const type. +func PossiblePatchServiceUsedValues() []PatchServiceUsed { + return []PatchServiceUsed{ + PatchServiceUsedAPT, + PatchServiceUsedUnknown, + PatchServiceUsedWU, + PatchServiceUsedWUWSUS, + PatchServiceUsedYUM, + PatchServiceUsedZypper, + } +} + +// ProvisioningState - The provisioning state, which only appears in the response. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + // PublicNetworkAccessType - The network access policy to determine if Azure Arc agents can use public Azure Arc service endpoints. // Defaults to disabled (access to Azure Arc services only via private link). type PublicNetworkAccessType string @@ -138,3 +449,89 @@ func PossibleStatusTypesValues() []StatusTypes { StatusTypesError, } } + +type VMGuestPatchClassificationLinux string + +const ( + VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" + VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" + VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" +) + +// PossibleVMGuestPatchClassificationLinuxValues returns the possible values for the VMGuestPatchClassificationLinux const type. +func PossibleVMGuestPatchClassificationLinuxValues() []VMGuestPatchClassificationLinux { + return []VMGuestPatchClassificationLinux{ + VMGuestPatchClassificationLinuxCritical, + VMGuestPatchClassificationLinuxOther, + VMGuestPatchClassificationLinuxSecurity, + } +} + +type VMGuestPatchClassificationWindows string + +const ( + VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" + VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" + VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" + VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" + VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" + VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" + VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" + VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" +) + +// PossibleVMGuestPatchClassificationWindowsValues returns the possible values for the VMGuestPatchClassificationWindows const type. +func PossibleVMGuestPatchClassificationWindowsValues() []VMGuestPatchClassificationWindows { + return []VMGuestPatchClassificationWindows{ + VMGuestPatchClassificationWindowsCritical, + VMGuestPatchClassificationWindowsDefinition, + VMGuestPatchClassificationWindowsFeaturePack, + VMGuestPatchClassificationWindowsSecurity, + VMGuestPatchClassificationWindowsServicePack, + VMGuestPatchClassificationWindowsTools, + VMGuestPatchClassificationWindowsUpdateRollUp, + VMGuestPatchClassificationWindowsUpdates, + } +} + +// VMGuestPatchRebootSetting - Defines when it is acceptable to reboot a VM during a software update operation. +type VMGuestPatchRebootSetting string + +const ( + VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" + VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" + VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" +) + +// PossibleVMGuestPatchRebootSettingValues returns the possible values for the VMGuestPatchRebootSetting const type. +func PossibleVMGuestPatchRebootSettingValues() []VMGuestPatchRebootSetting { + return []VMGuestPatchRebootSetting{ + VMGuestPatchRebootSettingAlways, + VMGuestPatchRebootSettingIfRequired, + VMGuestPatchRebootSettingNever, + } +} + +// VMGuestPatchRebootStatus - The reboot state of the VM following completion of the operation. +type VMGuestPatchRebootStatus string + +const ( + VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" + VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" + VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" + VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" + VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" + VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" +) + +// PossibleVMGuestPatchRebootStatusValues returns the possible values for the VMGuestPatchRebootStatus const type. +func PossibleVMGuestPatchRebootStatusValues() []VMGuestPatchRebootStatus { + return []VMGuestPatchRebootStatus{ + VMGuestPatchRebootStatusCompleted, + VMGuestPatchRebootStatusFailed, + VMGuestPatchRebootStatusNotNeeded, + VMGuestPatchRebootStatusRequired, + VMGuestPatchRebootStatusStarted, + VMGuestPatchRebootStatusUnknown, + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go new file mode 100644 index 000000000000..35483c765837 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go @@ -0,0 +1,189 @@ +//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 armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExtensionMetadataClient contains the methods for the ExtensionMetadata group. +// Don't use this type directly, use NewExtensionMetadataClient() instead. +type ExtensionMetadataClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExtensionMetadataClient creates a new instance of ExtensionMetadataClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewExtensionMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionMetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExtensionMetadataClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets an Extension Metadata based on location, publisher, extensionType and version +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - location - The location of the Extension being received. +// - publisher - The publisher of the Extension being received. +// - extensionType - The extensionType of the Extension being received. +// - version - The version of the Extension being received. +// - options - ExtensionMetadataClientGetOptions contains the optional parameters for the ExtensionMetadataClient.Get method. +func (client *ExtensionMetadataClient) Get(ctx context.Context, location string, publisher string, extensionType string, version string, options *ExtensionMetadataClientGetOptions) (ExtensionMetadataClientGetResponse, error) { + var err error + const operationName = "ExtensionMetadataClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, publisher, extensionType, version, options) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtensionMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExtensionMetadataClient) getCreateRequest(ctx context.Context, location string, publisher string, extensionType string, version string, options *ExtensionMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisher == "" { + return nil, errors.New("parameter publisher cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisher}", url.PathEscape(publisher)) + if extensionType == "" { + return nil, errors.New("parameter extensionType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionType}", url.PathEscape(extensionType)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExtensionMetadataClient) getHandleResponse(resp *http.Response) (ExtensionMetadataClientGetResponse, error) { + result := ExtensionMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionValue); err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all Extension versions based on location, publisher, extensionType +// +// Generated from API version 2023-06-20-preview +// - location - The location of the Extension being received. +// - publisher - The publisher of the Extension being received. +// - extensionType - The extensionType of the Extension being received. +// - options - ExtensionMetadataClientListOptions contains the optional parameters for the ExtensionMetadataClient.NewListPager +// method. +func (client *ExtensionMetadataClient) NewListPager(location string, publisher string, extensionType string, options *ExtensionMetadataClientListOptions) *runtime.Pager[ExtensionMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExtensionMetadataClientListResponse]{ + More: func(page ExtensionMetadataClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ExtensionMetadataClientListResponse) (ExtensionMetadataClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExtensionMetadataClient.NewListPager") + req, err := client.listCreateRequest(ctx, location, publisher, extensionType, options) + if err != nil { + return ExtensionMetadataClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionMetadataClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExtensionMetadataClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ExtensionMetadataClient) listCreateRequest(ctx context.Context, location string, publisher string, extensionType string, options *ExtensionMetadataClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisher == "" { + return nil, errors.New("parameter publisher cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisher}", url.PathEscape(publisher)) + if extensionType == "" { + return nil, errors.New("parameter extensionType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionType}", url.PathEscape(extensionType)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExtensionMetadataClient) listHandleResponse(resp *http.Response) (ExtensionMetadataClientListResponse, error) { + result := ExtensionMetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionValueListResult); err != nil { + return ExtensionMetadataClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go new file mode 100644 index 000000000000..b47937a509c7 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go @@ -0,0 +1,90 @@ +//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 armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/ExtensionMetadata_Get.json +func ExampleExtensionMetadataClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtensionMetadataClient().Get(ctx, "EastUS", "microsoft.azure.monitor", "azuremonitorlinuxagent", "1.9.1", 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.ExtensionValue = armhybridcompute.ExtensionValue{ + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.HybridCompute/locations/eastus/publishers/microsoft.azure.monitor/extensionTypes/azuremonitorlinuxagent/versions/1.9.1"), + // Properties: &armhybridcompute.ExtensionValueProperties{ + // ExtensionType: to.Ptr("azuremonitorlinuxagent"), + // Publisher: to.Ptr("microsoft.azure.monitor"), + // Version: to.Ptr("1.9.1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/ExtensionMetadata_List.json +func ExampleExtensionMetadataClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExtensionMetadataClient().NewListPager("EastUS", "microsoft.azure.monitor", "azuremonitorlinuxagent", 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.ExtensionValueListResult = armhybridcompute.ExtensionValueListResult{ + // Value: []*armhybridcompute.ExtensionValue{ + // { + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.HybridCompute/locations/eastus/publishers/microsoft.azure.monitor/extensionTypes/azuremonitorlinuxagent/versions/1.9.1"), + // Properties: &armhybridcompute.ExtensionValueProperties{ + // ExtensionType: to.Ptr("azuremonitorlinuxagent"), + // Publisher: to.Ptr("microsoft.azure.monitor"), + // Version: to.Ptr("1.9.1"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.HybridCompute/locations/eastus/publishers/microsoft.azure.monitor/extensionTypes/azuremonitorlinuxagent/versions/1.9.2"), + // Properties: &armhybridcompute.ExtensionValueProperties{ + // ExtensionType: to.Ptr("azuremonitorlinuxagent"), + // Publisher: to.Ptr("microsoft.azure.monitor"), + // Version: to.Ptr("1.9.2"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/agentversion_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/agentversion_server.go new file mode 100644 index 000000000000..3eb20bdb5da3 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/agentversion_server.go @@ -0,0 +1,135 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// AgentVersionServer is a fake server for instances of the armhybridcompute.AgentVersionClient type. +type AgentVersionServer struct { + // Get is the fake for method AgentVersionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, osType string, version string, options *armhybridcompute.AgentVersionClientGetOptions) (resp azfake.Responder[armhybridcompute.AgentVersionClientGetResponse], errResp azfake.ErrorResponder) + + // List is the fake for method AgentVersionClient.List + // HTTP status codes to indicate success: http.StatusOK + List func(ctx context.Context, osType string, options *armhybridcompute.AgentVersionClientListOptions) (resp azfake.Responder[armhybridcompute.AgentVersionClientListResponse], errResp azfake.ErrorResponder) +} + +// NewAgentVersionServerTransport creates a new instance of AgentVersionServerTransport with the provided implementation. +// The returned AgentVersionServerTransport instance is connected to an instance of armhybridcompute.AgentVersionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAgentVersionServerTransport(srv *AgentVersionServer) *AgentVersionServerTransport { + return &AgentVersionServerTransport{srv: srv} +} + +// AgentVersionServerTransport connects instances of armhybridcompute.AgentVersionClient to instances of AgentVersionServer. +// Don't use this type directly, use NewAgentVersionServerTransport instead. +type AgentVersionServerTransport struct { + srv *AgentVersionServer +} + +// Do implements the policy.Transporter interface for AgentVersionServerTransport. +func (a *AgentVersionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AgentVersionClient.Get": + resp, err = a.dispatchGet(req) + case "AgentVersionClient.List": + resp, err = a.dispatchList(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AgentVersionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.HybridCompute/osType/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + osTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("osType")]) + if err != nil { + return nil, err + } + versionParam, err := url.PathUnescape(matches[regex.SubexpIndex("version")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), osTypeParam, versionParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgentVersionServerTransport) dispatchList(req *http.Request) (*http.Response, error) { + if a.srv.List == nil { + return nil, &nonRetriableError{errors.New("fake for method List not implemented")} + } + const regexStr = `/providers/Microsoft\.HybridCompute/osType/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentVersions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + osTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("osType")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.List(req.Context(), osTypeParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentVersionsList, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/extensionmetadata_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/extensionmetadata_server.go new file mode 100644 index 000000000000..6b7f6c110196 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/extensionmetadata_server.go @@ -0,0 +1,160 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// ExtensionMetadataServer is a fake server for instances of the armhybridcompute.ExtensionMetadataClient type. +type ExtensionMetadataServer struct { + // Get is the fake for method ExtensionMetadataClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, publisher string, extensionType string, version string, options *armhybridcompute.ExtensionMetadataClientGetOptions) (resp azfake.Responder[armhybridcompute.ExtensionMetadataClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ExtensionMetadataClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(location string, publisher string, extensionType string, options *armhybridcompute.ExtensionMetadataClientListOptions) (resp azfake.PagerResponder[armhybridcompute.ExtensionMetadataClientListResponse]) +} + +// NewExtensionMetadataServerTransport creates a new instance of ExtensionMetadataServerTransport with the provided implementation. +// The returned ExtensionMetadataServerTransport instance is connected to an instance of armhybridcompute.ExtensionMetadataClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExtensionMetadataServerTransport(srv *ExtensionMetadataServer) *ExtensionMetadataServerTransport { + return &ExtensionMetadataServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armhybridcompute.ExtensionMetadataClientListResponse]](), + } +} + +// ExtensionMetadataServerTransport connects instances of armhybridcompute.ExtensionMetadataClient to instances of ExtensionMetadataServer. +// Don't use this type directly, use NewExtensionMetadataServerTransport instead. +type ExtensionMetadataServerTransport struct { + srv *ExtensionMetadataServer + newListPager *tracker[azfake.PagerResponder[armhybridcompute.ExtensionMetadataClientListResponse]] +} + +// Do implements the policy.Transporter interface for ExtensionMetadataServerTransport. +func (e *ExtensionMetadataServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ExtensionMetadataClient.Get": + resp, err = e.dispatchGet(req) + case "ExtensionMetadataClient.NewListPager": + resp, err = e.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *ExtensionMetadataServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensionTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + publisherParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisher")]) + if err != nil { + return nil, err + } + extensionTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionType")]) + if err != nil { + return nil, err + } + versionParam, err := url.PathUnescape(matches[regex.SubexpIndex("version")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), locationParam, publisherParam, extensionTypeParam, versionParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExtensionValue, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExtensionMetadataServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := e.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/publishers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/extensionTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + publisherParam, err := url.PathUnescape(matches[regex.SubexpIndex("publisher")]) + if err != nil { + return nil, err + } + extensionTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("extensionType")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListPager(locationParam, publisherParam, extensionTypeParam, nil) + newListPager = &resp + e.newListPager.add(req, newListPager) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + e.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/hybrididentitymetadata_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/hybrididentitymetadata_server.go new file mode 100644 index 000000000000..1c8ee9782646 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/hybrididentitymetadata_server.go @@ -0,0 +1,156 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// HybridIdentityMetadataServer is a fake server for instances of the armhybridcompute.HybridIdentityMetadataClient type. +type HybridIdentityMetadataServer struct { + // Get is the fake for method HybridIdentityMetadataClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, machineName string, metadataName string, options *armhybridcompute.HybridIdentityMetadataClientGetOptions) (resp azfake.Responder[armhybridcompute.HybridIdentityMetadataClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMachinesPager is the fake for method HybridIdentityMetadataClient.NewListByMachinesPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMachinesPager func(resourceGroupName string, machineName string, options *armhybridcompute.HybridIdentityMetadataClientListByMachinesOptions) (resp azfake.PagerResponder[armhybridcompute.HybridIdentityMetadataClientListByMachinesResponse]) +} + +// NewHybridIdentityMetadataServerTransport creates a new instance of HybridIdentityMetadataServerTransport with the provided implementation. +// The returned HybridIdentityMetadataServerTransport instance is connected to an instance of armhybridcompute.HybridIdentityMetadataClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHybridIdentityMetadataServerTransport(srv *HybridIdentityMetadataServer) *HybridIdentityMetadataServerTransport { + return &HybridIdentityMetadataServerTransport{ + srv: srv, + newListByMachinesPager: newTracker[azfake.PagerResponder[armhybridcompute.HybridIdentityMetadataClientListByMachinesResponse]](), + } +} + +// HybridIdentityMetadataServerTransport connects instances of armhybridcompute.HybridIdentityMetadataClient to instances of HybridIdentityMetadataServer. +// Don't use this type directly, use NewHybridIdentityMetadataServerTransport instead. +type HybridIdentityMetadataServerTransport struct { + srv *HybridIdentityMetadataServer + newListByMachinesPager *tracker[azfake.PagerResponder[armhybridcompute.HybridIdentityMetadataClientListByMachinesResponse]] +} + +// Do implements the policy.Transporter interface for HybridIdentityMetadataServerTransport. +func (h *HybridIdentityMetadataServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "HybridIdentityMetadataClient.Get": + resp, err = h.dispatchGet(req) + case "HybridIdentityMetadataClient.NewListByMachinesPager": + resp, err = h.dispatchNewListByMachinesPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hybridIdentityMetadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + metadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("metadataName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, machineNameParam, metadataNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HybridIdentityMetadata, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HybridIdentityMetadataServerTransport) dispatchNewListByMachinesPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByMachinesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMachinesPager not implemented")} + } + newListByMachinesPager := h.newListByMachinesPager.get(req) + if newListByMachinesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hybridIdentityMetadata` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByMachinesPager(resourceGroupNameParam, machineNameParam, nil) + newListByMachinesPager = &resp + h.newListByMachinesPager.add(req, newListByMachinesPager) + server.PagerResponderInjectNextLinks(newListByMachinesPager, req, func(page *armhybridcompute.HybridIdentityMetadataClientListByMachinesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMachinesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByMachinesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMachinesPager) { + h.newListByMachinesPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenseprofiles_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenseprofiles_server.go new file mode 100644 index 000000000000..c59f75105d5b --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenseprofiles_server.go @@ -0,0 +1,316 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// LicenseProfilesServer is a fake server for instances of the armhybridcompute.LicenseProfilesClient type. +type LicenseProfilesServer struct { + // BeginCreateOrUpdate is the fake for method LicenseProfilesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, machineName string, parameters armhybridcompute.LicenseProfile, options *armhybridcompute.LicenseProfilesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.LicenseProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method LicenseProfilesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, machineName string, options *armhybridcompute.LicenseProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcompute.LicenseProfilesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method LicenseProfilesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, machineName string, options *armhybridcompute.LicenseProfilesClientGetOptions) (resp azfake.Responder[armhybridcompute.LicenseProfilesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method LicenseProfilesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, machineName string, options *armhybridcompute.LicenseProfilesClientListOptions) (resp azfake.PagerResponder[armhybridcompute.LicenseProfilesClientListResponse]) + + // BeginUpdate is the fake for method LicenseProfilesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, machineName string, parameters armhybridcompute.LicenseProfileUpdate, options *armhybridcompute.LicenseProfilesClientBeginUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.LicenseProfilesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewLicenseProfilesServerTransport creates a new instance of LicenseProfilesServerTransport with the provided implementation. +// The returned LicenseProfilesServerTransport instance is connected to an instance of armhybridcompute.LicenseProfilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLicenseProfilesServerTransport(srv *LicenseProfilesServer) *LicenseProfilesServerTransport { + return &LicenseProfilesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armhybridcompute.LicenseProfilesClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientUpdateResponse]](), + } +} + +// LicenseProfilesServerTransport connects instances of armhybridcompute.LicenseProfilesClient to instances of LicenseProfilesServer. +// Don't use this type directly, use NewLicenseProfilesServerTransport instead. +type LicenseProfilesServerTransport struct { + srv *LicenseProfilesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armhybridcompute.LicenseProfilesClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhybridcompute.LicenseProfilesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for LicenseProfilesServerTransport. +func (l *LicenseProfilesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "LicenseProfilesClient.BeginCreateOrUpdate": + resp, err = l.dispatchBeginCreateOrUpdate(req) + case "LicenseProfilesClient.BeginDelete": + resp, err = l.dispatchBeginDelete(req) + case "LicenseProfilesClient.Get": + resp, err = l.dispatchGet(req) + case "LicenseProfilesClient.NewListPager": + resp, err = l.dispatchNewListPager(req) + case "LicenseProfilesClient.BeginUpdate": + resp, err = l.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (l *LicenseProfilesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if l.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := l.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/licenseProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.LicenseProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, machineNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + l.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + l.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + l.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (l *LicenseProfilesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if l.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := l.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/licenseProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginDelete(req.Context(), resourceGroupNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + l.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + l.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + l.beginDelete.remove(req) + } + + return resp, nil +} + +func (l *LicenseProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/licenseProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LicenseProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LicenseProfilesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := l.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/licenseProfiles` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + resp := l.srv.NewListPager(resourceGroupNameParam, machineNameParam, nil) + newListPager = &resp + l.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridcompute.LicenseProfilesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + l.newListPager.remove(req) + } + return resp, nil +} + +func (l *LicenseProfilesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if l.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := l.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/licenseProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.LicenseProfileUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginUpdate(req.Context(), resourceGroupNameParam, machineNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + l.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + l.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + l.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenses_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenses_server.go new file mode 100644 index 000000000000..6a3b005657eb --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/licenses_server.go @@ -0,0 +1,401 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// LicensesServer is a fake server for instances of the armhybridcompute.LicensesClient type. +type LicensesServer struct { + // BeginCreateOrUpdate is the fake for method LicensesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, licenseName string, parameters armhybridcompute.License, options *armhybridcompute.LicensesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.LicensesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method LicensesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, licenseName string, options *armhybridcompute.LicensesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcompute.LicensesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method LicensesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, licenseName string, options *armhybridcompute.LicensesClientGetOptions) (resp azfake.Responder[armhybridcompute.LicensesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method LicensesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridcompute.LicensesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridcompute.LicensesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method LicensesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridcompute.LicensesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridcompute.LicensesClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method LicensesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK + BeginUpdate func(ctx context.Context, resourceGroupName string, licenseName string, parameters armhybridcompute.LicenseUpdate, options *armhybridcompute.LicensesClientBeginUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.LicensesClientUpdateResponse], errResp azfake.ErrorResponder) + + // BeginValidateLicense is the fake for method LicensesClient.BeginValidateLicense + // HTTP status codes to indicate success: http.StatusOK + BeginValidateLicense func(ctx context.Context, parameters armhybridcompute.License, options *armhybridcompute.LicensesClientBeginValidateLicenseOptions) (resp azfake.PollerResponder[armhybridcompute.LicensesClientValidateLicenseResponse], errResp azfake.ErrorResponder) +} + +// NewLicensesServerTransport creates a new instance of LicensesServerTransport with the provided implementation. +// The returned LicensesServerTransport instance is connected to an instance of armhybridcompute.LicensesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLicensesServerTransport(srv *LicensesServer) *LicensesServerTransport { + return &LicensesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcompute.LicensesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcompute.LicensesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridcompute.LicensesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridcompute.LicensesClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhybridcompute.LicensesClientUpdateResponse]](), + beginValidateLicense: newTracker[azfake.PollerResponder[armhybridcompute.LicensesClientValidateLicenseResponse]](), + } +} + +// LicensesServerTransport connects instances of armhybridcompute.LicensesClient to instances of LicensesServer. +// Don't use this type directly, use NewLicensesServerTransport instead. +type LicensesServerTransport struct { + srv *LicensesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcompute.LicensesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcompute.LicensesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridcompute.LicensesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridcompute.LicensesClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhybridcompute.LicensesClientUpdateResponse]] + beginValidateLicense *tracker[azfake.PollerResponder[armhybridcompute.LicensesClientValidateLicenseResponse]] +} + +// Do implements the policy.Transporter interface for LicensesServerTransport. +func (l *LicensesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "LicensesClient.BeginCreateOrUpdate": + resp, err = l.dispatchBeginCreateOrUpdate(req) + case "LicensesClient.BeginDelete": + resp, err = l.dispatchBeginDelete(req) + case "LicensesClient.Get": + resp, err = l.dispatchGet(req) + case "LicensesClient.NewListByResourceGroupPager": + resp, err = l.dispatchNewListByResourceGroupPager(req) + case "LicensesClient.NewListBySubscriptionPager": + resp, err = l.dispatchNewListBySubscriptionPager(req) + case "LicensesClient.BeginUpdate": + resp, err = l.dispatchBeginUpdate(req) + case "LicensesClient.BeginValidateLicense": + resp, err = l.dispatchBeginValidateLicense(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (l *LicensesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if l.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := l.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.License](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + licenseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("licenseName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, licenseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + l.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + l.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (l *LicensesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if l.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := l.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + licenseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("licenseName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginDelete(req.Context(), resourceGroupNameParam, licenseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + l.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusNoContent}, resp.StatusCode) { + l.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + l.beginDelete.remove(req) + } + + return resp, nil +} + +func (l *LicensesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + licenseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("licenseName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameParam, licenseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).License, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LicensesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := l.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := l.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + l.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridcompute.LicensesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + l.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (l *LicensesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := l.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := l.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + l.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhybridcompute.LicensesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + l.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (l *LicensesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if l.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := l.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/licenses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.LicenseUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + licenseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("licenseName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginUpdate(req.Context(), resourceGroupNameParam, licenseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + l.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + l.beginUpdate.remove(req) + } + + return resp, nil +} + +func (l *LicensesServerTransport) dispatchBeginValidateLicense(req *http.Request) (*http.Response, error) { + if l.srv.BeginValidateLicense == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginValidateLicense not implemented")} + } + beginValidateLicense := l.beginValidateLicense.get(req) + if beginValidateLicense == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/validateLicense` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.License](req) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginValidateLicense(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginValidateLicense = &respr + l.beginValidateLicense.add(req, beginValidateLicense) + } + + resp, err := server.PollerResponderNext(beginValidateLicense, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.beginValidateLicense.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PollerResponderMore(beginValidateLicense) { + l.beginValidateLicense.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineextensions_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineextensions_server.go index a2e80b0d2955..d03cf77db05d 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineextensions_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineextensions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machines_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machines_server.go index 8046c7bee22a..9aefa6aa2689 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machines_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machines_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" @@ -24,6 +24,10 @@ import ( // MachinesServer is a fake server for instances of the armhybridcompute.MachinesClient type. type MachinesServer struct { + // BeginAssessPatches is the fake for method MachinesClient.BeginAssessPatches + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginAssessPatches func(ctx context.Context, resourceGroupName string, name string, options *armhybridcompute.MachinesClientBeginAssessPatchesOptions) (resp azfake.PollerResponder[armhybridcompute.MachinesClientAssessPatchesResponse], errResp azfake.ErrorResponder) + // CreateOrUpdate is the fake for method MachinesClient.CreateOrUpdate // HTTP status codes to indicate success: http.StatusOK CreateOrUpdate func(ctx context.Context, resourceGroupName string, machineName string, parameters armhybridcompute.Machine, options *armhybridcompute.MachinesClientCreateOrUpdateOptions) (resp azfake.Responder[armhybridcompute.MachinesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) @@ -36,6 +40,10 @@ type MachinesServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, machineName string, options *armhybridcompute.MachinesClientGetOptions) (resp azfake.Responder[armhybridcompute.MachinesClientGetResponse], errResp azfake.ErrorResponder) + // BeginInstallPatches is the fake for method MachinesClient.BeginInstallPatches + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginInstallPatches func(ctx context.Context, resourceGroupName string, name string, installPatchesInput armhybridcompute.MachineInstallPatchesParameters, options *armhybridcompute.MachinesClientBeginInstallPatchesOptions) (resp azfake.PollerResponder[armhybridcompute.MachinesClientInstallPatchesResponse], errResp azfake.ErrorResponder) + // NewListByResourceGroupPager is the fake for method MachinesClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armhybridcompute.MachinesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridcompute.MachinesClientListByResourceGroupResponse]) @@ -55,6 +63,8 @@ type MachinesServer struct { func NewMachinesServerTransport(srv *MachinesServer) *MachinesServerTransport { return &MachinesServerTransport{ srv: srv, + beginAssessPatches: newTracker[azfake.PollerResponder[armhybridcompute.MachinesClientAssessPatchesResponse]](), + beginInstallPatches: newTracker[azfake.PollerResponder[armhybridcompute.MachinesClientInstallPatchesResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridcompute.MachinesClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridcompute.MachinesClientListBySubscriptionResponse]](), } @@ -64,6 +74,8 @@ func NewMachinesServerTransport(srv *MachinesServer) *MachinesServerTransport { // Don't use this type directly, use NewMachinesServerTransport instead. type MachinesServerTransport struct { srv *MachinesServer + beginAssessPatches *tracker[azfake.PollerResponder[armhybridcompute.MachinesClientAssessPatchesResponse]] + beginInstallPatches *tracker[azfake.PollerResponder[armhybridcompute.MachinesClientInstallPatchesResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridcompute.MachinesClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridcompute.MachinesClientListBySubscriptionResponse]] } @@ -80,12 +92,16 @@ func (m *MachinesServerTransport) Do(req *http.Request) (*http.Response, error) var err error switch method { + case "MachinesClient.BeginAssessPatches": + resp, err = m.dispatchBeginAssessPatches(req) case "MachinesClient.CreateOrUpdate": resp, err = m.dispatchCreateOrUpdate(req) case "MachinesClient.Delete": resp, err = m.dispatchDelete(req) case "MachinesClient.Get": resp, err = m.dispatchGet(req) + case "MachinesClient.BeginInstallPatches": + resp, err = m.dispatchBeginInstallPatches(req) case "MachinesClient.NewListByResourceGroupPager": resp, err = m.dispatchNewListByResourceGroupPager(req) case "MachinesClient.NewListBySubscriptionPager": @@ -103,6 +119,50 @@ func (m *MachinesServerTransport) Do(req *http.Request) (*http.Response, error) return resp, nil } +func (m *MachinesServerTransport) dispatchBeginAssessPatches(req *http.Request) (*http.Response, error) { + if m.srv.BeginAssessPatches == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAssessPatches not implemented")} + } + beginAssessPatches := m.beginAssessPatches.get(req) + if beginAssessPatches == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/assessPatches` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginAssessPatches(req.Context(), resourceGroupNameParam, nameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAssessPatches = &respr + m.beginAssessPatches.add(req, beginAssessPatches) + } + + resp, err := server.PollerResponderNext(beginAssessPatches, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginAssessPatches.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAssessPatches) { + m.beginAssessPatches.remove(req) + } + + return resp, nil +} + func (m *MachinesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { if m.srv.CreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} @@ -113,6 +173,7 @@ func (m *MachinesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*ht if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() body, err := server.UnmarshalRequestAsJSON[armhybridcompute.Machine](req) if err != nil { return nil, err @@ -125,7 +186,18 @@ func (m *MachinesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*ht if err != nil { return nil, err } - respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, machineNameParam, body, nil) + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armhybridcompute.MachinesClientCreateOrUpdateOptions + if expandParam != nil { + options = &armhybridcompute.MachinesClientCreateOrUpdateOptions{ + Expand: expandParam, + } + } + respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, machineNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -218,6 +290,54 @@ func (m *MachinesServerTransport) dispatchGet(req *http.Request) (*http.Response return resp, nil } +func (m *MachinesServerTransport) dispatchBeginInstallPatches(req *http.Request) (*http.Response, error) { + if m.srv.BeginInstallPatches == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginInstallPatches not implemented")} + } + beginInstallPatches := m.beginInstallPatches.get(req) + if beginInstallPatches == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/installPatches` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.MachineInstallPatchesParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginInstallPatches(req.Context(), resourceGroupNameParam, nameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginInstallPatches = &respr + m.beginInstallPatches.add(req, beginInstallPatches) + } + + resp, err := server.PollerResponderNext(beginInstallPatches, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginInstallPatches.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginInstallPatches) { + m.beginInstallPatches.remove(req) + } + + return resp, nil +} + func (m *MachinesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if m.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} @@ -230,11 +350,23 @@ func (m *MachinesServerTransport) dispatchNewListByResourceGroupPager(req *http. if matches == nil || len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armhybridcompute.MachinesClientListByResourceGroupOptions + if expandParam != nil { + options = &armhybridcompute.MachinesClientListByResourceGroupOptions{ + Expand: expandParam, + } + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) newListByResourceGroupPager = &resp m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridcompute.MachinesClientListByResourceGroupResponse, createLink func() string) { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/management_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/management_server.go index 54b55beea979..7ec974612ab4 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/management_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/management_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/networkprofile_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/networkprofile_server.go new file mode 100644 index 000000000000..9de4f5f6fae9 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/networkprofile_server.go @@ -0,0 +1,100 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// NetworkProfileServer is a fake server for instances of the armhybridcompute.NetworkProfileClient type. +type NetworkProfileServer struct { + // Get is the fake for method NetworkProfileClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, machineName string, options *armhybridcompute.NetworkProfileClientGetOptions) (resp azfake.Responder[armhybridcompute.NetworkProfileClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewNetworkProfileServerTransport creates a new instance of NetworkProfileServerTransport with the provided implementation. +// The returned NetworkProfileServerTransport instance is connected to an instance of armhybridcompute.NetworkProfileClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewNetworkProfileServerTransport(srv *NetworkProfileServer) *NetworkProfileServerTransport { + return &NetworkProfileServerTransport{srv: srv} +} + +// NetworkProfileServerTransport connects instances of armhybridcompute.NetworkProfileClient to instances of NetworkProfileServer. +// Don't use this type directly, use NewNetworkProfileServerTransport instead. +type NetworkProfileServerTransport struct { + srv *NetworkProfileServer +} + +// Do implements the policy.Transporter interface for NetworkProfileServerTransport. +func (n *NetworkProfileServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "NetworkProfileClient.Get": + resp, err = n.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (n *NetworkProfileServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if n.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkProfile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, machineNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NetworkProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/operations_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/operations_server.go index aaf6721dab08..e513577de0eb 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/operations_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" ) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privateendpointconnections_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privateendpointconnections_server.go index 1b9003976475..ac2653c1f25c 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privateendpointconnections_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkresources_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkresources_server.go index dffac77b7bfa..cf08b5156557 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkresources_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkscopes_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkscopes_server.go index feb4b7f3d6aa..95a45caa98bd 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkscopes_server.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/privatelinkscopes_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go index 10b57131d0e6..7d36c31f7f49 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go @@ -19,9 +19,15 @@ import ( // ServerFactory is a fake server for instances of the armhybridcompute.ClientFactory type. type ServerFactory struct { + AgentVersionServer AgentVersionServer + ExtensionMetadataServer ExtensionMetadataServer + HybridIdentityMetadataServer HybridIdentityMetadataServer + LicenseProfilesServer LicenseProfilesServer + LicensesServer LicensesServer MachineExtensionsServer MachineExtensionsServer MachinesServer MachinesServer ManagementServer ManagementServer + NetworkProfileServer NetworkProfileServer OperationsServer OperationsServer PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer @@ -42,9 +48,15 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trAgentVersionServer *AgentVersionServerTransport + trExtensionMetadataServer *ExtensionMetadataServerTransport + trHybridIdentityMetadataServer *HybridIdentityMetadataServerTransport + trLicenseProfilesServer *LicenseProfilesServerTransport + trLicensesServer *LicensesServerTransport trMachineExtensionsServer *MachineExtensionsServerTransport trMachinesServer *MachinesServerTransport trManagementServer *ManagementServerTransport + trNetworkProfileServer *NetworkProfileServerTransport trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport @@ -64,6 +76,27 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AgentVersionClient": + initServer(s, &s.trAgentVersionServer, func() *AgentVersionServerTransport { return NewAgentVersionServerTransport(&s.srv.AgentVersionServer) }) + resp, err = s.trAgentVersionServer.Do(req) + case "ExtensionMetadataClient": + initServer(s, &s.trExtensionMetadataServer, func() *ExtensionMetadataServerTransport { + return NewExtensionMetadataServerTransport(&s.srv.ExtensionMetadataServer) + }) + resp, err = s.trExtensionMetadataServer.Do(req) + case "HybridIdentityMetadataClient": + initServer(s, &s.trHybridIdentityMetadataServer, func() *HybridIdentityMetadataServerTransport { + return NewHybridIdentityMetadataServerTransport(&s.srv.HybridIdentityMetadataServer) + }) + resp, err = s.trHybridIdentityMetadataServer.Do(req) + case "LicenseProfilesClient": + initServer(s, &s.trLicenseProfilesServer, func() *LicenseProfilesServerTransport { + return NewLicenseProfilesServerTransport(&s.srv.LicenseProfilesServer) + }) + resp, err = s.trLicenseProfilesServer.Do(req) + case "LicensesClient": + initServer(s, &s.trLicensesServer, func() *LicensesServerTransport { return NewLicensesServerTransport(&s.srv.LicensesServer) }) + resp, err = s.trLicensesServer.Do(req) case "MachineExtensionsClient": initServer(s, &s.trMachineExtensionsServer, func() *MachineExtensionsServerTransport { return NewMachineExtensionsServerTransport(&s.srv.MachineExtensionsServer) @@ -75,6 +108,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ManagementClient": initServer(s, &s.trManagementServer, func() *ManagementServerTransport { return NewManagementServerTransport(&s.srv.ManagementServer) }) resp, err = s.trManagementServer.Do(req) + case "NetworkProfileClient": + initServer(s, &s.trNetworkProfileServer, func() *NetworkProfileServerTransport { + return NewNetworkProfileServerTransport(&s.srv.NetworkProfileServer) + }) + resp, err = s.trNetworkProfileServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod index 130388b013da..fca10cfa0a6c 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2 go 1.18 diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go new file mode 100644 index 000000000000..39591ae0fa46 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go @@ -0,0 +1,179 @@ +//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 armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. +// Don't use this type directly, use NewHybridIdentityMetadataClient() instead. +type HybridIdentityMetadataClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHybridIdentityMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HybridIdentityMetadataClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Implements HybridIdentityMetadata GET method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - metadataName - Name of the HybridIdentityMetadata. +// - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get +// method. +func (client *HybridIdentityMetadataClient) Get(ctx context.Context, resourceGroupName string, machineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { + var err error + const operationName = "HybridIdentityMetadataClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, metadataName, options) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Response) (HybridIdentityMetadataClientGetResponse, error) { + result := HybridIdentityMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListByMachinesPager - Returns the list of HybridIdentityMetadata of the given machine. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - HybridIdentityMetadataClientListByMachinesOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByMachinesPager +// method. +func (client *HybridIdentityMetadataClient) NewListByMachinesPager(resourceGroupName string, machineName string, options *HybridIdentityMetadataClientListByMachinesOptions) *runtime.Pager[HybridIdentityMetadataClientListByMachinesResponse] { + return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListByMachinesResponse]{ + More: func(page HybridIdentityMetadataClientListByMachinesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByMachinesResponse) (HybridIdentityMetadataClientListByMachinesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HybridIdentityMetadataClient.NewListByMachinesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMachinesCreateRequest(ctx, resourceGroupName, machineName, options) + }, nil) + if err != nil { + return HybridIdentityMetadataClientListByMachinesResponse{}, err + } + return client.listByMachinesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMachinesCreateRequest creates the ListByMachines request. +func (client *HybridIdentityMetadataClient) listByMachinesCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *HybridIdentityMetadataClientListByMachinesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMachinesHandleResponse handles the ListByMachines response. +func (client *HybridIdentityMetadataClient) listByMachinesHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListByMachinesResponse, error) { + result := HybridIdentityMetadataClientListByMachinesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { + return HybridIdentityMetadataClientListByMachinesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client_example_test.go new file mode 100644 index 000000000000..619071c2e3f4 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client_example_test.go @@ -0,0 +1,94 @@ +//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 armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/HybridIdentityMetadata_Get.json +func ExampleHybridIdentityMetadataClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewHybridIdentityMetadataClient().Get(ctx, "testrg", "ContosoVm", "default", 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.HybridIdentityMetadata = armhybridcompute.HybridIdentityMetadata{ + // Name: to.Ptr("testItem"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/hybridIdentityMetadata"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/ContosoVm/hybridIdentityMetadata/default"), + // Properties: &armhybridcompute.HybridIdentityMetadataProperties{ + // Identity: &armhybridcompute.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), + // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), + // }, + // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), + // VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/HybridIdentityMetadata_ListByVirtualMachines.json +func ExampleHybridIdentityMetadataClient_NewListByMachinesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewHybridIdentityMetadataClient().NewListByMachinesPager("testrg", "ContosoVm", 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.HybridIdentityMetadataList = armhybridcompute.HybridIdentityMetadataList{ + // Value: []*armhybridcompute.HybridIdentityMetadata{ + // { + // Name: to.Ptr("testItem"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/hybridIdentityMetadata"), + // ID: to.Ptr("/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/ContosoVm/hybridIdentityMetadata/default"), + // Properties: &armhybridcompute.HybridIdentityMetadataProperties{ + // Identity: &armhybridcompute.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("7b5129bc-8642-4a6a-95f8-63400ca6ec4d"), + // TenantID: to.Ptr("ec46ca82-5d4a-4e3e-b4b7-e27f9318645d"), + // }, + // PublicKey: to.Ptr("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2"), + // VMID: to.Ptr("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go new file mode 100644 index 000000000000..00d840f15c6c --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go @@ -0,0 +1,413 @@ +//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 armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LicenseProfilesClient contains the methods for the LicenseProfiles group. +// Don't use this type directly, use NewLicenseProfilesClient() instead. +type LicenseProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLicenseProfilesClient creates a new instance of LicenseProfilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLicenseProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LicenseProfilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LicenseProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - parameters - Parameters supplied to the Create license profile operation. +// - options - LicenseProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginCreateOrUpdate +// method. +func (client *LicenseProfilesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicenseProfilesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicenseProfilesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicenseProfilesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "LicenseProfilesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LicenseProfilesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - LicenseProfilesClientBeginDeleteOptions contains the optional parameters for the LicenseProfilesClient.BeginDelete +// method. +func (client *LicenseProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*runtime.Poller[LicenseProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, machineName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicenseProfilesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicenseProfilesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "LicenseProfilesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LicenseProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about the view of a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - LicenseProfilesClientGetOptions contains the optional parameters for the LicenseProfilesClient.Get method. +func (client *LicenseProfilesClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientGetOptions) (LicenseProfilesClientGetResponse, error) { + var err error + const operationName = "LicenseProfilesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return LicenseProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LicenseProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LicenseProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LicenseProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LicenseProfilesClient) getHandleResponse(resp *http.Response) (LicenseProfilesClientGetResponse, error) { + result := LicenseProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicenseProfile); err != nil { + return LicenseProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - The operation to get all license profiles of a non-Azure machine +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the machine. +// - options - LicenseProfilesClientListOptions contains the optional parameters for the LicenseProfilesClient.NewListPager +// method. +func (client *LicenseProfilesClient) NewListPager(resourceGroupName string, machineName string, options *LicenseProfilesClientListOptions) *runtime.Pager[LicenseProfilesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LicenseProfilesClientListResponse]{ + More: func(page LicenseProfilesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LicenseProfilesClientListResponse) (LicenseProfilesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LicenseProfilesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, machineName, options) + }, nil) + if err != nil { + return LicenseProfilesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *LicenseProfilesClient) listCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LicenseProfilesClient) listHandleResponse(resp *http.Response) (LicenseProfilesClientListResponse, error) { + result := LicenseProfilesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicenseProfilesListResult); err != nil { + return LicenseProfilesClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - parameters - Parameters supplied to the Update license profile operation. +// - options - LicenseProfilesClientBeginUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginUpdate +// method. +func (client *LicenseProfilesClient) BeginUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*runtime.Poller[LicenseProfilesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicenseProfilesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicenseProfilesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) update(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "LicenseProfilesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *LicenseProfilesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go new file mode 100644 index 000000000000..1568a047ff00 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go @@ -0,0 +1,242 @@ +//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 armhybridcompute_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/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_CreateOrUpdate.json +func ExampleLicenseProfilesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicenseProfilesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myMachine", armhybridcompute.LicenseProfile{ + Location: to.Ptr("eastus2euap"), + Properties: &armhybridcompute.LicenseProfileProperties{ + EsuProfile: &armhybridcompute.LicenseProfileArmEsuProperties{ + AssignedLicense: to.Ptr("{LicenseResourceId}"), + }, + }, + }, 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.LicenseProfile = armhybridcompute.LicenseProfile{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/licenseProfiles"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/licenseProfiles/default"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProfileProperties{ + // EsuProfile: &armhybridcompute.LicenseProfileArmEsuProperties{ + // AssignedLicenseImmutableID: to.Ptr("{Guid}"), + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityEligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // AssignedLicense: to.Ptr("{LicenseResourceId}"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Update.json +func ExampleLicenseProfilesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicenseProfilesClient().BeginUpdate(ctx, "myResourceGroup", "myMachine", armhybridcompute.LicenseProfileUpdate{ + Properties: &armhybridcompute.LicenseProfileUpdateProperties{ + EsuProfile: &armhybridcompute.EsuProfileUpdateProperties{ + AssignedLicense: to.Ptr("{LicenseResourceId}"), + }, + }, + }, 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.LicenseProfile = armhybridcompute.LicenseProfile{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/licenseProfiles"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/licenseProfiles/default"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProfileProperties{ + // EsuProfile: &armhybridcompute.LicenseProfileArmEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityEligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // AssignedLicense: to.Ptr("{LicenseResourceId}"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Get.json +func ExampleLicenseProfilesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLicenseProfilesClient().Get(ctx, "myResourceGroup", "myMachine", 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.LicenseProfile = armhybridcompute.LicenseProfile{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/licenseProfiles"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/licenseProfiles/default"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProfileProperties{ + // EsuProfile: &armhybridcompute.LicenseProfileArmEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityEligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // AssignedLicense: to.Ptr("{LicenseResourceId}"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_Delete.json +func ExampleLicenseProfilesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicenseProfilesClient().BeginDelete(ctx, "myResourceGroup", "myMachine", 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/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/licenseProfile/LicenseProfile_List.json +func ExampleLicenseProfilesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLicenseProfilesClient().NewListPager("myResourceGroup", "myMachine", 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.LicenseProfilesListResult = armhybridcompute.LicenseProfilesListResult{ + // Value: []*armhybridcompute.LicenseProfile{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/licenseProfiles"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/licenseProfiles/default"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProfileProperties{ + // EsuProfile: &armhybridcompute.LicenseProfileArmEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityEligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // AssignedLicense: to.Ptr("{LicenseResourceId}"), + // }, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go new file mode 100644 index 000000000000..6f8327b9d1ac --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go @@ -0,0 +1,527 @@ +//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 armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LicensesClient contains the methods for the Licenses group. +// Don't use this type directly, use NewLicensesClient() instead. +type LicensesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLicensesClient creates a new instance of LicensesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLicensesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LicensesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LicensesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - licenseName - The name of the license. +// - parameters - Parameters supplied to the Create license operation. +// - options - LicensesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicensesClient.BeginCreateOrUpdate +// method. +func (client *LicensesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, licenseName string, parameters License, options *LicensesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicensesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, licenseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicensesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicensesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicensesClient) createOrUpdate(ctx context.Context, resourceGroupName string, licenseName string, parameters License, options *LicensesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "LicensesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, licenseName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LicensesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, licenseName string, parameters License, options *LicensesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if licenseName == "" { + return nil, errors.New("parameter licenseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{licenseName}", url.PathEscape(licenseName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - licenseName - The name of the license. +// - options - LicensesClientBeginDeleteOptions contains the optional parameters for the LicensesClient.BeginDelete method. +func (client *LicensesClient) BeginDelete(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientBeginDeleteOptions) (*runtime.Poller[LicensesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, licenseName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicensesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicensesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicensesClient) deleteOperation(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "LicensesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, licenseName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LicensesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if licenseName == "" { + return nil, errors.New("parameter licenseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{licenseName}", url.PathEscape(licenseName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about the view of a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - licenseName - The name of the license. +// - options - LicensesClientGetOptions contains the optional parameters for the LicensesClient.Get method. +func (client *LicensesClient) Get(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientGetOptions) (LicensesClientGetResponse, error) { + var err error + const operationName = "LicensesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, licenseName, options) + if err != nil { + return LicensesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LicensesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LicensesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LicensesClient) getCreateRequest(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if licenseName == "" { + return nil, errors.New("parameter licenseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{licenseName}", url.PathEscape(licenseName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LicensesClient) getHandleResponse(resp *http.Response) (LicensesClientGetResponse, error) { + result := LicensesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.License); err != nil { + return LicensesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - The operation to get all licenses of a non-Azure machine +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - LicensesClientListByResourceGroupOptions contains the optional parameters for the LicensesClient.NewListByResourceGroupPager +// method. +func (client *LicensesClient) NewListByResourceGroupPager(resourceGroupName string, options *LicensesClientListByResourceGroupOptions) *runtime.Pager[LicensesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[LicensesClientListByResourceGroupResponse]{ + More: func(page LicensesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LicensesClientListByResourceGroupResponse) (LicensesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LicensesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return LicensesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *LicensesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *LicensesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *LicensesClient) listByResourceGroupHandleResponse(resp *http.Response) (LicensesClientListByResourceGroupResponse, error) { + result := LicensesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicensesListResult); err != nil { + return LicensesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - The operation to get all licenses of a non-Azure machine +// +// Generated from API version 2023-06-20-preview +// - options - LicensesClientListBySubscriptionOptions contains the optional parameters for the LicensesClient.NewListBySubscriptionPager +// method. +func (client *LicensesClient) NewListBySubscriptionPager(options *LicensesClientListBySubscriptionOptions) *runtime.Pager[LicensesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[LicensesClientListBySubscriptionResponse]{ + More: func(page LicensesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LicensesClientListBySubscriptionResponse) (LicensesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LicensesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return LicensesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *LicensesClient) listBySubscriptionCreateRequest(ctx context.Context, options *LicensesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *LicensesClient) listBySubscriptionHandleResponse(resp *http.Response) (LicensesClientListBySubscriptionResponse, error) { + result := LicensesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicensesListResult); err != nil { + return LicensesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - licenseName - The name of the license. +// - parameters - Parameters supplied to the Update license operation. +// - options - LicensesClientBeginUpdateOptions contains the optional parameters for the LicensesClient.BeginUpdate method. +func (client *LicensesClient) BeginUpdate(ctx context.Context, resourceGroupName string, licenseName string, parameters LicenseUpdate, options *LicensesClientBeginUpdateOptions) (*runtime.Poller[LicensesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, licenseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicensesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicensesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - The operation to update a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicensesClient) update(ctx context.Context, resourceGroupName string, licenseName string, parameters LicenseUpdate, options *LicensesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "LicensesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, licenseName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *LicensesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, licenseName string, parameters LicenseUpdate, options *LicensesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if licenseName == "" { + return nil, errors.New("parameter licenseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{licenseName}", url.PathEscape(licenseName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginValidateLicense - The operation to validate a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - parameters - Parameters supplied to the license validation operation. +// - options - LicensesClientBeginValidateLicenseOptions contains the optional parameters for the LicensesClient.BeginValidateLicense +// method. +func (client *LicensesClient) BeginValidateLicense(ctx context.Context, parameters License, options *LicensesClientBeginValidateLicenseOptions) (*runtime.Poller[LicensesClientValidateLicenseResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateLicense(ctx, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LicensesClientValidateLicenseResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LicensesClientValidateLicenseResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ValidateLicense - The operation to validate a license. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicensesClient) validateLicense(ctx context.Context, parameters License, options *LicensesClientBeginValidateLicenseOptions) (*http.Response, error) { + var err error + const operationName = "LicensesClient.BeginValidateLicense" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateLicenseCreateRequest(ctx, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// validateLicenseCreateRequest creates the ValidateLicense request. +func (client *LicensesClient) validateLicenseCreateRequest(ctx context.Context, parameters License, options *LicensesClientBeginValidateLicenseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go new file mode 100644 index 000000000000..16b95dca3d21 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go @@ -0,0 +1,337 @@ +//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 armhybridcompute_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/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ValidateLicense.json +func ExampleLicensesClient_BeginValidateLicense() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicensesClient().BeginValidateLicense(ctx, armhybridcompute.License{ + Location: to.Ptr("eastus2euap"), + Properties: &armhybridcompute.LicenseProperties{ + LicenseDetails: &armhybridcompute.LicenseDetails{ + Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + Processors: to.Ptr[int32](6), + State: to.Ptr(armhybridcompute.LicenseStateActivated), + Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + }, + LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + }, + }, 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.License = armhybridcompute.License{ + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](2), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_CreateOrUpdate.json +func ExampleLicensesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicensesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{licenseName}", armhybridcompute.License{ + Location: to.Ptr("eastus2euap"), + Properties: &armhybridcompute.LicenseProperties{ + LicenseDetails: &armhybridcompute.LicenseDetails{ + Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + Processors: to.Ptr[int32](6), + State: to.Ptr(armhybridcompute.LicenseStateActivated), + Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + }, + LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + }, + }, 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.License = armhybridcompute.License{ + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](2), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Update.json +func ExampleLicensesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicensesClient().BeginUpdate(ctx, "myResourceGroup", "{licenseName}", armhybridcompute.LicenseUpdate{ + Properties: &armhybridcompute.LicenseUpdateProperties{ + LicenseDetails: &armhybridcompute.LicenseUpdatePropertiesLicenseDetails{ + Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + Processors: to.Ptr[int32](6), + State: to.Ptr(armhybridcompute.LicenseStateActivated), + Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + }, + LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + }, + }, 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.License = armhybridcompute.License{ + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](8), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Get.json +func ExampleLicensesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLicensesClient().Get(ctx, "myResourceGroup", "{licenseName}", 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.License = armhybridcompute.License{ + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](8), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_Delete.json +func ExampleLicensesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLicensesClient().BeginDelete(ctx, "myResourceGroup", "{licenseName}", 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/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ListByResourceGroup.json +func ExampleLicensesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLicensesClient().NewListByResourceGroupPager("myResourceGroup", 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.LicensesListResult = armhybridcompute.LicensesListResult{ + // Value: []*armhybridcompute.License{ + // { + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](8), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/license/License_ListBySubscription.json +func ExampleLicensesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLicensesClient().NewListBySubscriptionPager(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.LicensesListResult = armhybridcompute.LicensesListResult{ + // Value: []*armhybridcompute.License{ + // { + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](8), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go index 8c9ed4140f82..8ad91283ae3e 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go @@ -46,7 +46,7 @@ func NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be created or updated. // - extensionName - The name of the machine extension. @@ -73,7 +73,7 @@ func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { @@ -131,7 +131,7 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be deleted. // - extensionName - The name of the machine extension. @@ -157,7 +157,7 @@ func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - extensionName - The name of the machine extension. @@ -263,7 +263,7 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (M // NewListPager - The operation to get all extensions of a non-Azure machine // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - options - MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager @@ -331,7 +331,7 @@ func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +349,7 @@ func (client *MachineExtensionsClient) listHandleResponse(resp *http.Response) ( // BeginUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be created or updated. // - extensionName - The name of the machine extension. @@ -376,7 +376,7 @@ func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resource // Update - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginUpdate" @@ -422,7 +422,7 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go index 982d2c0bf58f..10ac146eb561 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PUTExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_CreateOrUpdate.json func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,13 +73,15 @@ func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { // }, // ProvisioningState: to.Ptr("Succeeded"), // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", + // Settings: map[string]any{ + // "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", + // }, // TypeHandlerVersion: to.Ptr("1.10.3"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/UpdateExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Update.json func ExampleMachineExtensionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -92,8 +94,9 @@ func ExampleMachineExtensionsClient_BeginUpdate() { } poller, err := clientFactory.NewMachineExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", armhybridcompute.MachineExtensionUpdate{ Properties: &armhybridcompute.MachineExtensionUpdateProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), + Type: to.Ptr("CustomScriptExtension"), + EnableAutomaticUpgrade: to.Ptr(true), + Publisher: to.Ptr("Microsoft.Compute"), Settings: map[string]any{ "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"", }, @@ -118,6 +121,7 @@ func ExampleMachineExtensionsClient_BeginUpdate() { // Properties: &armhybridcompute.MachineExtensionProperties{ // Type: to.Ptr("string"), // AutoUpgradeMinorVersion: to.Ptr(false), + // EnableAutomaticUpgrade: to.Ptr(true), // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ // Name: to.Ptr("CustomScriptExtension"), // Type: to.Ptr("CustomScriptExtension"), @@ -133,13 +137,15 @@ func ExampleMachineExtensionsClient_BeginUpdate() { // }, // ProvisioningState: to.Ptr("Succeeded"), // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"}", + // Settings: map[string]any{ + // "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", + // }, // TypeHandlerVersion: to.Ptr("1.10.3"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/DELETEExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Delete.json func ExampleMachineExtensionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -160,7 +166,7 @@ func ExampleMachineExtensionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/GETExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_Get.json func ExampleMachineExtensionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -202,13 +208,15 @@ func ExampleMachineExtensionsClient_Get() { // }, // ProvisioningState: to.Ptr("Succeeded"), // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", + // Settings: map[string]any{ + // "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", + // }, // TypeHandlerVersion: to.Ptr("1.10.3"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/LISTExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extension_List.json func ExampleMachineExtensionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go index a8d6be342902..392dda3360b3 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go @@ -43,10 +43,88 @@ func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// CreateOrUpdate - The operation to create or update a hybrid machine resource identity in Azure. +// BeginAssessPatches - The operation to assess patches on a hybrid machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. +// - name - The name of the hybrid machine. +// - options - MachinesClientBeginAssessPatchesOptions contains the optional parameters for the MachinesClient.BeginAssessPatches +// method. +func (client *MachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*runtime.Poller[MachinesClientAssessPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.assessPatches(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientAssessPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachinesClientAssessPatchesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AssessPatches - The operation to assess patches on a hybrid machine identity in Azure. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *MachinesClient) assessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + var err error + const operationName = "MachinesClient.BeginAssessPatches" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// assessPatchesCreateRequest creates the AssessPatches request. +func (client *MachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CreateOrUpdate - The operation to create or update a hybrid machine. Please note some properties can be set only during +// machine creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - parameters - Parameters supplied to the Create hybrid machine operation. @@ -93,7 +171,10 @@ func (client *MachinesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -111,10 +192,10 @@ func (client *MachinesClient) createOrUpdateHandleResponse(resp *http.Response) return result, nil } -// Delete - The operation to remove a hybrid machine identity in Azure. +// Delete - The operation to delete a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - options - MachinesClientDeleteOptions contains the optional parameters for the MachinesClient.Delete method. @@ -159,7 +240,7 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,7 +249,7 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Retrieves information about the model view or the instance view of a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. @@ -214,7 +295,7 @@ func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -232,10 +313,91 @@ func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesCl return result, nil } +// BeginInstallPatches - The operation to install patches on a hybrid machine identity in Azure. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. +// - name - The name of the hybrid machine. +// - installPatchesInput - Input for InstallPatches as directly received by the API +// - options - MachinesClientBeginInstallPatchesOptions contains the optional parameters for the MachinesClient.BeginInstallPatches +// method. +func (client *MachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*runtime.Poller[MachinesClientInstallPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.installPatches(ctx, resourceGroupName, name, installPatchesInput, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientInstallPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachinesClientInstallPatchesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InstallPatches - The operation to install patches on a hybrid machine identity in Azure. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *MachinesClient) installPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + var err error + const operationName = "MachinesClient.BeginInstallPatches" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, name, installPatchesInput, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// installPatchesCreateRequest creates the InstallPatches request. +func (client *MachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, installPatchesInput); err != nil { + return nil, err + } + return req, nil +} + // NewListByResourceGroupPager - Lists all the hybrid machines in the specified resource group. Use the nextLink property // in the response to get the next page of hybrid machines. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager // method. @@ -278,7 +440,10 @@ func (client *MachinesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +461,7 @@ func (client *MachinesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists all the hybrid machines in the specified subscription. Use the nextLink property in // the response to get the next page of hybrid machines. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - options - MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager // method. func (client *MachinesClient) NewListBySubscriptionPager(options *MachinesClientListBySubscriptionOptions) *runtime.Pager[MachinesClientListBySubscriptionResponse] { @@ -334,7 +499,7 @@ func (client *MachinesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -352,7 +517,7 @@ func (client *MachinesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - The operation to update a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - parameters - Parameters supplied to the Update hybrid machine operation. @@ -399,7 +564,7 @@ func (client *MachinesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go index cae4b7ec6ced..ce20d69edf12 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go @@ -13,12 +13,14 @@ 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/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_CreateOrUpdate.json func ExampleMachinesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -43,7 +45,7 @@ func ExampleMachinesClient_CreateOrUpdate() { PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), }, - }, nil) + }, &armhybridcompute.MachinesClientCreateOrUpdateOptions{Expand: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -67,6 +69,23 @@ func ExampleMachinesClient_CreateOrUpdate() { // "manufacturer": to.Ptr("Microsoft Corporation"), // "model": to.Ptr("Virtual Machine"), // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, // LocationData: &armhybridcompute.LocationData{ // Name: to.Ptr("Redmond"), // City: to.Ptr("redmond"), @@ -91,7 +110,7 @@ func ExampleMachinesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Update.json func ExampleMachinesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,6 +165,23 @@ func ExampleMachinesClient_Update() { // }, // Properties: &armhybridcompute.MachineProperties{ // ClientPublicKey: to.Ptr("string"), + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, // LocationData: &armhybridcompute.LocationData{ // Name: to.Ptr("Redmond"), // }, @@ -171,7 +207,7 @@ func ExampleMachinesClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Delete.json func ExampleMachinesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,8 +224,8 @@ func ExampleMachinesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Get.json -func ExampleMachinesClient_Get() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Get.json +func ExampleMachinesClient_Get_getMachine() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -218,6 +254,7 @@ func ExampleMachinesClient_Get() { // }, // Properties: &armhybridcompute.MachineProperties{ // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), // ExtensionsEnabled: to.Ptr("true"), // GuestConfigurationEnabled: to.Ptr("true"), // IncomingConnectionsPorts: []*string{ @@ -234,12 +271,194 @@ func ExampleMachinesClient_Get() { // "manufacturer": to.Ptr("Microsoft Corporation"), // "model": to.Ptr("Virtual Machine"), // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, + // LocationData: &armhybridcompute.LocationData{ + // Name: to.Ptr("Redmond"), + // City: to.Ptr("redmond"), + // CountryOrRegion: to.Ptr("usa"), + // }, + // MssqlDiscovered: to.Ptr("false"), + // NetworkProfile: &armhybridcompute.NetworkProfile{ + // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("192.168.12.345"), + // IPAddressVersion: to.Ptr("IPv4"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("192.168.12.0/24"), + // }, + // }}, + // }, + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), + // IPAddressVersion: to.Ptr("IPv6"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), + // }, + // }}, + // }}, + // }, + // OSProfile: &armhybridcompute.OSProfile{ + // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // }, + // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), + // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), + // ProvisioningState: to.Ptr("Succeeded"), + // ServiceStatuses: &armhybridcompute.ServiceStatuses{ + // ExtensionService: &armhybridcompute.ServiceStatus{ + // StartupType: to.Ptr("Automatic"), + // Status: to.Ptr("Running"), + // }, + // GuestConfigurationService: &armhybridcompute.ServiceStatus{ + // StartupType: to.Ptr("Automatic"), + // Status: to.Ptr("Running"), + // }, + // }, + // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), + // }, + // Resources: []*armhybridcompute.MachineExtension{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_Get_LicenseProfileInstanceView.json +func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewMachinesClient().Get(ctx, "myResourceGroup", "myMachine", &armhybridcompute.MachinesClientGetOptions{Expand: to.Ptr(armhybridcompute.InstanceViewTypesInstanceView)}) + 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.Machine = armhybridcompute.Machine{ + // Name: to.Ptr("myMachine"), + // Type: to.Ptr("Microsoft.HybridCompute/machines"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), + // Location: to.Ptr("eastus2euap"), + // Identity: &armhybridcompute.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("string"), + // TenantID: to.Ptr("string"), + // }, + // Properties: &armhybridcompute.MachineProperties{ + // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), + // ExtensionsEnabled: to.Ptr("true"), + // GuestConfigurationEnabled: to.Ptr("true"), + // IncomingConnectionsPorts: []*string{ + // to.Ptr("22"), + // to.Ptr("23")}, + // ProxyBypass: []*string{ + // to.Ptr("proxy1"), + // to.Ptr("proxy2")}, + // ProxyURL: to.Ptr("https://test.test"), + // }, + // ClientPublicKey: to.Ptr("string"), + // DetectedProperties: map[string]*string{ + // "cloudprovider": to.Ptr("N/A"), + // "manufacturer": to.Ptr("Microsoft Corporation"), + // "model": to.Ptr("Virtual Machine"), + // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // AssignedLicense: &armhybridcompute.License{ + // Name: to.Ptr("{licenseName}"), + // Type: to.Ptr("Microsoft.HybridCompute/licenses"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Licenses/{licenseName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.LicenseProperties{ + // LicenseDetails: &armhybridcompute.LicenseDetails{ + // Type: to.Ptr(armhybridcompute.LicenseCoreTypePCore), + // AssignedLicenses: to.Ptr[int32](8), + // Edition: to.Ptr(armhybridcompute.LicenseEditionDatacenter), + // ImmutableID: to.Ptr(""), + // Processors: to.Ptr[int32](6), + // State: to.Ptr(armhybridcompute.LicenseStateActivated), + // Target: to.Ptr(armhybridcompute.LicenseTargetWindowsServer2012), + // }, + // LicenseType: to.Ptr(armhybridcompute.LicenseTypeESU), + // TenantID: to.Ptr("{tenandId}"), + // }, + // }, + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, // LocationData: &armhybridcompute.LocationData{ // Name: to.Ptr("Redmond"), // City: to.Ptr("redmond"), // CountryOrRegion: to.Ptr("usa"), // }, // MssqlDiscovered: to.Ptr("false"), + // NetworkProfile: &armhybridcompute.NetworkProfile{ + // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("192.168.12.345"), + // IPAddressVersion: to.Ptr("IPv4"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("192.168.12.0/24"), + // }, + // }}, + // }, + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), + // IPAddressVersion: to.Ptr("IPv6"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), + // }, + // }}, + // }}, + // }, // OSProfile: &armhybridcompute.OSProfile{ // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ // PatchSettings: &armhybridcompute.PatchSettings{ @@ -265,10 +484,103 @@ func ExampleMachinesClient_Get() { // }, // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), // }, + // Resources: []*armhybridcompute.MachineExtension{ + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machine_AssessPatches.json +func ExampleMachinesClient_BeginAssessPatches() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMachinesClient().BeginAssessPatches(ctx, "myResourceGroupName", "myMachineName", 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.MachineAssessPatchesResult = armhybridcompute.MachineAssessPatchesResult{ + // AssessmentActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), + // AvailablePatchCountByClassification: &armhybridcompute.AvailablePatchCountByClassification{ + // Critical: to.Ptr[int32](0), + // Definition: to.Ptr[int32](0), + // FeaturePack: to.Ptr[int32](0), + // Security: to.Ptr[int32](0), + // ServicePack: to.Ptr[int32](0), + // Tools: to.Ptr[int32](0), + // UpdateRollup: to.Ptr[int32](1), + // Updates: to.Ptr[int32](1), + // }, + // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-22T02:16:06.974Z"); return t}()), + // OSType: to.Ptr(armhybridcompute.OsTypeWindows), + // RebootPending: to.Ptr(true), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-22T02:15:20.934Z"); return t}()), + // StartedBy: to.Ptr(armhybridcompute.PatchOperationStartedByUser), + // Status: to.Ptr(armhybridcompute.PatchOperationStatusSucceeded), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machine_InstallPatches.json +func ExampleMachinesClient_BeginInstallPatches() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMachinesClient().BeginInstallPatches(ctx, "myResourceGroupName", "myMachineName", armhybridcompute.MachineInstallPatchesParameters{ + MaximumDuration: to.Ptr("PT4H"), + RebootSetting: to.Ptr(armhybridcompute.VMGuestPatchRebootSettingIfRequired), + WindowsParameters: &armhybridcompute.WindowsParameters{ + ClassificationsToInclude: []*armhybridcompute.VMGuestPatchClassificationWindows{ + to.Ptr(armhybridcompute.VMGuestPatchClassificationWindowsCritical), + to.Ptr(armhybridcompute.VMGuestPatchClassificationWindowsSecurity)}, + MaxPatchPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T02:36:43.053Z"); return t }()), + }, + }, 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.MachineInstallPatchesResult = armhybridcompute.MachineInstallPatchesResult{ + // ExcludedPatchCount: to.Ptr[int32](0), + // FailedPatchCount: to.Ptr[int32](0), + // InstallationActivityID: to.Ptr("68f8b292-dfc2-4646-9781-33cc88631968"), + // InstalledPatchCount: to.Ptr[int32](3), + // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-22T02:16:06.974Z"); return t}()), + // MaintenanceWindowExceeded: to.Ptr(false), + // NotSelectedPatchCount: to.Ptr[int32](0), + // OSType: to.Ptr(armhybridcompute.OsTypeWindows), + // PendingPatchCount: to.Ptr[int32](2), + // RebootStatus: to.Ptr(armhybridcompute.VMGuestPatchRebootStatusCompleted), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-22T02:15:06.974Z"); return t}()), + // StartedBy: to.Ptr(armhybridcompute.PatchOperationStartedByUser), + // Status: to.Ptr(armhybridcompute.PatchOperationStatusSucceeded), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_ListByResourceGroup.json func ExampleMachinesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -279,7 +591,7 @@ func ExampleMachinesClient_NewListByResourceGroupPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewMachinesClient().NewListByResourceGroupPager("myResourceGroup", nil) + pager := clientFactory.NewMachinesClient().NewListByResourceGroupPager("myResourceGroup", &armhybridcompute.MachinesClientListByResourceGroupOptions{Expand: nil}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -304,63 +616,44 @@ func ExampleMachinesClient_NewListByResourceGroupPager() { // }, // Properties: &armhybridcompute.MachineProperties{ // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), + // ExtensionsEnabled: to.Ptr("true"), + // GuestConfigurationEnabled: to.Ptr("true"), // IncomingConnectionsPorts: []*string{ // to.Ptr("22"), // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }, - // { - // Name: to.Ptr("myMachine2"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine2"), - // Location: to.Ptr("westus2"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), - // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, + // ProxyBypass: []*string{ + // to.Ptr("proxy1"), + // to.Ptr("proxy2")}, // ProxyURL: to.Ptr("https://test.test"), // }, // ClientPublicKey: to.Ptr("string"), // DetectedProperties: map[string]*string{ // "cloudprovider": to.Ptr("N/A"), // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Surfacebook"), + // "model": to.Ptr("Virtual Machine"), + // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, // }, // LocationData: &armhybridcompute.LocationData{ // Name: to.Ptr("Redmond"), // }, - // MssqlDiscovered: to.Ptr("true"), + // MssqlDiscovered: to.Ptr("false"), // OSProfile: &armhybridcompute.OSProfile{ // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ // PatchSettings: &armhybridcompute.PatchSettings{ @@ -371,17 +664,82 @@ func ExampleMachinesClient_NewListByResourceGroupPager() { // }, // }, // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), + // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), // }, - // }}, - // } + // }, + // { + // Name: to.Ptr("myMachine2"), + // Type: to.Ptr("Microsoft.HybridCompute/machines"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine2"), + // Location: to.Ptr("westus2"), + // Identity: &armhybridcompute.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), + // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), + // }, + // Properties: &armhybridcompute.MachineProperties{ + // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), + // ExtensionsEnabled: to.Ptr("true"), + // GuestConfigurationEnabled: to.Ptr("true"), + // IncomingConnectionsPorts: []*string{ + // to.Ptr("22"), + // to.Ptr("23")}, + // ProxyBypass: []*string{ + // to.Ptr("proxy1"), + // to.Ptr("proxy2")}, + // ProxyURL: to.Ptr("https://test.test"), + // }, + // ClientPublicKey: to.Ptr("string"), + // DetectedProperties: map[string]*string{ + // "cloudprovider": to.Ptr("N/A"), + // "manufacturer": to.Ptr("Microsoft Corporation"), + // "model": to.Ptr("Surfacebook"), + // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, + // LocationData: &armhybridcompute.LocationData{ + // Name: to.Ptr("Redmond"), + // }, + // MssqlDiscovered: to.Ptr("true"), + // OSProfile: &armhybridcompute.OSProfile{ + // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // }, + // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), + // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), + // ProvisioningState: to.Ptr("Succeeded"), + // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/machine/Machines_ListBySubscription.json func ExampleMachinesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -417,63 +775,44 @@ func ExampleMachinesClient_NewListBySubscriptionPager() { // }, // Properties: &armhybridcompute.MachineProperties{ // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), + // ExtensionsEnabled: to.Ptr("true"), + // GuestConfigurationEnabled: to.Ptr("true"), // IncomingConnectionsPorts: []*string{ // to.Ptr("22"), // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }, - // { - // Name: to.Ptr("myMachine2"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.HybridCompute/machines/myMachine2"), - // Location: to.Ptr("westus2"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), - // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, + // ProxyBypass: []*string{ + // to.Ptr("proxy1"), + // to.Ptr("proxy2")}, // ProxyURL: to.Ptr("https://test.test"), // }, // ClientPublicKey: to.Ptr("string"), // DetectedProperties: map[string]*string{ // "cloudprovider": to.Ptr("N/A"), // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Surfacebook"), + // "model": to.Ptr("Virtual Machine"), + // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, // }, // LocationData: &armhybridcompute.LocationData{ // Name: to.Ptr("Redmond"), // }, - // MssqlDiscovered: to.Ptr("true"), + // MssqlDiscovered: to.Ptr("false"), // OSProfile: &armhybridcompute.OSProfile{ // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ // PatchSettings: &armhybridcompute.PatchSettings{ @@ -484,11 +823,76 @@ func ExampleMachinesClient_NewListBySubscriptionPager() { // }, // }, // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), + // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), + // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), // }, - // }}, - // } + // }, + // { + // Name: to.Ptr("myMachine2"), + // Type: to.Ptr("Microsoft.HybridCompute/machines"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.HybridCompute/machines/myMachine2"), + // Location: to.Ptr("westus2"), + // Identity: &armhybridcompute.Identity{ + // Type: to.Ptr("SystemAssigned"), + // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), + // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), + // }, + // Properties: &armhybridcompute.MachineProperties{ + // AgentConfiguration: &armhybridcompute.AgentConfiguration{ + // ConfigMode: to.Ptr(armhybridcompute.AgentConfigurationModeFull), + // ExtensionsEnabled: to.Ptr("true"), + // GuestConfigurationEnabled: to.Ptr("true"), + // IncomingConnectionsPorts: []*string{ + // to.Ptr("22"), + // to.Ptr("23")}, + // ProxyBypass: []*string{ + // to.Ptr("proxy1"), + // to.Ptr("proxy2")}, + // ProxyURL: to.Ptr("https://test.test"), + // }, + // ClientPublicKey: to.Ptr("string"), + // DetectedProperties: map[string]*string{ + // "cloudprovider": to.Ptr("N/A"), + // "manufacturer": to.Ptr("Microsoft Corporation"), + // "model": to.Ptr("Surfacebook"), + // }, + // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ + // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ + // EsuKeys: []*armhybridcompute.EsuKey{ + // { + // LicenseStatus: to.Ptr("licenseStatus1"), + // SKU: to.Ptr("skuNumber1"), + // }, + // { + // LicenseStatus: to.Ptr("licenseStatus2"), + // SKU: to.Ptr("skuNumber2"), + // }}, + // EsuEligibility: to.Ptr(armhybridcompute.EsuEligibilityIneligible), + // EsuKeyState: to.Ptr(armhybridcompute.EsuKeyStateInactive), + // ServerType: to.Ptr(armhybridcompute.EsuServerTypeStandard), + // LicenseAssignmentState: to.Ptr(armhybridcompute.LicenseAssignmentStateAssigned), + // }, + // }, + // LocationData: &armhybridcompute.LocationData{ + // Name: to.Ptr("Redmond"), + // }, + // MssqlDiscovered: to.Ptr("true"), + // OSProfile: &armhybridcompute.OSProfile{ + // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ + // PatchSettings: &armhybridcompute.PatchSettings{ + // }, + // }, + // }, + // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), + // ProvisioningState: to.Ptr("Succeeded"), + // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go index c629ed0a598b..2c05860f993c 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go @@ -46,7 +46,7 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // BeginUpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. @@ -72,7 +72,7 @@ func (client *ManagementClient) BeginUpgradeExtensions(ctx context.Context, reso // UpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *ManagementClient) upgradeExtensions(ctx context.Context, resourceGroupName string, machineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *ManagementClientBeginUpgradeExtensionsOptions) (*http.Response, error) { var err error const operationName = "ManagementClient.BeginUpgradeExtensions" @@ -114,7 +114,7 @@ func (client *ManagementClient) upgradeExtensionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionUpgradeParameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go index c79a1f833326..464488bcf6eb 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Extensions_Upgrade.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/extension/Extensions_Upgrade.json func ExampleManagementClient_BeginUpgradeExtensions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go index 94e88cd52ef5..0a8a2fb8e205 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go @@ -13,6 +13,10 @@ import "time" // AgentConfiguration - Configurable properties that the user can set locally via the azcmagent config command, or remotely // via ARM. type AgentConfiguration struct { + // READ-ONLY; Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists + // and guest configuration, maintained by Microsoft. + ConfigMode *AgentConfigurationMode + // READ-ONLY; Array of extensions that are allowed to be installed or updated. ExtensionsAllowList []*ConfigurationExtension @@ -35,6 +39,81 @@ type AgentConfiguration struct { ProxyURL *string } +// AgentUpgrade - The info w.r.t Agent Upgrade. +type AgentUpgrade struct { + // The correlation ID passed in from RSM per upgrade. + CorrelationID *string + + // Specifies the version info w.r.t AgentUpgrade for the machine. + DesiredVersion *string + + // Specifies if RSM should try to upgrade this machine + EnableAutomaticUpgrade *bool + + // READ-ONLY; Specifies the version of the last attempt + LastAttemptDesiredVersion *string + + // READ-ONLY; Failure message of last upgrade attempt if any. + LastAttemptMessage *string + + // READ-ONLY; Specifies the status of Agent Upgrade. + LastAttemptStatus *LastAttemptStatusEnum + + // READ-ONLY; Timestamp of last upgrade attempt + LastAttemptTimestamp *string +} + +// AgentVersion - Describes properties of Agent Version. +type AgentVersion struct { + // Represents the agent version. + AgentVersion *string + + // Represents the download link of specific agent version. + DownloadLink *string + + // Defines the os type. + OSType *string +} + +// AgentVersionsList - Describes AgentVersions List. +type AgentVersionsList struct { + // The URI to fetch the next 10 available Agent Versions. + NextLink *string + + // The list of available Agent Versions. + Value []*AgentVersion +} + +// AvailablePatchCountByClassification - Summarization of patches available for installation on the machine by classification. +type AvailablePatchCountByClassification struct { + // READ-ONLY; Number of critical patches available for installation. + Critical *int32 + + // READ-ONLY; Number of definition patches available for installation. + Definition *int32 + + // READ-ONLY; Number of feature pack patches available for installation. + FeaturePack *int32 + + // READ-ONLY; Number of other patches available for installation. + Other *int32 + + // READ-ONLY; Number of security patches available for installation. + Security *int32 + + // READ-ONLY; Number of service pack patches available for installation. + ServicePack *int32 + + // READ-ONLY; Number of tools patches available for installation. + Tools *int32 + + // READ-ONLY; Number of update Rollup patches available for installation. + UpdateRollup *int32 + + // READ-ONLY; Number of updates category patches available for installation. + Updates *int32 +} + // CloudMetadata - The metadata of the cloud environment (Azure/GCP/AWS/OCI…). type CloudMetadata struct { // READ-ONLY; Specifies the cloud provider (Azure/AWS/GCP…). @@ -94,11 +173,19 @@ type ErrorDetail struct { Target *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail +// EsuKey - ESU key +type EsuKey struct { + // The current status of the license profile key. + LicenseStatus *string + + // SKU number. + SKU *string +} + +// EsuProfileUpdateProperties - Describes the Update properties of a License Profile. +type EsuProfileUpdateProperties struct { + // The resource id of the license. + AssignedLicense *string } // ExtensionTargetProperties - Describes the Machine Extension Target Version Properties @@ -107,6 +194,93 @@ type ExtensionTargetProperties struct { TargetVersion *string } +// ExtensionValue - Describes a Extension Metadata +type ExtensionValue struct { + // The single extension based on search criteria + Properties *ExtensionValueProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ExtensionValueListResult - The List Extension Metadata response. +type ExtensionValueListResult struct { + // READ-ONLY; The list of extension metadata + Value []*ExtensionValue +} + +// ExtensionValueProperties - Describes Extension Metadata properties +type ExtensionValueProperties struct { + // READ-ONLY; The type of the Extension being received. + ExtensionType *string + + // READ-ONLY; The publisher of the Extension being received. + Publisher *string + + // READ-ONLY; The version of the Extension being received. + Version *string +} + +// HybridIdentityMetadata - Defines the HybridIdentityMetadata. +type HybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *HybridIdentityMetadataProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HybridIdentityMetadataList - List of HybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of HybridIdentityMetadata + Value []*HybridIdentityMetadata + + // Url to follow for getting next page of HybridIdentityMetadata. + NextLink *string +} + +// HybridIdentityMetadataProperties - Defines the resource properties. +type HybridIdentityMetadataProperties struct { + // The Public Key. + PublicKey *string + + // The unique identifier for the resource. + VMID *string + + // READ-ONLY; Identity for the resource. + Identity *Identity +} + +// IPAddress - Describes properties of the IP address. +type IPAddress struct { + // Represents the IP Address. + Address *string + + // Represents the Ip Address Version. + IPAddressVersion *string + + // READ-ONLY; The subnet to which this IP address belongs. + Subnet *Subnet +} + // Identity for the resource. type Identity struct { // The identity type. @@ -119,6 +293,232 @@ type Identity struct { TenantID *string } +// License - Describes a license in a hybrid machine. +type License struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Hybrid Compute License properties + Properties *LicenseProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LicenseDetails - Describes the properties of a License. +type LicenseDetails struct { + // Describes the edition of the license. The values are either Standard or Datacenter. + Edition *LicenseEdition + + // Describes the number of processors. + Processors *int32 + + // Describes the state of the license. + State *LicenseState + + // Describes the license target server. + Target *LicenseTarget + + // Describes the license core type (pCore or vCore). + Type *LicenseCoreType + + // READ-ONLY; Describes the number of assigned licenses. + AssignedLicenses *int32 + + // READ-ONLY; Describes the immutable id. + ImmutableID *string +} + +// LicenseProfile - Describes a license profile in a hybrid machine. +type LicenseProfile struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Describe the properties of a license profile. + Properties *LicenseProfileProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LicenseProfileArmEsuProperties - Describes the properties of a License Profile ARM model. +type LicenseProfileArmEsuProperties struct { + // The resource id of the license. + AssignedLicense *string + + // READ-ONLY; The guid id of the license. + AssignedLicenseImmutableID *string + + // READ-ONLY; Indicates the eligibility state of Esu. + EsuEligibility *EsuEligibility + + // READ-ONLY; Indicates whether there is an ESU Key currently active for the machine. + EsuKeyState *EsuKeyState + + // READ-ONLY; The list of ESU keys. + EsuKeys []*EsuKey + + // READ-ONLY; The type of the Esu servers. + ServerType *EsuServerType +} + +// LicenseProfileMachineInstanceView - License Profile Instance View in Machine Properties. +type LicenseProfileMachineInstanceView struct { + // Properties for the Machine ESU profile. + EsuProfile *LicenseProfileMachineInstanceViewEsuProperties +} + +// LicenseProfileMachineInstanceViewEsuProperties - Properties for the Machine ESU profile. +type LicenseProfileMachineInstanceViewEsuProperties struct { + // The assigned license resource. + AssignedLicense *License + + // Describes the license assignment state (Assigned or NotAssigned). + LicenseAssignmentState *LicenseAssignmentState + + // READ-ONLY; The guid id of the license. + AssignedLicenseImmutableID *string + + // READ-ONLY; Indicates the eligibility state of Esu. + EsuEligibility *EsuEligibility + + // READ-ONLY; Indicates whether there is an ESU Key currently active for the machine. + EsuKeyState *EsuKeyState + + // READ-ONLY; The list of ESU keys. + EsuKeys []*EsuKey + + // READ-ONLY; The type of the Esu servers. + ServerType *EsuServerType +} + +// LicenseProfileProperties - Describe the properties of a license profile. +type LicenseProfileProperties struct { + // Hybrid Compute ESU Profile properties + EsuProfile *LicenseProfileArmEsuProperties + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *ProvisioningState +} + +// LicenseProfileUpdate - Describes a License Profile Update. +type LicenseProfileUpdate struct { + // Describe the Update properties of a license profile. + Properties *LicenseProfileUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// LicenseProfileUpdateProperties - Describe the Update properties of a license profile. +type LicenseProfileUpdateProperties struct { + // Hybrid Compute ESU Profile Update properties + EsuProfile *EsuProfileUpdateProperties +} + +// LicenseProfilesListResult - The List hybrid machine license profile operation response. +type LicenseProfilesListResult struct { + // REQUIRED; The list of license profiles. + Value []*LicenseProfile + + // The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of license profile. + NextLink *string +} + +// LicenseProperties - Describes the properties of a License Profile. +type LicenseProperties struct { + // Describes the properties of a License. + LicenseDetails *LicenseDetails + + // The type of the license resource. + LicenseType *LicenseType + + // Describes the tenant id. + TenantID *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *ProvisioningState +} + +// LicenseUpdate - Describes a License Update. +type LicenseUpdate struct { + // License Update properties + Properties *LicenseUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// LicenseUpdateProperties - Describes the Update properties of a License Profile. +type LicenseUpdateProperties struct { + LicenseDetails *LicenseUpdatePropertiesLicenseDetails + + // The type of the license resource. + LicenseType *LicenseType +} + +type LicenseUpdatePropertiesLicenseDetails struct { + // Describes the edition of the license. The values are either Standard or Datacenter. + Edition *LicenseEdition + + // Describes the number of processors. + Processors *int32 + + // Describes the state of the license. + State *LicenseState + + // Describes the license target server. + Target *LicenseTarget + + // Describes the license core type (pCore or vCore). + Type *LicenseCoreType +} + +// LicensesListResult - The List license operation response. +type LicensesListResult struct { + // REQUIRED; The list of licenses. + Value []*License + + // The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of license profile. + NextLink *string +} + +// LinuxParameters - Input for InstallPatches on a Linux VM, as directly received by the API +type LinuxParameters struct { + // The update classifications to select when installing patches for Linux. + ClassificationsToInclude []*VMGuestPatchClassificationLinux + + // packages to exclude in the patch operation. Format: packageName_packageVersion + PackageNameMasksToExclude []*string + + // packages to include in the patch operation. Format: packageName_packageVersion + PackageNameMasksToInclude []*string +} + // LocationData - Metadata pertaining to the geographic location of the resource. type LocationData struct { // REQUIRED; A canonical name for the geographic or physical location. @@ -142,6 +542,9 @@ type Machine struct { // Identity for the resource. Identity *Identity + // Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Kind *ArcKindEnum + // Hybrid Compute Machine properties Properties *MachineProperties @@ -154,13 +557,52 @@ type Machine struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; The list of extensions affiliated to the machine + Resources []*MachineExtension + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// MachineAssessPatchesResult - Describes the properties of an AssessPatches result. +type MachineAssessPatchesResult struct { + // Summarization of patches available for installation on the machine by classification. + AvailablePatchCountByClassification *AvailablePatchCountByClassification + + // READ-ONLY; The activity ID of the operation that produced this result. + AssessmentActivityID *string + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + ErrorDetails *ErrorDetail + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time + + // READ-ONLY; The operating system type of the machine. + OSType *OsType + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed + + // READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete + // installation but the reboot has not yet occurred. + RebootPending *bool + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Unknown", "Failed", "Succeeded", or + // "CompletedWithWarnings." + Status *PatchOperationStatus +} + // MachineExtension - Describes a Machine Extension. type MachineExtension struct { // REQUIRED; The geo-location where the resource lives @@ -178,7 +620,7 @@ type MachineExtension struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -235,13 +677,13 @@ type MachineExtensionProperties struct { InstanceView *MachineExtensionInstanceView // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any + ProtectedSettings map[string]any // The name of the extension handler publisher. Publisher *string // Json formatted public settings for the extension. - Settings any + Settings map[string]any // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string @@ -269,17 +711,20 @@ type MachineExtensionUpdateProperties struct { // with this property set to true. AutoUpgradeMinorVersion *bool + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + // How the extension handler should be forced to update even if the extension configuration has not changed. ForceUpdateTag *string // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any + ProtectedSettings map[string]any // The name of the extension handler publisher. Publisher *string // Json formatted public settings for the extension. - Settings any + Settings map[string]any // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string @@ -288,7 +733,7 @@ type MachineExtensionUpdateProperties struct { TypeHandlerVersion *string } -// MachineExtensionUpgrade - Describes the Machine Extension Upgrade Properties +// MachineExtensionUpgrade - Describes the Machine Extension Upgrade Properties. type MachineExtensionUpgrade struct { // Describes the Extension Target Properties. ExtensionTargets map[string]*ExtensionTargetProperties @@ -303,6 +748,72 @@ type MachineExtensionsListResult struct { Value []*MachineExtension } +// MachineInstallPatchesParameters - Input for InstallPatches as directly received by the API +type MachineInstallPatchesParameters struct { + // REQUIRED; Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string + // such as PT4H (4 hours) + MaximumDuration *string + + // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. + RebootSetting *VMGuestPatchRebootSetting + + // Input for InstallPatches on a Linux VM, as directly received by the API + LinuxParameters *LinuxParameters + + // Input for InstallPatches on a Windows VM, as directly received by the API + WindowsParameters *WindowsParameters +} + +// MachineInstallPatchesResult - The result summary of an installation operation. +type MachineInstallPatchesResult struct { + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + ErrorDetails *ErrorDetail + + // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. + ExcludedPatchCount *int32 + + // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. + FailedPatchCount *int32 + + // READ-ONLY; The activity ID of the operation that produced this result. + InstallationActivityID *string + + // READ-ONLY; The number of patches successfully installed. + InstalledPatchCount *int32 + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time + + // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. + MaintenanceWindowExceeded *bool + + // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. + NotSelectedPatchCount *int32 + + // READ-ONLY; The operating system type of the machine. + OSType *OsType + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed + + // READ-ONLY; The number of patches that were identified as meeting the installation criteria, but were not able to be installed. + // Typically this happens when maintenanceWindowExceeded == true. + PendingPatchCount *int32 + + // READ-ONLY; The reboot state of the VM following completion of the operation. + RebootStatus *VMGuestPatchRebootStatus + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings." + Status *PatchOperationStatus +} + // MachineListResult - The List hybrid machine operation response. type MachineListResult struct { // REQUIRED; The list of hybrid machines. @@ -314,15 +825,21 @@ type MachineListResult struct { // MachineProperties - Describes the properties of a hybrid machine. type MachineProperties struct { + // The info of the machine w.r.t Agent Upgrade + AgentUpgrade *AgentUpgrade + // Public Key that the client provides to be used during initial resource onboarding ClientPublicKey *string // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata - // Machine Extensions information + // Machine Extensions information (deprecated field) Extensions []*MachineExtensionInstanceView + // Specifies the ESU related properties for a machine. + LicenseProfile *LicenseProfileMachineInstanceView + // Metadata pertaining to the geographic location of the resource. LocationData *LocationData @@ -377,6 +894,9 @@ type MachineProperties struct { // READ-ONLY; Specifies the hybrid machine FQDN. MachineFqdn *string + // READ-ONLY; Information about the network the machine is on. + NetworkProfile *NetworkProfile + // READ-ONLY; The Operating System running on the hybrid machine. OSName *string @@ -401,6 +921,9 @@ type MachineUpdate struct { // Identity for the resource. Identity *Identity + // Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Kind *ArcKindEnum + // Hybrid Compute Machine properties Properties *MachineUpdateProperties @@ -410,6 +933,9 @@ type MachineUpdate struct { // MachineUpdateProperties - Describes the ARM updatable properties of a hybrid machine. type MachineUpdateProperties struct { + // The info of the machine w.r.t Agent Upgrade + AgentUpgrade *AgentUpgrade + // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata @@ -426,6 +952,18 @@ type MachineUpdateProperties struct { PrivateLinkScopeResourceID *string } +// NetworkInterface - Describes a network interface. +type NetworkInterface struct { + // The list of IP addresses in this interface. + IPAddresses []*IPAddress +} + +// NetworkProfile - Describes the network information on this machine. +type NetworkProfile struct { + // The list of network interfaces. + NetworkInterfaces []*NetworkInterface +} + // OSProfile - Specifies the operating system settings for the hybrid machine. type OSProfile struct { // Specifies the linux configuration for update management. @@ -506,7 +1044,7 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -569,7 +1107,7 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -659,24 +1197,6 @@ type PrivateLinkScopeValidationDetails struct { ID *string } -// PrivateLinkScopesResource - An azure resource object -type PrivateLinkScopesResource struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - // PrivateLinkServiceConnectionStateProperty - State of the private endpoint connection. type PrivateLinkServiceConnectionStateProperty struct { // REQUIRED; The private link service connection description. @@ -689,37 +1209,6 @@ type PrivateLinkServiceConnectionStateProperty struct { ActionsRequired *string } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ResourceUpdate - The Update Resource model definition. -type ResourceUpdate struct { - // Resource tags - Tags map[string]*string -} - // ServiceStatus - Describes the status and behavior of a service. type ServiceStatus struct { // The behavior of the service when the Arc-enabled machine starts up. @@ -738,6 +1227,12 @@ type ServiceStatuses struct { GuestConfigurationService *ServiceStatus } +// Subnet - Describes the subnet. +type Subnet struct { + // Represents address prefix. + AddressPrefix *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -766,21 +1261,20 @@ type TagsResource struct { Tags map[string]*string } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string +// WindowsParameters - Input for InstallPatches on a Windows VM, as directly received by the API +type WindowsParameters struct { + // The update classifications to select when installing patches for Windows. + ClassificationsToInclude []*VMGuestPatchClassificationWindows - // Resource tags. - Tags map[string]*string + // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + ExcludeKbsRequiringReboot *bool - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // Kbs to exclude in the patch operation + KbNumbersToExclude []*string - // READ-ONLY; The name of the resource - Name *string + // Kbs to include in the patch operation + KbNumbersToInclude []*string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // This is used to install patches that were published on or before this given max published date. + MaxPatchPublishDate *time.Time } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go index ca92a16329dc..a88bb2f12f88 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go @@ -18,6 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AgentConfiguration. func (a AgentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "configMode", a.ConfigMode) populate(objectMap, "extensionsAllowList", a.ExtensionsAllowList) populate(objectMap, "extensionsBlockList", a.ExtensionsBlockList) populate(objectMap, "extensionsEnabled", a.ExtensionsEnabled) @@ -37,6 +38,9 @@ func (a *AgentConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "configMode": + err = unpopulate(val, "ConfigMode", &a.ConfigMode) + delete(rawMsg, key) case "extensionsAllowList": err = unpopulate(val, "ExtensionsAllowList", &a.ExtensionsAllowList) delete(rawMsg, key) @@ -66,6 +70,182 @@ func (a *AgentConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AgentUpgrade. +func (a AgentUpgrade) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationId", a.CorrelationID) + populate(objectMap, "desiredVersion", a.DesiredVersion) + populate(objectMap, "enableAutomaticUpgrade", a.EnableAutomaticUpgrade) + populate(objectMap, "lastAttemptDesiredVersion", a.LastAttemptDesiredVersion) + populate(objectMap, "lastAttemptMessage", a.LastAttemptMessage) + populate(objectMap, "lastAttemptStatus", a.LastAttemptStatus) + populate(objectMap, "lastAttemptTimestamp", a.LastAttemptTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentUpgrade. +func (a *AgentUpgrade) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationId": + err = unpopulate(val, "CorrelationID", &a.CorrelationID) + delete(rawMsg, key) + case "desiredVersion": + err = unpopulate(val, "DesiredVersion", &a.DesiredVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &a.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "lastAttemptDesiredVersion": + err = unpopulate(val, "LastAttemptDesiredVersion", &a.LastAttemptDesiredVersion) + delete(rawMsg, key) + case "lastAttemptMessage": + err = unpopulate(val, "LastAttemptMessage", &a.LastAttemptMessage) + delete(rawMsg, key) + case "lastAttemptStatus": + err = unpopulate(val, "LastAttemptStatus", &a.LastAttemptStatus) + delete(rawMsg, key) + case "lastAttemptTimestamp": + err = unpopulate(val, "LastAttemptTimestamp", &a.LastAttemptTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentVersion. +func (a AgentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentVersion", a.AgentVersion) + populate(objectMap, "downloadLink", a.DownloadLink) + populate(objectMap, "osType", a.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentVersion. +func (a *AgentVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentVersion": + err = unpopulate(val, "AgentVersion", &a.AgentVersion) + delete(rawMsg, key) + case "downloadLink": + err = unpopulate(val, "DownloadLink", &a.DownloadLink) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentVersionsList. +func (a AgentVersionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentVersionsList. +func (a *AgentVersionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailablePatchCountByClassification. +func (a AvailablePatchCountByClassification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "critical", a.Critical) + populate(objectMap, "definition", a.Definition) + populate(objectMap, "featurePack", a.FeaturePack) + populate(objectMap, "other", a.Other) + populate(objectMap, "security", a.Security) + populate(objectMap, "servicePack", a.ServicePack) + populate(objectMap, "tools", a.Tools) + populate(objectMap, "updateRollup", a.UpdateRollup) + populate(objectMap, "updates", a.Updates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchCountByClassification. +func (a *AvailablePatchCountByClassification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "critical": + err = unpopulate(val, "Critical", &a.Critical) + delete(rawMsg, key) + case "definition": + err = unpopulate(val, "Definition", &a.Definition) + delete(rawMsg, key) + case "featurePack": + err = unpopulate(val, "FeaturePack", &a.FeaturePack) + delete(rawMsg, key) + case "other": + err = unpopulate(val, "Other", &a.Other) + delete(rawMsg, key) + case "security": + err = unpopulate(val, "Security", &a.Security) + delete(rawMsg, key) + case "servicePack": + err = unpopulate(val, "ServicePack", &a.ServicePack) + delete(rawMsg, key) + case "tools": + err = unpopulate(val, "Tools", &a.Tools) + delete(rawMsg, key) + case "updateRollup": + err = unpopulate(val, "UpdateRollup", &a.UpdateRollup) + delete(rawMsg, key) + case "updates": + err = unpopulate(val, "Updates", &a.Updates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CloudMetadata. func (c CloudMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -241,15 +421,46 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EsuKey. +func (e EsuKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "licenseStatus", e.LicenseStatus) + populate(objectMap, "sku", e.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuKey. +func (e *EsuKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "licenseStatus": + err = unpopulate(val, "LicenseStatus", &e.LicenseStatus) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &e.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EsuProfileUpdateProperties. +func (e EsuProfileUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "assignedLicense", e.AssignedLicense) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuProfileUpdateProperties. +func (e *EsuProfileUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -257,8 +468,8 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "assignedLicense": + err = unpopulate(val, "AssignedLicense", &e.AssignedLicense) delete(rawMsg, key) } if err != nil { @@ -295,126 +506,1054 @@ func (e *ExtensionTargetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionValue. +func (e ExtensionValue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValue. +func (e *ExtensionValue) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &i.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type LocationData. -func (l LocationData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionValueListResult. +func (e ExtensionValueListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "city", l.City) - populate(objectMap, "countryOrRegion", l.CountryOrRegion) - populate(objectMap, "district", l.District) - populate(objectMap, "name", l.Name) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationData. -func (l *LocationData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValueListResult. +func (e *ExtensionValueListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "city": - err = unpopulate(val, "City", &l.City) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) - case "countryOrRegion": - err = unpopulate(val, "CountryOrRegion", &l.CountryOrRegion) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionValueProperties. +func (e ExtensionValueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extensionType", e.ExtensionType) + populate(objectMap, "publisher", e.Publisher) + populate(objectMap, "version", e.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionValueProperties. +func (e *ExtensionValueProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensionType": + err = unpopulate(val, "ExtensionType", &e.ExtensionType) delete(rawMsg, key) - case "district": - err = unpopulate(val, "District", &l.District) + case "publisher": + err = unpopulate(val, "Publisher", &e.Publisher) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Machine. -func (m Machine) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Machine. -func (m *Machine) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. +func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &m.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) + err = unpopulate(val, "ID", &h.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &m.Name) + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &m.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) + err = unpopulate(val, "SystemData", &h.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. +func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", h.Identity) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "vmId", h.VMID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. +func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &h.Identity) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &h.VMID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAddress. +func (i IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", i.Address) + populate(objectMap, "ipAddressVersion", i.IPAddressVersion) + populate(objectMap, "subnet", i.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. +func (i *IPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &i.Address) + delete(rawMsg, key) + case "ipAddressVersion": + err = unpopulate(val, "IPAddressVersion", &i.IPAddressVersion) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + objectMap["type"] = "SystemAssigned" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type License. +func (l License) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type License. +func (l *License) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseDetails. +func (l LicenseDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedLicenses", l.AssignedLicenses) + populate(objectMap, "edition", l.Edition) + populate(objectMap, "immutableId", l.ImmutableID) + populate(objectMap, "processors", l.Processors) + populate(objectMap, "state", l.State) + populate(objectMap, "target", l.Target) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseDetails. +func (l *LicenseDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedLicenses": + err = unpopulate(val, "AssignedLicenses", &l.AssignedLicenses) + delete(rawMsg, key) + case "edition": + err = unpopulate(val, "Edition", &l.Edition) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &l.ImmutableID) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &l.Processors) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &l.State) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &l.Target) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfile. +func (l LicenseProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfile. +func (l *LicenseProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileArmEsuProperties. +func (l LicenseProfileArmEsuProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedLicense", l.AssignedLicense) + populate(objectMap, "assignedLicenseImmutableId", l.AssignedLicenseImmutableID) + populate(objectMap, "esuEligibility", l.EsuEligibility) + populate(objectMap, "esuKeyState", l.EsuKeyState) + populate(objectMap, "esuKeys", l.EsuKeys) + populate(objectMap, "serverType", l.ServerType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileArmEsuProperties. +func (l *LicenseProfileArmEsuProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedLicense": + err = unpopulate(val, "AssignedLicense", &l.AssignedLicense) + delete(rawMsg, key) + case "assignedLicenseImmutableId": + err = unpopulate(val, "AssignedLicenseImmutableID", &l.AssignedLicenseImmutableID) + delete(rawMsg, key) + case "esuEligibility": + err = unpopulate(val, "EsuEligibility", &l.EsuEligibility) + delete(rawMsg, key) + case "esuKeyState": + err = unpopulate(val, "EsuKeyState", &l.EsuKeyState) + delete(rawMsg, key) + case "esuKeys": + err = unpopulate(val, "EsuKeys", &l.EsuKeys) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &l.ServerType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileMachineInstanceView. +func (l LicenseProfileMachineInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuProfile", l.EsuProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileMachineInstanceView. +func (l *LicenseProfileMachineInstanceView) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuProfile": + err = unpopulate(val, "EsuProfile", &l.EsuProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileMachineInstanceViewEsuProperties. +func (l LicenseProfileMachineInstanceViewEsuProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedLicense", l.AssignedLicense) + populate(objectMap, "assignedLicenseImmutableId", l.AssignedLicenseImmutableID) + populate(objectMap, "esuEligibility", l.EsuEligibility) + populate(objectMap, "esuKeyState", l.EsuKeyState) + populate(objectMap, "esuKeys", l.EsuKeys) + populate(objectMap, "licenseAssignmentState", l.LicenseAssignmentState) + populate(objectMap, "serverType", l.ServerType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileMachineInstanceViewEsuProperties. +func (l *LicenseProfileMachineInstanceViewEsuProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedLicense": + err = unpopulate(val, "AssignedLicense", &l.AssignedLicense) + delete(rawMsg, key) + case "assignedLicenseImmutableId": + err = unpopulate(val, "AssignedLicenseImmutableID", &l.AssignedLicenseImmutableID) + delete(rawMsg, key) + case "esuEligibility": + err = unpopulate(val, "EsuEligibility", &l.EsuEligibility) + delete(rawMsg, key) + case "esuKeyState": + err = unpopulate(val, "EsuKeyState", &l.EsuKeyState) + delete(rawMsg, key) + case "esuKeys": + err = unpopulate(val, "EsuKeys", &l.EsuKeys) + delete(rawMsg, key) + case "licenseAssignmentState": + err = unpopulate(val, "LicenseAssignmentState", &l.LicenseAssignmentState) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &l.ServerType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileProperties. +func (l LicenseProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuProfile", l.EsuProfile) + populate(objectMap, "provisioningState", l.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileProperties. +func (l *LicenseProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuProfile": + err = unpopulate(val, "EsuProfile", &l.EsuProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdate. +func (l LicenseProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdate. +func (l *LicenseProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdateProperties. +func (l LicenseProfileUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuProfile", l.EsuProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdateProperties. +func (l *LicenseProfileUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuProfile": + err = unpopulate(val, "EsuProfile", &l.EsuProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfilesListResult. +func (l LicenseProfilesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfilesListResult. +func (l *LicenseProfilesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProperties. +func (l LicenseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "licenseDetails", l.LicenseDetails) + populate(objectMap, "licenseType", l.LicenseType) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "tenantId", l.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProperties. +func (l *LicenseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "licenseDetails": + err = unpopulate(val, "LicenseDetails", &l.LicenseDetails) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &l.LicenseType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &l.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseUpdate. +func (l LicenseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdate. +func (l *LicenseUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseUpdateProperties. +func (l LicenseUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "licenseDetails", l.LicenseDetails) + populate(objectMap, "licenseType", l.LicenseType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdateProperties. +func (l *LicenseUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "licenseDetails": + err = unpopulate(val, "LicenseDetails", &l.LicenseDetails) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &l.LicenseType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseUpdatePropertiesLicenseDetails. +func (l LicenseUpdatePropertiesLicenseDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "edition", l.Edition) + populate(objectMap, "processors", l.Processors) + populate(objectMap, "state", l.State) + populate(objectMap, "target", l.Target) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseUpdatePropertiesLicenseDetails. +func (l *LicenseUpdatePropertiesLicenseDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "edition": + err = unpopulate(val, "Edition", &l.Edition) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &l.Processors) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &l.State) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &l.Target) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicensesListResult. +func (l LicensesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicensesListResult. +func (l *LicensesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LinuxParameters. +func (l LinuxParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "classificationsToInclude", l.ClassificationsToInclude) + populate(objectMap, "packageNameMasksToExclude", l.PackageNameMasksToExclude) + populate(objectMap, "packageNameMasksToInclude", l.PackageNameMasksToInclude) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LinuxParameters. +func (l *LinuxParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &l.ClassificationsToInclude) + delete(rawMsg, key) + case "packageNameMasksToExclude": + err = unpopulate(val, "PackageNameMasksToExclude", &l.PackageNameMasksToExclude) + delete(rawMsg, key) + case "packageNameMasksToInclude": + err = unpopulate(val, "PackageNameMasksToInclude", &l.PackageNameMasksToInclude) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationData. +func (l LocationData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "city", l.City) + populate(objectMap, "countryOrRegion", l.CountryOrRegion) + populate(objectMap, "district", l.District) + populate(objectMap, "name", l.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationData. +func (l *LocationData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "city": + err = unpopulate(val, "City", &l.City) + delete(rawMsg, key) + case "countryOrRegion": + err = unpopulate(val, "CountryOrRegion", &l.CountryOrRegion) + delete(rawMsg, key) + case "district": + err = unpopulate(val, "District", &l.District) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Machine. +func (m Machine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "resources", m.Resources) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Machine. +func (m *Machine) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &m.Resources) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineAssessPatchesResult. +func (m MachineAssessPatchesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assessmentActivityId", m.AssessmentActivityID) + populate(objectMap, "availablePatchCountByClassification", m.AvailablePatchCountByClassification) + populate(objectMap, "errorDetails", m.ErrorDetails) + populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", m.LastModifiedDateTime) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "patchServiceUsed", m.PatchServiceUsed) + populate(objectMap, "rebootPending", m.RebootPending) + populateDateTimeRFC3339(objectMap, "startDateTime", m.StartDateTime) + populate(objectMap, "startedBy", m.StartedBy) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineAssessPatchesResult. +func (m *MachineAssessPatchesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentActivityId": + err = unpopulate(val, "AssessmentActivityID", &m.AssessmentActivityID) + delete(rawMsg, key) + case "availablePatchCountByClassification": + err = unpopulate(val, "AvailablePatchCountByClassification", &m.AvailablePatchCountByClassification) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &m.LastModifiedDateTime) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "patchServiceUsed": + err = unpopulate(val, "PatchServiceUsed", &m.PatchServiceUsed) + delete(rawMsg, key) + case "rebootPending": + err = unpopulate(val, "RebootPending", &m.RebootPending) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &m.StartDateTime) + delete(rawMsg, key) + case "startedBy": + err = unpopulate(val, "StartedBy", &m.StartedBy) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "status": + err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) } if err != nil { @@ -564,10 +1703,10 @@ func (m MachineExtensionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) populate(objectMap, "instanceView", m.InstanceView) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) + populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) @@ -655,10 +1794,11 @@ func (m *MachineExtensionUpdate) UnmarshalJSON(data []byte) error { func (m MachineExtensionUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) + populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) @@ -676,6 +1816,9 @@ func (m *MachineExtensionUpdateProperties) UnmarshalJSON(data []byte) error { case "autoUpgradeMinorVersion": err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) + delete(rawMsg, key) case "forceUpdateTag": err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) delete(rawMsg, key) @@ -760,6 +1903,128 @@ func (m *MachineExtensionsListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesParameters. +func (m MachineInstallPatchesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "linuxParameters", m.LinuxParameters) + populate(objectMap, "maximumDuration", m.MaximumDuration) + populate(objectMap, "rebootSetting", m.RebootSetting) + populate(objectMap, "windowsParameters", m.WindowsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineInstallPatchesParameters. +func (m *MachineInstallPatchesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linuxParameters": + err = unpopulate(val, "LinuxParameters", &m.LinuxParameters) + delete(rawMsg, key) + case "maximumDuration": + err = unpopulate(val, "MaximumDuration", &m.MaximumDuration) + delete(rawMsg, key) + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &m.RebootSetting) + delete(rawMsg, key) + case "windowsParameters": + err = unpopulate(val, "WindowsParameters", &m.WindowsParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesResult. +func (m MachineInstallPatchesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorDetails", m.ErrorDetails) + populate(objectMap, "excludedPatchCount", m.ExcludedPatchCount) + populate(objectMap, "failedPatchCount", m.FailedPatchCount) + populate(objectMap, "installationActivityId", m.InstallationActivityID) + populate(objectMap, "installedPatchCount", m.InstalledPatchCount) + populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", m.LastModifiedDateTime) + populate(objectMap, "maintenanceWindowExceeded", m.MaintenanceWindowExceeded) + populate(objectMap, "notSelectedPatchCount", m.NotSelectedPatchCount) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "patchServiceUsed", m.PatchServiceUsed) + populate(objectMap, "pendingPatchCount", m.PendingPatchCount) + populate(objectMap, "rebootStatus", m.RebootStatus) + populateDateTimeRFC3339(objectMap, "startDateTime", m.StartDateTime) + populate(objectMap, "startedBy", m.StartedBy) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineInstallPatchesResult. +func (m *MachineInstallPatchesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) + delete(rawMsg, key) + case "excludedPatchCount": + err = unpopulate(val, "ExcludedPatchCount", &m.ExcludedPatchCount) + delete(rawMsg, key) + case "failedPatchCount": + err = unpopulate(val, "FailedPatchCount", &m.FailedPatchCount) + delete(rawMsg, key) + case "installationActivityId": + err = unpopulate(val, "InstallationActivityID", &m.InstallationActivityID) + delete(rawMsg, key) + case "installedPatchCount": + err = unpopulate(val, "InstalledPatchCount", &m.InstalledPatchCount) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &m.LastModifiedDateTime) + delete(rawMsg, key) + case "maintenanceWindowExceeded": + err = unpopulate(val, "MaintenanceWindowExceeded", &m.MaintenanceWindowExceeded) + delete(rawMsg, key) + case "notSelectedPatchCount": + err = unpopulate(val, "NotSelectedPatchCount", &m.NotSelectedPatchCount) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "patchServiceUsed": + err = unpopulate(val, "PatchServiceUsed", &m.PatchServiceUsed) + delete(rawMsg, key) + case "pendingPatchCount": + err = unpopulate(val, "PendingPatchCount", &m.PendingPatchCount) + delete(rawMsg, key) + case "rebootStatus": + err = unpopulate(val, "RebootStatus", &m.RebootStatus) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &m.StartDateTime) + delete(rawMsg, key) + case "startedBy": + err = unpopulate(val, "StartedBy", &m.StartedBy) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MachineListResult. func (m MachineListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -796,6 +2061,7 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adFqdn", m.AdFqdn) populate(objectMap, "agentConfiguration", m.AgentConfiguration) + populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "agentVersion", m.AgentVersion) populate(objectMap, "clientPublicKey", m.ClientPublicKey) populate(objectMap, "cloudMetadata", m.CloudMetadata) @@ -806,9 +2072,11 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "errorDetails", m.ErrorDetails) populate(objectMap, "extensions", m.Extensions) populateDateTimeRFC3339(objectMap, "lastStatusChange", m.LastStatusChange) + populate(objectMap, "licenseProfile", m.LicenseProfile) populate(objectMap, "locationData", m.LocationData) populate(objectMap, "machineFqdn", m.MachineFqdn) populate(objectMap, "mssqlDiscovered", m.MssqlDiscovered) + populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "osName", m.OSName) populate(objectMap, "osProfile", m.OSProfile) populate(objectMap, "osSku", m.OSSKU) @@ -839,6 +2107,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "agentConfiguration": err = unpopulate(val, "AgentConfiguration", &m.AgentConfiguration) delete(rawMsg, key) + case "agentUpgrade": + err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) + delete(rawMsg, key) case "agentVersion": err = unpopulate(val, "AgentVersion", &m.AgentVersion) delete(rawMsg, key) @@ -869,6 +2140,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "lastStatusChange": err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &m.LastStatusChange) delete(rawMsg, key) + case "licenseProfile": + err = unpopulate(val, "LicenseProfile", &m.LicenseProfile) + delete(rawMsg, key) case "locationData": err = unpopulate(val, "LocationData", &m.LocationData) delete(rawMsg, key) @@ -878,6 +2152,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "mssqlDiscovered": err = unpopulate(val, "MssqlDiscovered", &m.MssqlDiscovered) delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) case "osName": err = unpopulate(val, "OSName", &m.OSName) delete(rawMsg, key) @@ -926,6 +2203,7 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { func (m MachineUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", m.Identity) + populate(objectMap, "kind", m.Kind) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) @@ -943,6 +2221,9 @@ func (m *MachineUpdate) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &m.Identity) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) @@ -960,6 +2241,7 @@ func (m *MachineUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MachineUpdateProperties. func (m MachineUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "cloudMetadata", m.CloudMetadata) populate(objectMap, "locationData", m.LocationData) populate(objectMap, "osProfile", m.OSProfile) @@ -977,6 +2259,9 @@ func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "agentUpgrade": + err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) + delete(rawMsg, key) case "cloudMetadata": err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) delete(rawMsg, key) @@ -1000,6 +2285,60 @@ func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipAddresses", n.IPAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. +func (n *NetworkInterface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &n.IPAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OSProfile. func (o OSProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1669,49 +3008,6 @@ func (p *PrivateLinkScopeValidationDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopesResource. -func (p PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopesResource. -func (p *PrivateLinkScopesResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1747,103 +3043,6 @@ func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceUpdate. -func (r ResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceUpdate. -func (r *ResourceUpdate) UnmarshalJSON(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 "tags": - err = unpopulate(val, "Tags", &r.Tags) - 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 ServiceStatus. func (s ServiceStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1906,6 +3105,33 @@ func (s *ServiceStatuses) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", s.AddressPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1980,44 +3206,44 @@ func (t *TagsResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WindowsParameters. +func (w WindowsParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) + populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) + populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) + populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) + populateDateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsParameters. +func (w *WindowsParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &w.ClassificationsToInclude) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "excludeKbsRequiringReboot": + err = unpopulate(val, "ExcludeKbsRequiringReboot", &w.ExcludeKbsRequiringReboot) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "kbNumbersToExclude": + err = unpopulate(val, "KbNumbersToExclude", &w.KbNumbersToExclude) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "kbNumbersToInclude": + err = unpopulate(val, "KbNumbersToInclude", &w.KbNumbersToInclude) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "maxPatchPublishDate": + err = unpopulateDateTimeRFC3339(val, "MaxPatchPublishDate", &w.MaxPatchPublishDate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", w, err) } } return nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go new file mode 100644 index 000000000000..abc310839e50 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go @@ -0,0 +1,108 @@ +//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 armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NetworkProfileClient contains the methods for the NetworkProfile group. +// Don't use this type directly, use NewNetworkProfileClient() instead. +type NetworkProfileClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkProfileClient creates a new instance of NetworkProfileClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewNetworkProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkProfileClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkProfileClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - The operation to get network information of hybrid machine +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - NetworkProfileClientGetOptions contains the optional parameters for the NetworkProfileClient.Get method. +func (client *NetworkProfileClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *NetworkProfileClientGetOptions) (NetworkProfileClientGetResponse, error) { + var err error + const operationName = "NetworkProfileClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkProfileClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkProfileClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *NetworkProfileClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkProfileClient) getHandleResponse(resp *http.Response) (NetworkProfileClientGetResponse, error) { + result := NetworkProfileClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfile); err != nil { + return NetworkProfileClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go new file mode 100644 index 000000000000..c83a80e6971d --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go @@ -0,0 +1,61 @@ +//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 armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/NetworkProfile_Get.json +func ExampleNetworkProfileClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewNetworkProfileClient().Get(ctx, "myResourceGroup", "myMachine", 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.NetworkProfile = armhybridcompute.NetworkProfile{ + // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("192.168.12.345"), + // IPAddressVersion: to.Ptr("IPv4"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("192.168.12.0/24"), + // }, + // }}, + // }, + // { + // IPAddresses: []*armhybridcompute.IPAddress{ + // { + // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), + // IPAddressVersion: to.Ptr("IPv6"), + // Subnet: &armhybridcompute.Subnet{ + // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), + // }, + // }}, + // }}, + // } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go index 595085053bfb..e20e526337a9 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of hybrid compute operations. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - 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]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go index c2624eb512fc..8c8ab7a1e06c 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go index 90fbb79be07a..d74570534cd8 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go @@ -8,6 +8,108 @@ package armhybridcompute +// AgentVersionClientGetOptions contains the optional parameters for the AgentVersionClient.Get method. +type AgentVersionClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentVersionClientListOptions contains the optional parameters for the AgentVersionClient.List method. +type AgentVersionClientListOptions struct { + // placeholder for future optional parameters +} + +// ExtensionMetadataClientGetOptions contains the optional parameters for the ExtensionMetadataClient.Get method. +type ExtensionMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtensionMetadataClientListOptions contains the optional parameters for the ExtensionMetadataClient.NewListPager method. +type ExtensionMetadataClientListOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. +type HybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientListByMachinesOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByMachinesPager +// method. +type HybridIdentityMetadataClientListByMachinesOptions struct { + // placeholder for future optional parameters +} + +// LicenseProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginCreateOrUpdate +// method. +type LicenseProfilesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientBeginDeleteOptions contains the optional parameters for the LicenseProfilesClient.BeginDelete method. +type LicenseProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientBeginUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginUpdate method. +type LicenseProfilesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientGetOptions contains the optional parameters for the LicenseProfilesClient.Get method. +type LicenseProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LicenseProfilesClientListOptions contains the optional parameters for the LicenseProfilesClient.NewListPager method. +type LicenseProfilesClientListOptions struct { + // placeholder for future optional parameters +} + +// LicensesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicensesClient.BeginCreateOrUpdate method. +type LicensesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicensesClientBeginDeleteOptions contains the optional parameters for the LicensesClient.BeginDelete method. +type LicensesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicensesClientBeginUpdateOptions contains the optional parameters for the LicensesClient.BeginUpdate method. +type LicensesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicensesClientBeginValidateLicenseOptions contains the optional parameters for the LicensesClient.BeginValidateLicense +// method. +type LicensesClientBeginValidateLicenseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicensesClientGetOptions contains the optional parameters for the LicensesClient.Get method. +type LicensesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LicensesClientListByResourceGroupOptions contains the optional parameters for the LicensesClient.NewListByResourceGroupPager +// method. +type LicensesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LicensesClientListBySubscriptionOptions contains the optional parameters for the LicensesClient.NewListBySubscriptionPager +// method. +type LicensesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + // MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate // method. type MachineExtensionsClientBeginCreateOrUpdateOptions struct { @@ -40,9 +142,22 @@ type MachineExtensionsClientListOptions struct { Expand *string } +// MachinesClientBeginAssessPatchesOptions contains the optional parameters for the MachinesClient.BeginAssessPatches method. +type MachinesClientBeginAssessPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachinesClientBeginInstallPatchesOptions contains the optional parameters for the MachinesClient.BeginInstallPatches method. +type MachinesClientBeginInstallPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // MachinesClientCreateOrUpdateOptions contains the optional parameters for the MachinesClient.CreateOrUpdate method. type MachinesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters + // Expands referenced resources. + Expand *string } // MachinesClientDeleteOptions contains the optional parameters for the MachinesClient.Delete method. @@ -59,7 +174,8 @@ type MachinesClientGetOptions struct { // MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager // method. type MachinesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters + // Expands referenced resources. + Expand *string } // MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager @@ -80,6 +196,11 @@ type ManagementClientBeginUpgradeExtensionsOptions struct { ResumeToken string } +// NetworkProfileClientGetOptions contains the optional parameters for the NetworkProfileClient.Get method. +type NetworkProfileClientGetOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go index 7bcb204ed9be..58c4f7b4fd69 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -72,7 +72,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -118,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -130,7 +130,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -156,7 +156,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -202,7 +202,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -263,7 +263,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager @@ -328,7 +328,7 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go index 538a2a6322b7..e2b8e6606864 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Update.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +126,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateEndpoint/PrivateEndpointConnection_List.json func ExamplePrivateEndpointConnectionsClient_NewListByPrivateLinkScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go index f5f1659a6020..db6d6e4a7a79 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - groupName - The name of the private link resource. @@ -98,7 +98,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByPrivateLinkScopePager - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager @@ -163,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go index 1bbfb2fb3fd3..7df9220a8a9e 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceListGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go index fca3b9a94cee..298f05c7da03 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // nor AppId in the Put operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - parameters - Properties that need to be specified to create or update a Azure Arc for Servers and Clusters PrivateLinkScope. @@ -95,7 +95,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -116,7 +116,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.R // BeginDelete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete @@ -141,7 +141,7 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateLinkScopesClient.BeginDelete" @@ -183,7 +183,7 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +192,7 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, // Get - Returns a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. @@ -238,7 +238,7 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,7 +256,7 @@ func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (P // GetValidationDetails - Returns a Azure Arc PrivateLinkScope's validation details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - location - The location of the target resource. // - privateLinkScopeID - The id (Guid) of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetValidationDetailsOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetails @@ -303,7 +303,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsHandleResponse(resp * // GetValidationDetailsForMachine - Returns a Azure Arc PrivateLinkScope's validation details for a given machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the target machine to get the private link scope validation details for. // - options - PrivateLinkScopesClientGetValidationDetailsForMachineOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetailsForMachine @@ -368,7 +368,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineHandleRespo // NewListPager - Gets a list of all Azure Arc PrivateLinkScopes within a subscription. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager // method. func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { @@ -423,7 +423,7 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +440,7 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Gets a list of Azure Arc PrivateLinkScopes within a resource group. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager // method. @@ -483,7 +483,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -501,7 +501,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *h // UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. @@ -549,7 +549,7 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go index 3f726ca528d2..0643c24061b9 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go @@ -15,10 +15,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_List.json func ExamplePrivateLinkScopesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,7 +89,7 @@ func ExamplePrivateLinkScopesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -177,7 +177,7 @@ func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Delete.json func ExamplePrivateLinkScopesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -198,7 +198,7 @@ func ExamplePrivateLinkScopesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Get.json func ExamplePrivateLinkScopesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -248,7 +248,7 @@ func ExamplePrivateLinkScopesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Create.json func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -300,7 +300,7 @@ func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_Update.json func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -356,7 +356,7 @@ func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdateTagsOnly.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_UpdateTagsOnly.json func ExamplePrivateLinkScopesClient_UpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -413,7 +413,7 @@ func ExamplePrivateLinkScopesClient_UpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidation.json func ExamplePrivateLinkScopesClient_GetValidationDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -445,7 +445,7 @@ func ExamplePrivateLinkScopesClient_GetValidationDetails() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidationForMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bf204aab860f2eb58a9d346b00d44760f2a9b0a2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2023-06-20-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json func ExamplePrivateLinkScopesClient_GetValidationDetailsForMachine() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go index 50960fe1eff0..c6b4f4553d8b 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go @@ -8,6 +8,112 @@ package armhybridcompute +// AgentVersionClientGetResponse contains the response from method AgentVersionClient.Get. +type AgentVersionClientGetResponse struct { + // Describes properties of Agent Version. + AgentVersion +} + +// AgentVersionClientListResponse contains the response from method AgentVersionClient.List. +type AgentVersionClientListResponse struct { + // Describes AgentVersions List. + AgentVersionsList +} + +// ExtensionMetadataClientGetResponse contains the response from method ExtensionMetadataClient.Get. +type ExtensionMetadataClientGetResponse struct { + // Describes a Extension Metadata + ExtensionValue +} + +// ExtensionMetadataClientListResponse contains the response from method ExtensionMetadataClient.NewListPager. +type ExtensionMetadataClientListResponse struct { + // The List Extension Metadata response. + ExtensionValueListResult +} + +// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. +type HybridIdentityMetadataClientGetResponse struct { + // Defines the HybridIdentityMetadata. + HybridIdentityMetadata +} + +// HybridIdentityMetadataClientListByMachinesResponse contains the response from method HybridIdentityMetadataClient.NewListByMachinesPager. +type HybridIdentityMetadataClientListByMachinesResponse struct { + // List of HybridIdentityMetadata. + HybridIdentityMetadataList +} + +// LicenseProfilesClientCreateOrUpdateResponse contains the response from method LicenseProfilesClient.BeginCreateOrUpdate. +type LicenseProfilesClientCreateOrUpdateResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + +// LicenseProfilesClientDeleteResponse contains the response from method LicenseProfilesClient.BeginDelete. +type LicenseProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// LicenseProfilesClientGetResponse contains the response from method LicenseProfilesClient.Get. +type LicenseProfilesClientGetResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + +// LicenseProfilesClientListResponse contains the response from method LicenseProfilesClient.NewListPager. +type LicenseProfilesClientListResponse struct { + // The List hybrid machine license profile operation response. + LicenseProfilesListResult +} + +// LicenseProfilesClientUpdateResponse contains the response from method LicenseProfilesClient.BeginUpdate. +type LicenseProfilesClientUpdateResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + +// LicensesClientCreateOrUpdateResponse contains the response from method LicensesClient.BeginCreateOrUpdate. +type LicensesClientCreateOrUpdateResponse struct { + // Describes a license in a hybrid machine. + License +} + +// LicensesClientDeleteResponse contains the response from method LicensesClient.BeginDelete. +type LicensesClientDeleteResponse struct { + // placeholder for future response values +} + +// LicensesClientGetResponse contains the response from method LicensesClient.Get. +type LicensesClientGetResponse struct { + // Describes a license in a hybrid machine. + License +} + +// LicensesClientListByResourceGroupResponse contains the response from method LicensesClient.NewListByResourceGroupPager. +type LicensesClientListByResourceGroupResponse struct { + // The List license operation response. + LicensesListResult +} + +// LicensesClientListBySubscriptionResponse contains the response from method LicensesClient.NewListBySubscriptionPager. +type LicensesClientListBySubscriptionResponse struct { + // The List license operation response. + LicensesListResult +} + +// LicensesClientUpdateResponse contains the response from method LicensesClient.BeginUpdate. +type LicensesClientUpdateResponse struct { + // Describes a license in a hybrid machine. + License +} + +// LicensesClientValidateLicenseResponse contains the response from method LicensesClient.BeginValidateLicense. +type LicensesClientValidateLicenseResponse struct { + // Describes a license in a hybrid machine. + License +} + // MachineExtensionsClientCreateOrUpdateResponse contains the response from method MachineExtensionsClient.BeginCreateOrUpdate. type MachineExtensionsClientCreateOrUpdateResponse struct { // Describes a Machine Extension. @@ -37,6 +143,12 @@ type MachineExtensionsClientUpdateResponse struct { MachineExtension } +// MachinesClientAssessPatchesResponse contains the response from method MachinesClient.BeginAssessPatches. +type MachinesClientAssessPatchesResponse struct { + // Describes the properties of an AssessPatches result. + MachineAssessPatchesResult +} + // MachinesClientCreateOrUpdateResponse contains the response from method MachinesClient.CreateOrUpdate. type MachinesClientCreateOrUpdateResponse struct { // Describes a hybrid machine. @@ -54,6 +166,12 @@ type MachinesClientGetResponse struct { Machine } +// MachinesClientInstallPatchesResponse contains the response from method MachinesClient.BeginInstallPatches. +type MachinesClientInstallPatchesResponse struct { + // The result summary of an installation operation. + MachineInstallPatchesResult +} + // MachinesClientListByResourceGroupResponse contains the response from method MachinesClient.NewListByResourceGroupPager. type MachinesClientListByResourceGroupResponse struct { // The List hybrid machine operation response. @@ -77,6 +195,12 @@ type ManagementClientUpgradeExtensionsResponse struct { // placeholder for future response values } +// NetworkProfileClientGetResponse contains the response from method NetworkProfileClient.Get. +type NetworkProfileClientGetResponse struct { + // Describes the network information on this machine. + NetworkProfile +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // The List Compute Operation operation response.