diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md index 32bde4229f2f..a9341ce52248 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md @@ -1,5 +1,62 @@ # Release History +## 1.1.0 (2023-03-28) +### Features Added + +- New enum type `AgentConfigurationMode` with values `AgentConfigurationModeFull`, `AgentConfigurationModeMonitor` +- New enum type `LastAttemptStatusEnum` with values `LastAttemptStatusEnumFailed`, `LastAttemptStatusEnumSuccess` +- 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 `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 `NewClientFactory(string, azcore.TokenCredential, *arm.ClientOptions) (*ClientFactory, error)` +- New function `*ClientFactory.NewExtensionMetadataClient() *ExtensionMetadataClient` +- New function `*ClientFactory.NewMachineExtensionsClient() *MachineExtensionsClient` +- New function `*ClientFactory.NewMachinesClient() *MachinesClient` +- New function `*ClientFactory.NewManagementClient() *ManagementClient` +- New function `*ClientFactory.NewNetworkProfileClient() *NetworkProfileClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `*ClientFactory.NewPrivateLinkScopesClient() *PrivateLinkScopesClient` +- 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 `*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 `AvailablePatchCountByClassification` +- New struct `ClientFactory` +- New struct `ErrorDetailAutoGenerated` +- New struct `ErrorResponseAutoGenerated` +- New struct `ExtensionValue` +- New struct `ExtensionValueListResult` +- New struct `ExtensionValueProperties` +- New struct `IPAddress` +- 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 `Resources` in struct `Machine` +- New field `EnableAutomaticUpgrade` in struct `MachineExtensionUpdateProperties` +- New field `AgentUpgrade` in struct `MachineProperties` +- New field `AgentUpgrade` in struct `MachineUpdateProperties` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md index 683819e63b80..42d226ff08bd 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridcompute/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridcompute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go new file mode 100644 index 000000000000..9935368fd4bd --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go @@ -0,0 +1,84 @@ +//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 + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewMachinesClient() *MachinesClient { + subClient, _ := NewMachinesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewMachineExtensionsClient() *MachineExtensionsClient { + subClient, _ := NewMachineExtensionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewManagementClient() *ManagementClient { + subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExtensionMetadataClient() *ExtensionMetadataClient { + subClient, _ := NewExtensionMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewNetworkProfileClient() *NetworkProfileClient { + subClient, _ := NewNetworkProfileClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { + subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go new file mode 100644 index 000000000000..50ed91b9bb69 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go @@ -0,0 +1,340 @@ +//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 + +const ( + moduleName = "armhybridcompute" + moduleVersion = "v1.1.0" +) + +// 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, + } +} + +// AssessmentModeTypes - Specifies the assessment mode. +type AssessmentModeTypes string + +const ( + AssessmentModeTypesAutomaticByPlatform AssessmentModeTypes = "AutomaticByPlatform" + AssessmentModeTypesImageDefault AssessmentModeTypes = "ImageDefault" +) + +// PossibleAssessmentModeTypesValues returns the possible values for the AssessmentModeTypes const type. +func PossibleAssessmentModeTypesValues() []AssessmentModeTypes { + return []AssessmentModeTypes{ + AssessmentModeTypesAutomaticByPlatform, + AssessmentModeTypesImageDefault, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" +) + +// PossibleInstanceViewTypesValues returns the possible values for the InstanceViewTypes const type. +func PossibleInstanceViewTypesValues() []InstanceViewTypes { + return []InstanceViewTypes{ + InstanceViewTypesInstanceView, + } +} + +// 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, + } +} + +// 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 + +const ( + PatchModeTypesAutomaticByOS PatchModeTypes = "AutomaticByOS" + PatchModeTypesAutomaticByPlatform PatchModeTypes = "AutomaticByPlatform" + PatchModeTypesImageDefault PatchModeTypes = "ImageDefault" + PatchModeTypesManual PatchModeTypes = "Manual" +) + +// PossiblePatchModeTypesValues returns the possible values for the PatchModeTypes const type. +func PossiblePatchModeTypesValues() []PatchModeTypes { + return []PatchModeTypes{ + PatchModeTypesAutomaticByOS, + PatchModeTypesAutomaticByPlatform, + PatchModeTypesImageDefault, + PatchModeTypesManual, + } +} + +// 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, + } +} + +// 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 + +const ( + // PublicNetworkAccessTypeDisabled - Does not allow Azure Arc agents to communicate with Azure Arc services over public (internet) + // endpoints. The agents must use the private link. + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + // PublicNetworkAccessTypeEnabled - Allows Azure Arc agents to communicate with Azure Arc services over both public (internet) + // and private endpoints. + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns the possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{ + PublicNetworkAccessTypeDisabled, + PublicNetworkAccessTypeEnabled, + } +} + +// StatusLevelTypes - The level code. +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{ + StatusLevelTypesError, + StatusLevelTypesInfo, + StatusLevelTypesWarning, + } +} + +// StatusTypes - The status of the hybrid machine agent. +type StatusTypes string + +const ( + StatusTypesConnected StatusTypes = "Connected" + StatusTypesDisconnected StatusTypes = "Disconnected" + StatusTypesError StatusTypes = "Error" +) + +// PossibleStatusTypesValues returns the possible values for the StatusTypes const type. +func PossibleStatusTypesValues() []StatusTypes { + return []StatusTypes{ + StatusTypesConnected, + StatusTypesDisconnected, + 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..3bad87d41084 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go @@ -0,0 +1,181 @@ +//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 + +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+".ExtensionMetadataClient", 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 2022-12-27 +// - 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) { + req, err := client.getCreateRequest(ctx, location, publisher, extensionType, version, options) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ExtensionMetadataClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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", "2022-12-27") + 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 2022-12-27 +// - 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) { + 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) + }, + }) +} + +// 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", "2022-12-27") + 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/go.mod b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod index 24563df50b39..624944d2c897 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhy go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum index ed5b814680ee..f54c298864a1 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum @@ -1,33 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machineextensions_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go similarity index 80% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machineextensions_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go index 95b63e9d081a..5d351e9e4eaa 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machineextensions_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,65 +24,58 @@ import ( // MachineExtensionsClient contains the methods for the MachineExtensions group. // Don't use this type directly, use NewMachineExtensionsClient() instead. type MachineExtensionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewMachineExtensionsClient creates a new instance of MachineExtensionsClient 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. +// - 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 NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineExtensionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".MachineExtensionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &MachineExtensionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // 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 -// 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. -// extensionParameters - Parameters supplied to the Create Machine Extension operation. -// options - MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - extensionParameters - Parameters supplied to the Create Machine Extension operation. +// - options - MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate +// method. func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[MachineExtensionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[MachineExtensionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[MachineExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -112,12 +104,12 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C 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.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) @@ -125,33 +117,35 @@ 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 -// 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. -// options - MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete +// method. func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*runtime.Poller[MachineExtensionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, machineName, extensionName, options) if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[MachineExtensionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[MachineExtensionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, extensionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -180,12 +174,12 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, 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.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,17 +187,18 @@ 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 -// 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. -// options - MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. func (client *MachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientGetOptions) (MachineExtensionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, extensionName, options) if err != nil { return MachineExtensionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachineExtensionsClientGetResponse{}, err } @@ -232,12 +227,12 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,11 +248,12 @@ func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (M } // NewListPager - The operation to get all extensions of a non-Azure machine -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// 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.List method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, machineName string, options *MachineExtensionsClientListOptions) *runtime.Pager[MachineExtensionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MachineExtensionsClientListResponse]{ More: func(page MachineExtensionsClientListResponse) bool { @@ -274,7 +270,7 @@ func (client *MachineExtensionsClient) NewListPager(resourceGroupName string, ma if err != nil { return MachineExtensionsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachineExtensionsClientListResponse{}, err } @@ -301,7 +297,7 @@ func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, re 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.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } @@ -309,7 +305,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", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,34 +322,36 @@ 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 -// 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. -// extensionParameters - Parameters supplied to the Create Machine Extension operation. -// options - MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - extensionParameters - Parameters supplied to the Create Machine Extension operation. +// - options - MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate +// method. func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*runtime.Poller[MachineExtensionsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[MachineExtensionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[MachineExtensionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[MachineExtensionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -382,12 +380,12 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, 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.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionParameters) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machines_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go similarity index 61% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machines_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go index d968f6096c7f..e4fff293bcb8 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_machines_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,48 +24,108 @@ import ( // MachinesClient contains the methods for the Machines group. // Don't use this type directly, use NewMachinesClient() instead. type MachinesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewMachinesClient creates a new instance of MachinesClient 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. +// - 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 NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".MachinesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &MachinesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } 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-12-27 +// - 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 + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientAssessPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[MachinesClientAssessPatchesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 2022-12-27 +func (client *MachinesClient) assessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, 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", "2022-12-27") + 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 2022-03-10 -// 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. -// options - MachinesClientCreateOrUpdateOptions contains the optional parameters for the MachinesClient.CreateOrUpdate method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - MachinesClientCreateOrUpdateOptions contains the optional parameters for the MachinesClient.CreateOrUpdate method. func (client *MachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters Machine, options *MachinesClientCreateOrUpdateOptions) (MachinesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) if err != nil { return MachinesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientCreateOrUpdateResponse{}, err } @@ -91,12 +150,12 @@ func (client *MachinesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, errors.New("parameter machineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -111,18 +170,19 @@ 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 -// 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. +// +// Generated from API version 2022-12-27 +// - 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. func (client *MachinesClient) Delete(ctx context.Context, resourceGroupName string, machineName string, options *MachinesClientDeleteOptions) (MachinesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return MachinesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientDeleteResponse{}, err } @@ -147,12 +207,12 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter machineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -160,16 +220,17 @@ 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 -// 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. +// +// Generated from API version 2022-12-27 +// - 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. func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return MachinesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientGetResponse{}, err } @@ -194,12 +255,12 @@ func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGrou 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -217,13 +278,81 @@ 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 2022-12-27 +// - 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 + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientInstallPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[MachinesClientInstallPatchesResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 2022-12-27 +func (client *MachinesClient) installPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, name, installPatchesInput, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, 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", "2022-12-27") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, installPatchesInput) +} + // 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-12-27 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager +// method. func (client *MachinesClient) NewListByResourceGroupPager(resourceGroupName string, options *MachinesClientListByResourceGroupOptions) *runtime.Pager[MachinesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[MachinesClientListByResourceGroupResponse]{ More: func(page MachinesClientListByResourceGroupResponse) bool { @@ -240,7 +369,7 @@ func (client *MachinesClient) NewListByResourceGroupPager(resourceGroupName stri if err != nil { return MachinesClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientListByResourceGroupResponse{}, err } @@ -263,12 +392,12 @@ func (client *MachinesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,10 +414,10 @@ 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// options - MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.ListBySubscription -// method. +// +// Generated from API version 2022-12-27 +// - options - MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager +// method. func (client *MachinesClient) NewListBySubscriptionPager(options *MachinesClientListBySubscriptionOptions) *runtime.Pager[MachinesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[MachinesClientListBySubscriptionResponse]{ More: func(page MachinesClientListBySubscriptionResponse) bool { @@ -305,7 +434,7 @@ func (client *MachinesClient) NewListBySubscriptionPager(options *MachinesClient if err != nil { return MachinesClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientListBySubscriptionResponse{}, err } @@ -324,12 +453,12 @@ func (client *MachinesClient) listBySubscriptionCreateRequest(ctx context.Contex 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -346,17 +475,18 @@ 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 -// 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. -// options - MachinesClientUpdateOptions contains the optional parameters for the MachinesClient.Update method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - MachinesClientUpdateOptions contains the optional parameters for the MachinesClient.Update method. func (client *MachinesClient) Update(ctx context.Context, resourceGroupName string, machineName string, parameters MachineUpdate, options *MachinesClientUpdateOptions) (MachinesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) if err != nil { return MachinesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientUpdateResponse{}, err } @@ -381,12 +511,12 @@ func (client *MachinesClient) updateCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter machineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_management_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go similarity index 74% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_management_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go index c35c4a8fbc98..40deddd0c958 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_management_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,64 +24,57 @@ import ( // ManagementClient contains the methods for the HybridComputeManagementClient group. // Don't use this type directly, use NewManagementClient() instead. type ManagementClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewManagementClient creates a new instance of ManagementClient 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. +// - 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 NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ManagementClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ManagementClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginUpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// 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. -// options - ManagementClientBeginUpgradeExtensionsOptions contains the optional parameters for the ManagementClient.BeginUpgradeExtensions -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - ManagementClientBeginUpgradeExtensionsOptions contains the optional parameters for the ManagementClient.BeginUpgradeExtensions +// method. func (client *ManagementClient) BeginUpgradeExtensions(ctx context.Context, resourceGroupName string, machineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *ManagementClientBeginUpgradeExtensionsOptions) (*runtime.Poller[ManagementClientUpgradeExtensionsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.upgradeExtensions(ctx, resourceGroupName, machineName, extensionUpgradeParameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ManagementClientUpgradeExtensionsResponse](resp, client.pl, nil) + return runtime.NewPoller[ManagementClientUpgradeExtensionsResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[ManagementClientUpgradeExtensionsResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ManagementClientUpgradeExtensionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *ManagementClient) upgradeExtensions(ctx context.Context, resourceGroupName string, machineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *ManagementClientBeginUpgradeExtensionsOptions) (*http.Response, error) { req, err := client.upgradeExtensionsCreateRequest(ctx, resourceGroupName, machineName, extensionUpgradeParameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -107,12 +99,12 @@ func (client *ManagementClient) upgradeExtensionsCreateRequest(ctx context.Conte return nil, errors.New("parameter machineName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, extensionUpgradeParameters) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go similarity index 69% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/models.go index b60e1819821c..22d3185d7362 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go @@ -5,6 +5,7 @@ // 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 @@ -13,6 +14,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 `json:"configMode,omitempty" azure:"ro"` + // READ-ONLY; Array of extensions that are allowed to be installed or updated. ExtensionsAllowList []*ConfigurationExtension `json:"extensionsAllowList,omitempty" azure:"ro"` @@ -35,6 +40,57 @@ type AgentConfiguration struct { ProxyURL *string `json:"proxyUrl,omitempty" azure:"ro"` } +// AgentUpgrade - The info w.r.t Agent Upgrade. +type AgentUpgrade struct { + // The correlation ID passed in from RSM per upgrade. + CorrelationID *string `json:"correlationId,omitempty"` + + // Specifies the version info w.r.t AgentUpgrade for the machine. + DesiredVersion *string `json:"desiredVersion,omitempty"` + + // Specifies if RSM should try to upgrade this machine + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + + // READ-ONLY; Failure message of last upgrade attempt if any. + LastAttemptMessage *string `json:"lastAttemptMessage,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the status of Agent Upgrade. + LastAttemptStatus *LastAttemptStatusEnum `json:"lastAttemptStatus,omitempty" azure:"ro"` + + // READ-ONLY; Timestamp of last upgrade attempt + LastAttemptTimestamp *string `json:"lastAttemptTimestamp,omitempty" azure:"ro"` +} + +// 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 `json:"critical,omitempty" azure:"ro"` + + // READ-ONLY; Number of definition patches available for installation. + Definition *int32 `json:"definition,omitempty" azure:"ro"` + + // READ-ONLY; Number of feature pack patches available for installation. + FeaturePack *int32 `json:"featurePack,omitempty" azure:"ro"` + + // READ-ONLY; Number of other patches available for installation. + Other *int32 `json:"other,omitempty" azure:"ro"` + + // READ-ONLY; Number of security patches available for installation. + Security *int32 `json:"security,omitempty" azure:"ro"` + + // READ-ONLY; Number of service pack patches available for installation. + ServicePack *int32 `json:"servicePack,omitempty" azure:"ro"` + + // READ-ONLY; Number of tools patches available for installation. + Tools *int32 `json:"tools,omitempty" azure:"ro"` + + // READ-ONLY; Number of update Rollup patches available for installation. + UpdateRollup *int32 `json:"updateRollup,omitempty" azure:"ro"` + + // READ-ONLY; Number of updates category patches available for installation. + Updates *int32 `json:"updates,omitempty" azure:"ro"` +} + // CloudMetadata - The metadata of the cloud environment (Azure/GCP/AWS/OCI…). type CloudMetadata struct { // READ-ONLY; Specifies the cloud provider (Azure/AWS/GCP…). @@ -70,7 +126,7 @@ type ConnectionDetail struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -94,6 +150,24 @@ type ErrorDetail struct { Target *string `json:"target,omitempty" azure:"ro"` } +// ErrorDetailAutoGenerated - The error detail. +type ErrorDetailAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetailAutoGenerated `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + // 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 { @@ -101,12 +175,77 @@ type ErrorResponse struct { Error *ErrorDetail `json:"error,omitempty"` } +// ErrorResponseAutoGenerated - 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 ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetailAutoGenerated `json:"error,omitempty"` +} + +// 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 +} + // ExtensionTargetProperties - Describes the Machine Extension Target Version Properties type ExtensionTargetProperties struct { // Properties for the specified Extension to Upgrade. TargetVersion *string `json:"targetVersion,omitempty"` } +// ExtensionValue - Describes a Extension Metadata +type ExtensionValue struct { + // The single extension based on search criteria + Properties *ExtensionValueProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExtensionValueListResult - The List Extension Metadata response. +type ExtensionValueListResult struct { + // READ-ONLY; The list of extension metadata + Value []*ExtensionValue `json:"value,omitempty" azure:"ro"` +} + +// ExtensionValueProperties - Describes Extension Metadata properties +type ExtensionValueProperties struct { + // READ-ONLY; The type of the Extension being received. + ExtensionType *string `json:"extensionType,omitempty" azure:"ro"` + + // READ-ONLY; The publisher of the Extension being received. + Publisher *string `json:"publisher,omitempty" azure:"ro"` + + // READ-ONLY; The version of the Extension being received. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// IPAddress - Describes properties of the IP address. +type IPAddress struct { + // Represents the IP Address. + Address *string `json:"address,omitempty"` + + // Represents the Ip Address Version. + IPAddressVersion *string `json:"ipAddressVersion,omitempty"` + + // READ-ONLY; The subnet to which this IP address belongs. + Subnet *Subnet `json:"subnet,omitempty" azure:"ro"` +} + // Identity for the resource. type Identity struct { // The identity type. @@ -119,6 +258,18 @@ type Identity struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } +// 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 `json:"classificationsToInclude,omitempty"` + + // packages to exclude in the patch operation. Format: packageName_packageVersion + PackageNameMasksToExclude []*string `json:"packageNameMasksToExclude,omitempty"` + + // packages to include in the patch operation. Format: packageName_packageVersion + PackageNameMasksToInclude []*string `json:"packageNameMasksToInclude,omitempty"` +} + // LocationData - Metadata pertaining to the geographic location of the resource. type LocationData struct { // REQUIRED; A canonical name for the geographic or physical location. @@ -154,13 +305,52 @@ type Machine struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; The list of extensions affiliated to the machine + Resources []*MachineExtension `json:"resources,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// MachineAssessPatchesResult - Describes the properties of an AssessPatches result. +type MachineAssessPatchesResult struct { + // Summarization of patches available for installation on the machine by classification. + AvailablePatchCountByClassification *AvailablePatchCountByClassification `json:"availablePatchCountByClassification,omitempty"` + + // READ-ONLY; The activity ID of the operation that produced this result. + AssessmentActivityID *string `json:"assessmentActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + ErrorDetails *ErrorDetail `json:"errorDetails,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` + + // READ-ONLY; The operating system type of the machine. + OSType *OsType `json:"osType,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed `json:"patchServiceUsed,omitempty" azure:"ro"` + + // 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 `json:"rebootPending,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time `json:"startDateTime,omitempty" azure:"ro"` + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy `json:"startedBy,omitempty" azure:"ro"` + + // 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 `json:"status,omitempty" azure:"ro"` +} + // MachineExtension - Describes a Machine Extension. type MachineExtension struct { // REQUIRED; The geo-location where the resource lives @@ -178,7 +368,7 @@ type MachineExtension struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -235,13 +425,13 @@ type MachineExtensionProperties struct { InstanceView *MachineExtensionInstanceView `json:"instanceView,omitempty"` // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + ProtectedSettings map[string]any `json:"protectedSettings,omitempty"` // The name of the extension handler publisher. Publisher *string `json:"publisher,omitempty"` // Json formatted public settings for the extension. - Settings interface{} `json:"settings,omitempty"` + Settings map[string]any `json:"settings,omitempty"` // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string `json:"type,omitempty"` @@ -269,17 +459,20 @@ type MachineExtensionUpdateProperties struct { // with this property set to true. AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + // How the extension handler should be forced to update even if the extension configuration has not changed. ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + ProtectedSettings map[string]any `json:"protectedSettings,omitempty"` // The name of the extension handler publisher. Publisher *string `json:"publisher,omitempty"` // Json formatted public settings for the extension. - Settings interface{} `json:"settings,omitempty"` + Settings map[string]any `json:"settings,omitempty"` // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string `json:"type,omitempty"` @@ -288,7 +481,7 @@ type MachineExtensionUpdateProperties struct { TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` } -// 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 `json:"extensionTargets,omitempty"` @@ -320,7 +513,7 @@ type MachineExtensionsClientGetOptions struct { // placeholder for future optional parameters } -// MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.List method. +// MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager method. type MachineExtensionsClientListOptions struct { // The expand expression to apply on the operation. Expand *string @@ -335,6 +528,72 @@ type MachineExtensionsListResult struct { Value []*MachineExtension `json:"value,omitempty"` } +// 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 `json:"maximumDuration,omitempty"` + + // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. + RebootSetting *VMGuestPatchRebootSetting `json:"rebootSetting,omitempty"` + + // Input for InstallPatches on a Linux VM, as directly received by the API + LinuxParameters *LinuxParameters `json:"linuxParameters,omitempty"` + + // Input for InstallPatches on a Windows VM, as directly received by the API + WindowsParameters *WindowsParameters `json:"windowsParameters,omitempty"` +} + +// 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 `json:"errorDetails,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. + ExcludedPatchCount *int32 `json:"excludedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. + FailedPatchCount *int32 `json:"failedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The activity ID of the operation that produced this result. + InstallationActivityID *string `json:"installationActivityId,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches successfully installed. + InstalledPatchCount *int32 `json:"installedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` + + // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty" azure:"ro"` + + // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. + NotSelectedPatchCount *int32 `json:"notSelectedPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The operating system type of the machine. + OSType *OsType `json:"osType,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed `json:"patchServiceUsed,omitempty" azure:"ro"` + + // 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 `json:"pendingPatchCount,omitempty" azure:"ro"` + + // READ-ONLY; The reboot state of the VM following completion of the operation. + RebootStatus *VMGuestPatchRebootStatus `json:"rebootStatus,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time `json:"startDateTime,omitempty" azure:"ro"` + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy `json:"startedBy,omitempty" azure:"ro"` + + // 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 `json:"status,omitempty" azure:"ro"` +} + // MachineListResult - The List hybrid machine operation response. type MachineListResult struct { // REQUIRED; The list of hybrid machines. @@ -346,13 +605,16 @@ 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 `json:"agentUpgrade,omitempty"` + // Public Key that the client provides to be used during initial resource onboarding ClientPublicKey *string `json:"clientPublicKey,omitempty"` // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata `json:"cloudMetadata,omitempty"` - // Machine Extensions information + // Machine Extensions information (deprecated field) Extensions []*MachineExtensionInstanceView `json:"extensions,omitempty"` // Metadata pertaining to the geographic location of the resource. @@ -442,6 +704,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 `json:"agentUpgrade,omitempty"` + // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata `json:"cloudMetadata,omitempty"` @@ -458,6 +723,18 @@ type MachineUpdateProperties struct { PrivateLinkScopeResourceID *string `json:"privateLinkScopeResourceId,omitempty"` } +// 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 @@ -474,12 +751,14 @@ type MachinesClientGetOptions struct { Expand *InstanceViewTypes } -// MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.ListByResourceGroup method. +// MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager +// method. type MachinesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.ListBySubscription method. +// MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager +// method. type MachinesClientListBySubscriptionOptions struct { // placeholder for future optional parameters } @@ -496,6 +775,23 @@ type ManagementClientBeginUpgradeExtensionsOptions struct { ResumeToken string } +// NetworkInterface - Describes a network interface. +type NetworkInterface struct { + // The list of IP addresses in this interface. + IPAddresses []*IPAddress `json:"ipAddresses,omitempty"` +} + +// NetworkProfile - Describes the network information on this machine. +type NetworkProfile struct { + // The list of network interfaces. + NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` +} + +// NetworkProfileClientGetOptions contains the optional parameters for the NetworkProfileClient.Get method. +type NetworkProfileClientGetOptions struct { + // placeholder for future optional parameters +} + // OSProfile - Specifies the operating system settings for the hybrid machine. type OSProfile struct { // Specifies the linux configuration for update management. @@ -556,7 +852,7 @@ type OperationValueDisplay struct { Resource *string `json:"resource,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -581,7 +877,7 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -647,7 +943,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope +// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager // method. type PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions struct { // placeholder for future optional parameters @@ -670,7 +966,7 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -703,7 +999,7 @@ type PrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope +// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager // method. type PrivateLinkResourcesClientListByPrivateLinkScopeOptions struct { // placeholder for future optional parameters @@ -801,13 +1097,13 @@ type PrivateLinkScopesClientGetValidationDetailsOptions struct { // placeholder for future optional parameters } -// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.ListByResourceGroup +// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager // method. type PrivateLinkScopesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.List method. +// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager method. type PrivateLinkScopesClientListOptions struct { // placeholder for future optional parameters } @@ -856,6 +1152,9 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -868,6 +1167,9 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -896,6 +1198,12 @@ type ServiceStatuses struct { GuestConfigurationService *ServiceStatus `json:"guestConfigurationService,omitempty"` } +// Subnet - Describes the subnet. +type Subnet struct { + // Represents address prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -939,6 +1247,27 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } + +// 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 `json:"classificationsToInclude,omitempty"` + + // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + ExcludeKbsRequiringReboot *bool `json:"excludeKbsRequiringReboot,omitempty"` + + // Kbs to exclude in the patch operation + KbNumbersToExclude []*string `json:"kbNumbersToExclude,omitempty"` + + // Kbs to include in the patch operation + KbNumbersToInclude []*string `json:"kbNumbersToInclude,omitempty"` + + // This is used to install patches that were published on or before this given max published date. + MaxPatchPublishDate *time.Time `json:"maxPatchPublishDate,omitempty"` +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go new file mode 100644 index 000000000000..ad47dc2198f0 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go @@ -0,0 +1,2737 @@ +//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 + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// 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) + populate(objectMap, "guestConfigurationEnabled", a.GuestConfigurationEnabled) + populate(objectMap, "incomingConnectionsPorts", a.IncomingConnectionsPorts) + populate(objectMap, "proxyBypass", a.ProxyBypass) + populate(objectMap, "proxyUrl", a.ProxyURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentConfiguration. +func (a *AgentConfiguration) 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 "configMode": + err = unpopulate(val, "ConfigMode", &a.ConfigMode) + delete(rawMsg, key) + case "extensionsAllowList": + err = unpopulate(val, "ExtensionsAllowList", &a.ExtensionsAllowList) + delete(rawMsg, key) + case "extensionsBlockList": + err = unpopulate(val, "ExtensionsBlockList", &a.ExtensionsBlockList) + delete(rawMsg, key) + case "extensionsEnabled": + err = unpopulate(val, "ExtensionsEnabled", &a.ExtensionsEnabled) + delete(rawMsg, key) + case "guestConfigurationEnabled": + err = unpopulate(val, "GuestConfigurationEnabled", &a.GuestConfigurationEnabled) + delete(rawMsg, key) + case "incomingConnectionsPorts": + err = unpopulate(val, "IncomingConnectionsPorts", &a.IncomingConnectionsPorts) + delete(rawMsg, key) + case "proxyBypass": + err = unpopulate(val, "ProxyBypass", &a.ProxyBypass) + delete(rawMsg, key) + case "proxyUrl": + err = unpopulate(val, "ProxyURL", &a.ProxyURL) + 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 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, "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 "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 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) + populate(objectMap, "provider", c.Provider) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudMetadata. +func (c *CloudMetadata) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provider": + err = unpopulate(val, "Provider", &c.Provider) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationExtension. +func (c ConfigurationExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationExtension. +func (c *ConfigurationExtension) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publisher": + err = unpopulate(val, "Publisher", &c.Publisher) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionDetail. +func (c ConnectionDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", c.GroupID) + populate(objectMap, "id", c.ID) + populate(objectMap, "linkIdentifier", c.LinkIdentifier) + populate(objectMap, "memberName", c.MemberName) + populate(objectMap, "privateIpAddress", c.PrivateIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionDetail. +func (c *ConnectionDetail) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &c.GroupID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &c.LinkIdentifier) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &c.MemberName) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &c.PrivateIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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 "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + 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 ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + 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 ErrorDetailAutoGenerated. +func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. +func (e *ErrorDetailAutoGenerated) 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 "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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 "error": + err = unpopulate(val, "Error", &e.Error) + 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 ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) 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 "error": + err = unpopulate(val, "Error", &e.Error) + 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 ExtensionTargetProperties. +func (e ExtensionTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetVersion", e.TargetVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTargetProperties. +func (e *ExtensionTargetProperties) 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 "targetVersion": + err = unpopulate(val, "TargetVersion", &e.TargetVersion) + 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 ExtensionValue. +func (e ExtensionValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + 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", &e.Type) + 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 ExtensionValueListResult. +func (e ExtensionValueListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + 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 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 "publisher": + err = unpopulate(val, "Publisher", &e.Publisher) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) + 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 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 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, "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 "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) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", m.LastModifiedDateTime) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "patchServiceUsed", m.PatchServiceUsed) + populate(objectMap, "rebootPending", m.RebootPending) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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 MachineExtension. +func (m MachineExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + 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) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtension. +func (m *MachineExtension) 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 "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 "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 MachineExtensionInstanceView. +func (m MachineExtensionInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "status", m.Status) + populate(objectMap, "type", m.Type) + populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceView. +func (m *MachineExtensionInstanceView) 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 "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) + 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 MachineExtensionInstanceViewStatus. +func (m MachineExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", m.Code) + populate(objectMap, "displayStatus", m.DisplayStatus) + populate(objectMap, "level", m.Level) + populate(objectMap, "message", m.Message) + populateTimeRFC3339(objectMap, "time", m.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceViewStatus. +func (m *MachineExtensionInstanceViewStatus) 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 "code": + err = unpopulate(val, "Code", &m.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &m.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &m.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &m.Message) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &m.Time) + 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 MachineExtensionProperties. +func (m MachineExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) + populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) + populate(objectMap, "instanceView", m.InstanceView) + populate(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "publisher", m.Publisher) + populate(objectMap, "settings", m.Settings) + populate(objectMap, "type", m.Type) + populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionProperties. +func (m *MachineExtensionProperties) 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 "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) + case "instanceView": + err = unpopulate(val, "InstanceView", &m.InstanceView) + delete(rawMsg, key) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &m.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &m.Settings) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) + 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 MachineExtensionUpdate. +func (m MachineExtensionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdate. +func (m *MachineExtensionUpdate) 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 "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + 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 MachineExtensionUpdateProperties. +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) + populate(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "publisher", m.Publisher) + populate(objectMap, "settings", m.Settings) + populate(objectMap, "type", m.Type) + populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpdateProperties. +func (m *MachineExtensionUpdateProperties) 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 "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) + case "protectedSettings": + err = unpopulate(val, "ProtectedSettings", &m.ProtectedSettings) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &m.Publisher) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &m.Settings) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "typeHandlerVersion": + err = unpopulate(val, "TypeHandlerVersion", &m.TypeHandlerVersion) + 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 MachineExtensionUpgrade. +func (m MachineExtensionUpgrade) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extensionTargets", m.ExtensionTargets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionUpgrade. +func (m *MachineExtensionUpgrade) 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 "extensionTargets": + err = unpopulate(val, "ExtensionTargets", &m.ExtensionTargets) + 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 MachineExtensionsListResult. +func (m MachineExtensionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionsListResult. +func (m *MachineExtensionsListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + 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 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) + populateTimeRFC3339(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) + populateTimeRFC3339(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 = unpopulateTimeRFC3339(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 = unpopulateTimeRFC3339(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) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineListResult. +func (m *MachineListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + 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 MachineProperties. +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) + populate(objectMap, "dnsFqdn", m.DNSFqdn) + populate(objectMap, "detectedProperties", m.DetectedProperties) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "domainName", m.DomainName) + populate(objectMap, "errorDetails", m.ErrorDetails) + populate(objectMap, "extensions", m.Extensions) + populateTimeRFC3339(objectMap, "lastStatusChange", m.LastStatusChange) + populate(objectMap, "locationData", m.LocationData) + populate(objectMap, "machineFqdn", m.MachineFqdn) + populate(objectMap, "mssqlDiscovered", m.MssqlDiscovered) + populate(objectMap, "osName", m.OSName) + populate(objectMap, "osProfile", m.OSProfile) + populate(objectMap, "osSku", m.OSSKU) + populate(objectMap, "osType", m.OSType) + populate(objectMap, "osVersion", m.OSVersion) + populate(objectMap, "parentClusterResourceId", m.ParentClusterResourceID) + populate(objectMap, "privateLinkScopeResourceId", m.PrivateLinkScopeResourceID) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "serviceStatuses", m.ServiceStatuses) + populate(objectMap, "status", m.Status) + populate(objectMap, "vmId", m.VMID) + populate(objectMap, "vmUuid", m.VMUUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. +func (m *MachineProperties) 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 "adFqdn": + err = unpopulate(val, "AdFqdn", &m.AdFqdn) + delete(rawMsg, key) + 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) + case "clientPublicKey": + err = unpopulate(val, "ClientPublicKey", &m.ClientPublicKey) + delete(rawMsg, key) + case "cloudMetadata": + err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) + delete(rawMsg, key) + case "dnsFqdn": + err = unpopulate(val, "DNSFqdn", &m.DNSFqdn) + delete(rawMsg, key) + case "detectedProperties": + err = unpopulate(val, "DetectedProperties", &m.DetectedProperties) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &m.DomainName) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &m.Extensions) + delete(rawMsg, key) + case "lastStatusChange": + err = unpopulateTimeRFC3339(val, "LastStatusChange", &m.LastStatusChange) + delete(rawMsg, key) + case "locationData": + err = unpopulate(val, "LocationData", &m.LocationData) + delete(rawMsg, key) + case "machineFqdn": + err = unpopulate(val, "MachineFqdn", &m.MachineFqdn) + delete(rawMsg, key) + case "mssqlDiscovered": + err = unpopulate(val, "MssqlDiscovered", &m.MssqlDiscovered) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &m.OSName) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &m.OSProfile) + delete(rawMsg, key) + case "osSku": + err = unpopulate(val, "OSSKU", &m.OSSKU) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &m.OSType) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &m.OSVersion) + delete(rawMsg, key) + case "parentClusterResourceId": + err = unpopulate(val, "ParentClusterResourceID", &m.ParentClusterResourceID) + delete(rawMsg, key) + case "privateLinkScopeResourceId": + err = unpopulate(val, "PrivateLinkScopeResourceID", &m.PrivateLinkScopeResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "serviceStatuses": + err = unpopulate(val, "ServiceStatuses", &m.ServiceStatuses) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &m.VMID) + delete(rawMsg, key) + case "vmUuid": + err = unpopulate(val, "VMUUID", &m.VMUUID) + 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 MachineUpdate. +func (m MachineUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineUpdate. +func (m *MachineUpdate) 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 "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + 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 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) + populate(objectMap, "parentClusterResourceId", m.ParentClusterResourceID) + populate(objectMap, "privateLinkScopeResourceId", m.PrivateLinkScopeResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineUpdateProperties. +func (m *MachineUpdateProperties) 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 "agentUpgrade": + err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) + delete(rawMsg, key) + case "cloudMetadata": + err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) + delete(rawMsg, key) + case "locationData": + err = unpopulate(val, "LocationData", &m.LocationData) + delete(rawMsg, key) + case "osProfile": + err = unpopulate(val, "OSProfile", &m.OSProfile) + delete(rawMsg, key) + case "parentClusterResourceId": + err = unpopulate(val, "ParentClusterResourceID", &m.ParentClusterResourceID) + delete(rawMsg, key) + case "privateLinkScopeResourceId": + err = unpopulate(val, "PrivateLinkScopeResourceID", &m.PrivateLinkScopeResourceID) + 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 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) + populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "linuxConfiguration", o.LinuxConfiguration) + populate(objectMap, "windowsConfiguration", o.WindowsConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfile. +func (o *OSProfile) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "computerName": + err = unpopulate(val, "ComputerName", &o.ComputerName) + delete(rawMsg, key) + case "linuxConfiguration": + err = unpopulate(val, "LinuxConfiguration", &o.LinuxConfiguration) + delete(rawMsg, key) + case "windowsConfiguration": + err = unpopulate(val, "WindowsConfiguration", &o.WindowsConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSProfileLinuxConfiguration. +func (o OSProfileLinuxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "patchSettings", o.PatchSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfileLinuxConfiguration. +func (o *OSProfileLinuxConfiguration) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "patchSettings": + err = unpopulate(val, "PatchSettings", &o.PatchSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OSProfileWindowsConfiguration. +func (o OSProfileWindowsConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "patchSettings", o.PatchSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OSProfileWindowsConfiguration. +func (o *OSProfileWindowsConfiguration) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "patchSettings": + err = unpopulate(val, "PatchSettings", &o.PatchSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationValue. +func (o OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationValue. +func (o *OperationValue) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationValueDisplay. +func (o OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationValueDisplay. +func (o *OperationValueDisplay) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchSettings. +func (p PatchSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assessmentMode", p.AssessmentMode) + populate(objectMap, "patchMode", p.PatchMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchSettings. +func (p *PatchSettings) 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 "assessmentMode": + err = unpopulate(val, "AssessmentMode", &p.AssessmentMode) + delete(rawMsg, key) + case "patchMode": + err = unpopulate(val, "PatchMode", &p.PatchMode) + 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 PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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 PrivateEndpointConnectionDataModel. +func (p PrivateEndpointConnectionDataModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionDataModel. +func (p *PrivateEndpointConnectionDataModel) 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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + 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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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 "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + 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 PrivateEndpointProperty. +func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. +func (p *PrivateEndpointProperty) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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 PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + 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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + 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 PrivateLinkScope. +func (p PrivateLinkScope) 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, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScope. +func (p *PrivateLinkScope) 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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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 PrivateLinkScopeListResult. +func (p PrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeListResult. +func (p *PrivateLinkScopeListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + 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 PrivateLinkScopeProperties. +func (p PrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "privateLinkScopeId", p.PrivateLinkScopeID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeProperties. +func (p *PrivateLinkScopeProperties) 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 "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "privateLinkScopeId": + err = unpopulate(val, "PrivateLinkScopeID", &p.PrivateLinkScopeID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + 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 PrivateLinkScopeValidationDetails. +func (p PrivateLinkScopeValidationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionDetails", p.ConnectionDetails) + populate(objectMap, "id", p.ID) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopeValidationDetails. +func (p *PrivateLinkScopeValidationDetails) 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 "connectionDetails": + err = unpopulate(val, "ConnectionDetails", &p.ConnectionDetails) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + 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 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) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) 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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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, "systemData", r.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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) + populate(objectMap, "startupType", s.StartupType) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceStatus. +func (s *ServiceStatus) 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 "startupType": + err = unpopulate(val, "StartupType", &s.StartupType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 ServiceStatuses. +func (s ServiceStatuses) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extensionService", s.ExtensionService) + populate(objectMap, "guestConfigurationService", s.GuestConfigurationService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceStatuses. +func (s *ServiceStatuses) 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 "extensionService": + err = unpopulate(val, "ExtensionService", &s.ExtensionService) + delete(rawMsg, key) + case "guestConfigurationService": + err = unpopulate(val, "GuestConfigurationService", &s.GuestConfigurationService) + 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 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) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) 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, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WindowsParameters. +func (w WindowsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "classificationsToInclude", w.ClassificationsToInclude) + populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) + populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) + populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) + populateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) + return json.Marshal(objectMap) +} + +// 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &w.ClassificationsToInclude) + delete(rawMsg, key) + case "excludeKbsRequiringReboot": + err = unpopulate(val, "ExcludeKbsRequiringReboot", &w.ExcludeKbsRequiringReboot) + delete(rawMsg, key) + case "kbNumbersToExclude": + err = unpopulate(val, "KbNumbersToExclude", &w.KbNumbersToExclude) + delete(rawMsg, key) + case "kbNumbersToInclude": + err = unpopulate(val, "KbNumbersToInclude", &w.KbNumbersToInclude) + delete(rawMsg, key) + case "maxPatchPublishDate": + err = unpopulateTimeRFC3339(val, "MaxPatchPublishDate", &w.MaxPatchPublishDate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, 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..450b1dcb6e08 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go @@ -0,0 +1,102 @@ +//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 + +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+".NetworkProfileClient", 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 2022-12-27 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkProfileClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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", "2022-12-27") + 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/zz_generated_operations_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go similarity index 74% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_operations_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go index a14ab16df364..8fb093dd23a8 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_operations_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go @@ -5,6 +5,7 @@ // 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 @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Gets a list of hybrid compute operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2022-12-27 +// - 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]{ More: func(page OperationsClientListResponse) bool { @@ -62,7 +52,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -77,12 +67,12 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.HybridCompute/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go similarity index 81% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go index 17f93ac2e8e9..095ff0788e7b 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,64 +24,57 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. type PrivateEndpointConnectionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient 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. +// - 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateEndpointConnectionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // 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 -// 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. -// options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -111,12 +103,12 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -124,33 +116,35 @@ 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 -// 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. -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -179,12 +173,12 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,18 +186,19 @@ 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 -// 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. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -232,12 +227,12 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,12 +248,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// 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.ListByPrivateLinkScope -// method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *PrivateEndpointConnectionsClient) NewListByPrivateLinkScopePager(resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse]{ More: func(page PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse) bool { @@ -275,7 +270,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByPrivateLinkScopePager(r if err != nil { return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err } @@ -302,12 +297,12 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go similarity index 80% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go index 13acf6e0d8ef..dc7d7b23eba3 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,49 +24,41 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. type PrivateLinkResourcesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient 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. +// - 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 NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkResourcesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // 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 -// 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. -// options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -96,12 +87,12 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter groupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,12 +108,12 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) } // NewListByPrivateLinkScopePager - 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 -// 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.ListByPrivateLinkScope -// method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *PrivateLinkResourcesClient) NewListByPrivateLinkScopePager(resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) *runtime.Pager[PrivateLinkResourcesClientListByPrivateLinkScopeResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByPrivateLinkScopeResponse]{ More: func(page PrivateLinkResourcesClientListByPrivateLinkScopeResponse) bool { @@ -139,7 +130,7 @@ func (client *PrivateLinkResourcesClient) NewListByPrivateLinkScopePager(resourc if err != nil { return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err } @@ -166,12 +157,12 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkscopes_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go similarity index 83% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkscopes_client.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go index 065152525d90..bea6ce34494e 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_privatelinkscopes_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go @@ -5,6 +5,7 @@ // 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 @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,31 +24,22 @@ import ( // PrivateLinkScopesClient contains the methods for the PrivateLinkScopes group. // Don't use this type directly, use NewPrivateLinkScopesClient() instead. type PrivateLinkScopesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient 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. +// - 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 NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PrivateLinkScopesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PrivateLinkScopesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } @@ -57,18 +47,19 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey // nor AppId in the Put operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// 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. -// options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate +// method. func (client *PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, parameters PrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, parameters, options) if err != nil { return PrivateLinkScopesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientCreateOrUpdateResponse{}, err } @@ -93,12 +84,12 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -115,32 +106,34 @@ 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 -// 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 -// method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, options) if err != nil { return nil, err } - return runtime.NewPoller[PrivateLinkScopesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller[PrivateLinkScopesClientDeleteResponse](resp, client.internal.Pipeline(), nil) } else { - return runtime.NewPollerFromResumeToken[PrivateLinkScopesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PrivateLinkScopesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // 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 2022-12-27 func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -165,12 +158,12 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,16 +171,17 @@ 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 -// 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. +// +// Generated from API version 2022-12-27 +// - 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. func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (PrivateLinkScopesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { return PrivateLinkScopesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetResponse{}, err } @@ -212,12 +206,12 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,17 +228,18 @@ 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 -// 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 -// method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *PrivateLinkScopesClient) GetValidationDetails(ctx context.Context, location string, privateLinkScopeID string, options *PrivateLinkScopesClientGetValidationDetailsOptions) (PrivateLinkScopesClientGetValidationDetailsResponse, error) { req, err := client.getValidationDetailsCreateRequest(ctx, location, privateLinkScopeID, options) if err != nil { return PrivateLinkScopesClientGetValidationDetailsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetValidationDetailsResponse{}, err } @@ -269,12 +264,12 @@ func (client *PrivateLinkScopesClient) getValidationDetailsCreateRequest(ctx con return nil, errors.New("parameter privateLinkScopeID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateLinkScopeId}", url.PathEscape(privateLinkScopeID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,17 +286,18 @@ 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 -// 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 -// method. +// +// Generated from API version 2022-12-27 +// - 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 +// method. func (client *PrivateLinkScopesClient) GetValidationDetailsForMachine(ctx context.Context, resourceGroupName string, machineName string, options *PrivateLinkScopesClientGetValidationDetailsForMachineOptions) (PrivateLinkScopesClientGetValidationDetailsForMachineResponse, error) { req, err := client.getValidationDetailsForMachineCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, err } @@ -326,12 +322,12 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineCreateReque 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,9 +343,10 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineHandleRespo } // NewListPager - Gets a list of all Azure Arc PrivateLinkScopes within a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.List method. +// +// Generated from API version 2022-12-27 +// - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager +// method. func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListResponse]{ More: func(page PrivateLinkScopesClientListResponse) bool { @@ -366,7 +363,7 @@ func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesCl if err != nil { return PrivateLinkScopesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientListResponse{}, err } @@ -385,12 +382,12 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -406,11 +403,11 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Gets a list of Azure Arc PrivateLinkScopes within a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-10 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-12-27 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager +// method. func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) *runtime.Pager[PrivateLinkScopesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListByResourceGroupResponse]{ More: func(page PrivateLinkScopesClientListByResourceGroupResponse) bool { @@ -427,7 +424,7 @@ func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroup if err != nil { return PrivateLinkScopesClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientListByResourceGroupResponse{}, err } @@ -450,12 +447,12 @@ func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx cont 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.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -472,18 +469,19 @@ 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 -// 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. -// options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags -// method. +// +// Generated from API version 2022-12-27 +// - 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. +// - options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags +// method. func (client *PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (PrivateLinkScopesClientUpdateTagsResponse, error) { req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, scopeName, privateLinkScopeTags, options) if err != nil { return PrivateLinkScopesClientUpdateTagsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientUpdateTagsResponse{}, err } @@ -508,12 +506,12 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte return nil, errors.New("parameter scopeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-03-10") + reqQP.Set("api-version", "2022-12-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateLinkScopeTags) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_response_types.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go similarity index 73% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_response_types.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go index 5bac5a763a3c..bb08fa4b9673 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_response_types.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go @@ -5,15 +5,26 @@ // 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 -// MachineExtensionsClientCreateOrUpdateResponse contains the response from method MachineExtensionsClient.CreateOrUpdate. +// ExtensionMetadataClientGetResponse contains the response from method ExtensionMetadataClient.Get. +type ExtensionMetadataClientGetResponse struct { + ExtensionValue +} + +// ExtensionMetadataClientListResponse contains the response from method ExtensionMetadataClient.NewListPager. +type ExtensionMetadataClientListResponse struct { + ExtensionValueListResult +} + +// MachineExtensionsClientCreateOrUpdateResponse contains the response from method MachineExtensionsClient.BeginCreateOrUpdate. type MachineExtensionsClientCreateOrUpdateResponse struct { MachineExtension } -// MachineExtensionsClientDeleteResponse contains the response from method MachineExtensionsClient.Delete. +// MachineExtensionsClientDeleteResponse contains the response from method MachineExtensionsClient.BeginDelete. type MachineExtensionsClientDeleteResponse struct { // placeholder for future response values } @@ -23,16 +34,21 @@ type MachineExtensionsClientGetResponse struct { MachineExtension } -// MachineExtensionsClientListResponse contains the response from method MachineExtensionsClient.List. +// MachineExtensionsClientListResponse contains the response from method MachineExtensionsClient.NewListPager. type MachineExtensionsClientListResponse struct { MachineExtensionsListResult } -// MachineExtensionsClientUpdateResponse contains the response from method MachineExtensionsClient.Update. +// MachineExtensionsClientUpdateResponse contains the response from method MachineExtensionsClient.BeginUpdate. type MachineExtensionsClientUpdateResponse struct { MachineExtension } +// MachinesClientAssessPatchesResponse contains the response from method MachinesClient.BeginAssessPatches. +type MachinesClientAssessPatchesResponse struct { + MachineAssessPatchesResult +} + // MachinesClientCreateOrUpdateResponse contains the response from method MachinesClient.CreateOrUpdate. type MachinesClientCreateOrUpdateResponse struct { Machine @@ -48,12 +64,17 @@ type MachinesClientGetResponse struct { Machine } -// MachinesClientListByResourceGroupResponse contains the response from method MachinesClient.ListByResourceGroup. +// MachinesClientInstallPatchesResponse contains the response from method MachinesClient.BeginInstallPatches. +type MachinesClientInstallPatchesResponse struct { + MachineInstallPatchesResult +} + +// MachinesClientListByResourceGroupResponse contains the response from method MachinesClient.NewListByResourceGroupPager. type MachinesClientListByResourceGroupResponse struct { MachineListResult } -// MachinesClientListBySubscriptionResponse contains the response from method MachinesClient.ListBySubscription. +// MachinesClientListBySubscriptionResponse contains the response from method MachinesClient.NewListBySubscriptionPager. type MachinesClientListBySubscriptionResponse struct { MachineListResult } @@ -63,22 +84,27 @@ type MachinesClientUpdateResponse struct { Machine } -// ManagementClientUpgradeExtensionsResponse contains the response from method ManagementClient.UpgradeExtensions. +// ManagementClientUpgradeExtensionsResponse contains the response from method ManagementClient.BeginUpgradeExtensions. type ManagementClientUpgradeExtensionsResponse struct { // placeholder for future response values } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// NetworkProfileClientGetResponse contains the response from method NetworkProfileClient.Get. +type NetworkProfileClientGetResponse struct { + NetworkProfile +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. +// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values } @@ -88,7 +114,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.ListByPrivateLinkScope. +// PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager. type PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse struct { PrivateEndpointConnectionListResult } @@ -98,7 +124,7 @@ type PrivateLinkResourcesClientGetResponse struct { PrivateLinkResource } -// PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.ListByPrivateLinkScope. +// PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.NewListByPrivateLinkScopePager. type PrivateLinkResourcesClientListByPrivateLinkScopeResponse struct { PrivateLinkResourceListResult } @@ -108,7 +134,7 @@ type PrivateLinkScopesClientCreateOrUpdateResponse struct { PrivateLinkScope } -// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.Delete. +// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.BeginDelete. type PrivateLinkScopesClientDeleteResponse struct { // placeholder for future response values } @@ -128,12 +154,12 @@ type PrivateLinkScopesClientGetValidationDetailsResponse struct { PrivateLinkScopeValidationDetails } -// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.ListByResourceGroup. +// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. type PrivateLinkScopesClientListByResourceGroupResponse struct { PrivateLinkScopeListResult } -// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.List. +// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. type PrivateLinkScopesClientListResponse struct { PrivateLinkScopeListResult } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_time_rfc3339.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go index 373fd56188c5..11928484add6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_hybridcomputemanagementclient_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_hybridcomputemanagementclient_client_test.go deleted file mode 100644 index f26711e3cd19..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_hybridcomputemanagementclient_client_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Extensions_Upgrade.json -func ExampleManagementClient_BeginUpgradeExtensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewManagementClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpgradeExtensions(ctx, - "myResourceGroup", - "myMachine", - armhybridcompute.MachineExtensionUpgrade{ - ExtensionTargets: map[string]*armhybridcompute.ExtensionTargetProperties{ - "Microsoft.Azure.Monitoring": { - TargetVersion: to.Ptr("2.0"), - }, - "Microsoft.Compute.CustomScriptExtension": { - TargetVersion: to.Ptr("1.10"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machineextensions_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machineextensions_client_test.go deleted file mode 100644 index f51d245ab813..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machineextensions_client_test.go +++ /dev/null @@ -1,167 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PUTExtension.json -func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myMachine", - "CustomScriptExtension", - armhybridcompute.MachineExtension{ - Location: to.Ptr("eastus2euap"), - Properties: &armhybridcompute.MachineExtensionProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/UpdateExtension.json -func ExampleMachineExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myMachine", - "CustomScriptExtension", - armhybridcompute.MachineExtensionUpdate{ - Properties: &armhybridcompute.MachineExtensionUpdateProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]interface{}{ - "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"", - }, - TypeHandlerVersion: to.Ptr("1.10"), - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/DELETEExtension.json -func ExampleMachineExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myMachine", - "MMA", - 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/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/GETExtension.json -func ExampleMachineExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMachine", - "CustomScriptExtension", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/LISTExtension.json -func ExampleMachineExtensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachineExtensionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", - "myMachine", - &armhybridcompute.MachineExtensionsClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machines_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machines_client_test.go deleted file mode 100644 index 32415d81b9ef..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_machines_client_test.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_CreateOrUpdate.json -func ExampleMachinesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myResourceGroup", - "myMachine", - armhybridcompute.Machine{ - Location: to.Ptr("eastus2euap"), - Identity: &armhybridcompute.Identity{ - Type: to.Ptr("SystemAssigned"), - }, - Properties: &armhybridcompute.MachineProperties{ - ClientPublicKey: to.Ptr("string"), - LocationData: &armhybridcompute.LocationData{ - Name: to.Ptr("Redmond"), - }, - ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Update.json -func ExampleMachinesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myResourceGroup", - "myMachine", - armhybridcompute.MachineUpdate{ - Identity: &armhybridcompute.Identity{ - Type: to.Ptr("SystemAssigned"), - }, - Properties: &armhybridcompute.MachineUpdateProperties{ - LocationData: &armhybridcompute.LocationData{ - Name: to.Ptr("Redmond"), - }, - OSProfile: &armhybridcompute.OSProfile{ - LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - PatchSettings: &armhybridcompute.PatchSettings{ - AssessmentMode: to.Ptr(armhybridcompute.AssessmentModeTypesImageDefault), - PatchMode: to.Ptr(armhybridcompute.PatchModeTypesManual), - }, - }, - WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - PatchSettings: &armhybridcompute.PatchSettings{ - AssessmentMode: to.Ptr(armhybridcompute.AssessmentModeTypesImageDefault), - PatchMode: to.Ptr(armhybridcompute.PatchModeTypesManual), - }, - }, - }, - ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Delete.json -func ExampleMachinesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myResourceGroup", - "myMachine", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_Get.json -func ExampleMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myMachine", - &armhybridcompute.MachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListByResourceGroup.json -func ExampleMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListBySubscription.json -func ExampleMachinesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewMachinesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_operations_client_test.go deleted file mode 100644 index 6bcbb4743957..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 182e56303d5a..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myPrivateLinkScope", - "private-endpoint-connection-name", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "myPrivateLinkScope", - "private-endpoint-connection-name", - armhybridcompute.PrivateEndpointConnection{ - Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "myPrivateLinkScope", - "private-endpoint-connection-name", - 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/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByPrivateLinkScopePager("myResourceGroup", - "myPrivateLinkScope", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 52a7c904a34e..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByPrivateLinkScopePager("myResourceGroup", - "myPrivateLinkScope", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "myPrivateLinkScope", - "hybridcompute", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkscopes_client_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkscopes_client_test.go deleted file mode 100644 index 758b142b84f0..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/ze_generated_example_privatelinkscopes_client_test.go +++ /dev/null @@ -1,210 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesList.json -func ExamplePrivateLinkScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("my-resource-group", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "my-resource-group", - "my-privatelinkscope", - 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/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGet.json -func ExamplePrivateLinkScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "my-resource-group", - "my-privatelinkscope", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "my-resource-group", - "my-privatelinkscope", - armhybridcompute.PrivateLinkScope{ - Location: to.Ptr("westus"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.UpdateTags(ctx, - "my-resource-group", - "my-privatelinkscope", - armhybridcompute.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidation.json -func ExamplePrivateLinkScopesClient_GetValidationDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetValidationDetails(ctx, - "wus2", - "f5dc51d3-92ed-4d7e-947a-775ea79b4919", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidationForMachine.json -func ExamplePrivateLinkScopesClient_GetValidationDetailsForMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridcompute.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetValidationDetailsForMachine(ctx, - "my-resource-group", - "machineName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_constants.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_constants.go deleted file mode 100644 index 158a80389f2c..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_constants.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armhybridcompute - -const ( - moduleName = "armhybridcompute" - moduleVersion = "v1.0.0" -) - -// AssessmentModeTypes - Specifies the assessment mode. -type AssessmentModeTypes string - -const ( - AssessmentModeTypesAutomaticByPlatform AssessmentModeTypes = "AutomaticByPlatform" - AssessmentModeTypesImageDefault AssessmentModeTypes = "ImageDefault" -) - -// PossibleAssessmentModeTypesValues returns the possible values for the AssessmentModeTypes const type. -func PossibleAssessmentModeTypesValues() []AssessmentModeTypes { - return []AssessmentModeTypes{ - AssessmentModeTypesAutomaticByPlatform, - AssessmentModeTypesImageDefault, - } -} - -// CreatedByType - The type of identity that created the resource. -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{ - CreatedByTypeApplication, - CreatedByTypeKey, - CreatedByTypeManagedIdentity, - CreatedByTypeUser, - } -} - -type InstanceViewTypes string - -const ( - InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" -) - -// PossibleInstanceViewTypesValues returns the possible values for the InstanceViewTypes const type. -func PossibleInstanceViewTypesValues() []InstanceViewTypes { - return []InstanceViewTypes{ - InstanceViewTypesInstanceView, - } -} - -// PatchModeTypes - Specifies the patch mode. -type PatchModeTypes string - -const ( - PatchModeTypesAutomaticByOS PatchModeTypes = "AutomaticByOS" - PatchModeTypesAutomaticByPlatform PatchModeTypes = "AutomaticByPlatform" - PatchModeTypesImageDefault PatchModeTypes = "ImageDefault" - PatchModeTypesManual PatchModeTypes = "Manual" -) - -// PossiblePatchModeTypesValues returns the possible values for the PatchModeTypes const type. -func PossiblePatchModeTypesValues() []PatchModeTypes { - return []PatchModeTypes{ - PatchModeTypesAutomaticByOS, - PatchModeTypesAutomaticByPlatform, - PatchModeTypesImageDefault, - PatchModeTypesManual, - } -} - -// 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 - -const ( - // PublicNetworkAccessTypeDisabled - Does not allow Azure Arc agents to communicate with Azure Arc services over public (internet) - // endpoints. The agents must use the private link. - PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" - // PublicNetworkAccessTypeEnabled - Allows Azure Arc agents to communicate with Azure Arc services over both public (internet) - // and private endpoints. - PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" -) - -// PossiblePublicNetworkAccessTypeValues returns the possible values for the PublicNetworkAccessType const type. -func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { - return []PublicNetworkAccessType{ - PublicNetworkAccessTypeDisabled, - PublicNetworkAccessTypeEnabled, - } -} - -// StatusLevelTypes - The level code. -type StatusLevelTypes string - -const ( - StatusLevelTypesError StatusLevelTypes = "Error" - StatusLevelTypesInfo StatusLevelTypes = "Info" - StatusLevelTypesWarning StatusLevelTypes = "Warning" -) - -// PossibleStatusLevelTypesValues returns the possible values for the StatusLevelTypes const type. -func PossibleStatusLevelTypesValues() []StatusLevelTypes { - return []StatusLevelTypes{ - StatusLevelTypesError, - StatusLevelTypesInfo, - StatusLevelTypesWarning, - } -} - -// StatusTypes - The status of the hybrid machine agent. -type StatusTypes string - -const ( - StatusTypesConnected StatusTypes = "Connected" - StatusTypesDisconnected StatusTypes = "Disconnected" - StatusTypesError StatusTypes = "Error" -) - -// PossibleStatusTypesValues returns the possible values for the StatusTypes const type. -func PossibleStatusTypesValues() []StatusTypes { - return []StatusTypes{ - StatusTypesConnected, - StatusTypesDisconnected, - StatusTypesError, - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models_serde.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models_serde.go deleted file mode 100644 index 7ce822132150..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/zz_generated_models_serde.go +++ /dev/null @@ -1,410 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armhybridcompute - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AgentConfiguration. -func (a AgentConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensionsAllowList", a.ExtensionsAllowList) - populate(objectMap, "extensionsBlockList", a.ExtensionsBlockList) - populate(objectMap, "extensionsEnabled", a.ExtensionsEnabled) - populate(objectMap, "guestConfigurationEnabled", a.GuestConfigurationEnabled) - populate(objectMap, "incomingConnectionsPorts", a.IncomingConnectionsPorts) - populate(objectMap, "proxyBypass", a.ProxyBypass) - populate(objectMap, "proxyUrl", a.ProxyURL) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Machine. -func (m Machine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MachineExtension. -func (m MachineExtension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - 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) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MachineExtensionInstanceViewStatus. -func (m MachineExtensionInstanceViewStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", m.Code) - populate(objectMap, "displayStatus", m.DisplayStatus) - populate(objectMap, "level", m.Level) - populate(objectMap, "message", m.Message) - populateTimeRFC3339(objectMap, "time", m.Time) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineExtensionInstanceViewStatus. -func (m *MachineExtensionInstanceViewStatus) 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 "code": - err = unpopulate(val, "Code", &m.Code) - delete(rawMsg, key) - case "displayStatus": - err = unpopulate(val, "DisplayStatus", &m.DisplayStatus) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &m.Level) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &m.Message) - delete(rawMsg, key) - case "time": - err = unpopulateTimeRFC3339(val, "Time", &m.Time) - 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 MachineExtensionUpdate. -func (m MachineExtensionUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MachineExtensionUpgrade. -func (m MachineExtensionUpgrade) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensionTargets", m.ExtensionTargets) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MachineProperties. -func (m MachineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adFqdn", m.AdFqdn) - populate(objectMap, "agentConfiguration", m.AgentConfiguration) - populate(objectMap, "agentVersion", m.AgentVersion) - populate(objectMap, "clientPublicKey", m.ClientPublicKey) - populate(objectMap, "cloudMetadata", m.CloudMetadata) - populate(objectMap, "dnsFqdn", m.DNSFqdn) - populate(objectMap, "detectedProperties", m.DetectedProperties) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "domainName", m.DomainName) - populate(objectMap, "errorDetails", m.ErrorDetails) - populate(objectMap, "extensions", m.Extensions) - populateTimeRFC3339(objectMap, "lastStatusChange", m.LastStatusChange) - populate(objectMap, "locationData", m.LocationData) - populate(objectMap, "machineFqdn", m.MachineFqdn) - populate(objectMap, "mssqlDiscovered", m.MssqlDiscovered) - populate(objectMap, "osName", m.OSName) - populate(objectMap, "osProfile", m.OSProfile) - populate(objectMap, "osSku", m.OSSKU) - populate(objectMap, "osType", m.OSType) - populate(objectMap, "osVersion", m.OSVersion) - populate(objectMap, "parentClusterResourceId", m.ParentClusterResourceID) - populate(objectMap, "privateLinkScopeResourceId", m.PrivateLinkScopeResourceID) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "serviceStatuses", m.ServiceStatuses) - populate(objectMap, "status", m.Status) - populate(objectMap, "vmId", m.VMID) - populate(objectMap, "vmUuid", m.VMUUID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. -func (m *MachineProperties) 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 "adFqdn": - err = unpopulate(val, "AdFqdn", &m.AdFqdn) - delete(rawMsg, key) - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &m.AgentConfiguration) - delete(rawMsg, key) - case "agentVersion": - err = unpopulate(val, "AgentVersion", &m.AgentVersion) - delete(rawMsg, key) - case "clientPublicKey": - err = unpopulate(val, "ClientPublicKey", &m.ClientPublicKey) - delete(rawMsg, key) - case "cloudMetadata": - err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) - delete(rawMsg, key) - case "dnsFqdn": - err = unpopulate(val, "DNSFqdn", &m.DNSFqdn) - delete(rawMsg, key) - case "detectedProperties": - err = unpopulate(val, "DetectedProperties", &m.DetectedProperties) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "domainName": - err = unpopulate(val, "DomainName", &m.DomainName) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &m.Extensions) - delete(rawMsg, key) - case "lastStatusChange": - err = unpopulateTimeRFC3339(val, "LastStatusChange", &m.LastStatusChange) - delete(rawMsg, key) - case "locationData": - err = unpopulate(val, "LocationData", &m.LocationData) - delete(rawMsg, key) - case "machineFqdn": - err = unpopulate(val, "MachineFqdn", &m.MachineFqdn) - delete(rawMsg, key) - case "mssqlDiscovered": - err = unpopulate(val, "MssqlDiscovered", &m.MssqlDiscovered) - delete(rawMsg, key) - case "osName": - err = unpopulate(val, "OSName", &m.OSName) - delete(rawMsg, key) - case "osProfile": - err = unpopulate(val, "OSProfile", &m.OSProfile) - delete(rawMsg, key) - case "osSku": - err = unpopulate(val, "OSSKU", &m.OSSKU) - delete(rawMsg, key) - case "osType": - err = unpopulate(val, "OSType", &m.OSType) - delete(rawMsg, key) - case "osVersion": - err = unpopulate(val, "OSVersion", &m.OSVersion) - delete(rawMsg, key) - case "parentClusterResourceId": - err = unpopulate(val, "ParentClusterResourceID", &m.ParentClusterResourceID) - delete(rawMsg, key) - case "privateLinkScopeResourceId": - err = unpopulate(val, "PrivateLinkScopeResourceID", &m.PrivateLinkScopeResourceID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) - delete(rawMsg, key) - case "serviceStatuses": - err = unpopulate(val, "ServiceStatuses", &m.ServiceStatuses) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "vmId": - err = unpopulate(val, "VMID", &m.VMID) - delete(rawMsg, key) - case "vmUuid": - err = unpopulate(val, "VMUUID", &m.VMUUID) - 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 MachineUpdate. -func (m MachineUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", m.Identity) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScope. -func (p PrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopeProperties. -func (p PrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "privateLinkScopeId", p.PrivateLinkScopeID) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopesResource. -func (p PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceUpdate. -func (r ResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - 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 TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}