From bdf05be83c3a9b216a8587ea102392331926154f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 26 Jul 2023 21:46:30 +0000 Subject: [PATCH] CodeGen from PR 24518 in Azure/azure-rest-api-specs Merge 468647f09fbbb1dbe7306a29f0012fe1d82963ec into 23d88533ddfde4d1565a897fe95d42fb0d9333e5 --- .../armhybridcompute/CHANGELOG.md | 91 ++ .../armhybridcompute/agentversion_client.go | 148 ++ .../armhybridcompute/autorest.md | 6 +- .../armhybridcompute/client_factory.go | 40 +- .../armhybridcompute/constants.go | 310 +++- .../extensionmetadata_client.go | 183 +++ .../hybridcompute/armhybridcompute/go.mod | 22 +- .../hybridcompute/armhybridcompute/go.sum | 38 +- .../hybrididentitymetadata_client.go | 180 +++ .../licenseprofiles_client.go | 390 +++++ .../machineextensions_client.go | 89 +- .../machineextensions_client_example_test.go | 287 ---- .../armhybridcompute/machines_client.go | 227 ++- .../machines_client_example_test.go | 494 ------- .../armhybridcompute/management_client.go | 27 +- .../management_client_example_test.go | 49 - .../hybridcompute/armhybridcompute/models.go | 661 ++++++--- .../armhybridcompute/models_serde.go | 1288 ++++++++++++++++- .../armhybridcompute/networkprofile_client.go | 104 ++ .../armhybridcompute/operations_client.go | 7 +- .../operations_client_example_test.go | 68 - .../hybridcompute/armhybridcompute/options.go | 246 ++++ .../privateendpointconnections_client.go | 65 +- ...endpointconnections_client_example_test.go | 191 --- .../privatelinkresources_client.go | 22 +- ...rivatelinkresources_client_example_test.go | 98 -- .../privatelinkscopes_client.go | 115 +- .../privatelinkscopes_client_example_test.go | 478 ------ .../armhybridcompute/response_types.go | 106 +- .../armhybridcompute/time_rfc3339.go | 3 +- 30 files changed, 3944 insertions(+), 2089 deletions(-) create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/options.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md index 07943bf92e93..5e7c1cbe24a4 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md @@ -1,5 +1,96 @@ # Release History +## 2.0.0-beta.1 (2023-07-26) +### Breaking Changes + +- Type of `MachineExtensionProperties.ProtectedSettings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionProperties.Settings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionUpdateProperties.ProtectedSettings` has been changed from `any` to `map[string]any` +- Type of `MachineExtensionUpdateProperties.Settings` has been changed from `any` to `map[string]any` + +### Features Added + +- New enum type `AgentConfigurationMode` with values `AgentConfigurationModeFull`, `AgentConfigurationModeMonitor` +- New enum type `ArcEnabledEsuStatus` with values `ArcEnabledEsuStatusEnrolled`, `ArcEnabledEsuStatusIneligible`, `ArcEnabledEsuStatusNotEnrolled`, `ArcEnabledEsuStatusUnknown` +- New enum type `ArcKindEnum` with values `ArcKindEnumAVS`, `ArcKindEnumAWS`, `ArcKindEnumEPS`, `ArcKindEnumGCP`, `ArcKindEnumHCI`, `ArcKindEnumSCVMM`, `ArcKindEnumVMware` +- New enum type `ArcServerType` with values `ArcServerTypeDatacenter`, `ArcServerTypeStandard` +- New enum type `EsuKeyState` with values `EsuKeyStateActive`, `EsuKeyStateInactive` +- New enum type `LastAttemptStatusEnum` with values `LastAttemptStatusEnumFailed`, `LastAttemptStatusEnumSuccess` +- New enum type `LicenseProfileProvisioningState` with values `LicenseProfileProvisioningStateAccepted`, `LicenseProfileProvisioningStateCanceled`, `LicenseProfileProvisioningStateCreating`, `LicenseProfileProvisioningStateDeleted`, `LicenseProfileProvisioningStateDeleting`, `LicenseProfileProvisioningStateFailed`, `LicenseProfileProvisioningStateSucceeded`, `LicenseProfileProvisioningStateUpdating` +- 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 `NewAgentVersionClient(azcore.TokenCredential, *arm.ClientOptions) (*AgentVersionClient, error)` +- New function `*AgentVersionClient.Get(context.Context, string, string, *AgentVersionClientGetOptions) (AgentVersionClientGetResponse, error)` +- New function `*AgentVersionClient.List(context.Context, string, *AgentVersionClientListOptions) (AgentVersionClientListResponse, error)` +- New function `*ClientFactory.NewAgentVersionClient() *AgentVersionClient` +- New function `*ClientFactory.NewExtensionMetadataClient() *ExtensionMetadataClient` +- New function `*ClientFactory.NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient` +- New function `*ClientFactory.NewLicenseProfilesClient() *LicenseProfilesClient` +- New function `*ClientFactory.NewNetworkProfileClient() *NetworkProfileClient` +- New function `NewExtensionMetadataClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExtensionMetadataClient, error)` +- New function `*ExtensionMetadataClient.Get(context.Context, string, string, string, string, *ExtensionMetadataClientGetOptions) (ExtensionMetadataClientGetResponse, error)` +- New function `*ExtensionMetadataClient.NewListPager(string, string, string, *ExtensionMetadataClientListOptions) *runtime.Pager[ExtensionMetadataClientListResponse]` +- New function `NewHybridIdentityMetadataClient(string, azcore.TokenCredential, *arm.ClientOptions) (*HybridIdentityMetadataClient, error)` +- New function `*HybridIdentityMetadataClient.Get(context.Context, string, string, string, *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error)` +- New function `*HybridIdentityMetadataClient.NewListByMachinesPager(string, string, *HybridIdentityMetadataClientListByMachinesOptions) *runtime.Pager[HybridIdentityMetadataClientListByMachinesResponse]` +- New function `NewLicenseProfilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LicenseProfilesClient, error)` +- New function `*LicenseProfilesClient.BeginCreateOrUpdate(context.Context, string, string, LicenseProfile, *LicenseProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicenseProfilesClientCreateOrUpdateResponse], error)` +- New function `*LicenseProfilesClient.BeginDelete(context.Context, string, string, *LicenseProfilesClientBeginDeleteOptions) (*runtime.Poller[LicenseProfilesClientDeleteResponse], error)` +- New function `*LicenseProfilesClient.Get(context.Context, string, string, *LicenseProfilesClientGetOptions) (LicenseProfilesClientGetResponse, error)` +- New function `*LicenseProfilesClient.NewListPager(string, string, *LicenseProfilesClientListOptions) *runtime.Pager[LicenseProfilesClientListResponse]` +- New function `*LicenseProfilesClient.BeginUpdate(context.Context, string, string, LicenseProfileUpdate, *LicenseProfilesClientBeginUpdateOptions) (*runtime.Poller[LicenseProfilesClientUpdateResponse], error)` +- New function `*MachinesClient.BeginAssessPatches(context.Context, string, string, *MachinesClientBeginAssessPatchesOptions) (*runtime.Poller[MachinesClientAssessPatchesResponse], error)` +- New function `*MachinesClient.BeginInstallPatches(context.Context, string, string, MachineInstallPatchesParameters, *MachinesClientBeginInstallPatchesOptions) (*runtime.Poller[MachinesClientInstallPatchesResponse], error)` +- New function `NewNetworkProfileClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkProfileClient, error)` +- New function `*NetworkProfileClient.Get(context.Context, string, string, *NetworkProfileClientGetOptions) (NetworkProfileClientGetResponse, error)` +- New struct `AgentUpgrade` +- New struct `AgentVersion` +- New struct `AgentVersionsList` +- New struct `AvailablePatchCountByClassification` +- New struct `ErrorDetailAutoGenerated` +- New struct `ErrorResponseAutoGenerated` +- New struct `EsuEnrollmentUpdateRecord` +- New struct `EsuKey` +- New struct `EsuProfileProperties` +- New struct `EsuProfileUpdateProperties` +- New struct `ExtensionValue` +- New struct `ExtensionValueListResult` +- New struct `ExtensionValueProperties` +- New struct `HybridIdentityMetadata` +- New struct `HybridIdentityMetadataList` +- New struct `HybridIdentityMetadataProperties` +- New struct `IPAddress` +- New struct `LicenseProfile` +- New struct `LicenseProfileProperties` +- New struct `LicenseProfileUpdate` +- New struct `LicenseProfileUpdateProperties` +- New struct `LicenseProfilesListResult` +- New struct `LinuxParameters` +- New struct `MachineAssessPatchesResult` +- New struct `MachineEsuProperties` +- New struct `MachineInstallPatchesParameters` +- New struct `MachineInstallPatchesResult` +- New struct `NetworkInterface` +- New struct `NetworkProfile` +- New struct `Subnet` +- New struct `WindowsParameters` +- New field `ConfigMode` in struct `AgentConfiguration` +- New field `Kind`, `Resources` in struct `Machine` +- New field `EnableAutomaticUpgrade` in struct `MachineExtensionUpdateProperties` +- New field `AgentUpgrade`, `EsuProperties`, `NetworkProfile` in struct `MachineProperties` +- New field `Kind` in struct `MachineUpdate` +- 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.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go new file mode 100644 index 000000000000..9b00ec04c7d1 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/agentversion_client.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AgentVersionClient contains the methods for the AgentVersion group. +// Don't use this type directly, use NewAgentVersionClient() instead. +type AgentVersionClient struct { + internal *arm.Client +} + +// NewAgentVersionClient creates a new instance of AgentVersionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAgentVersionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentVersionClient, error) { + cl, err := arm.NewClient(moduleName+".AgentVersionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgentVersionClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets an Agent Version along with the download link currently present. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - osType - Defines the os type +// - version - Defines the agent version. To get latest, use latest or else a specific agent version. +// - options - AgentVersionClientGetOptions contains the optional parameters for the AgentVersionClient.Get method. +func (client *AgentVersionClient) Get(ctx context.Context, osType string, version string, options *AgentVersionClientGetOptions) (AgentVersionClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, osType, version, options) + if err != nil { + return AgentVersionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentVersionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentVersionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgentVersionClient) getCreateRequest(ctx context.Context, osType string, version string, options *AgentVersionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions/{version}" + if osType == "" { + return nil, errors.New("parameter osType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osType}", url.PathEscape(osType)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AgentVersionClient) getHandleResponse(resp *http.Response) (AgentVersionClientGetResponse, error) { + result := AgentVersionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentVersion); err != nil { + return AgentVersionClientGetResponse{}, err + } + return result, nil +} + +// List - Gets all Agent Versions along with the download link currently present. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - osType - Defines the os type. +// - options - AgentVersionClientListOptions contains the optional parameters for the AgentVersionClient.List method. +func (client *AgentVersionClient) List(ctx context.Context, osType string, options *AgentVersionClientListOptions) (AgentVersionClientListResponse, error) { + var err error + req, err := client.listCreateRequest(ctx, osType, options) + if err != nil { + return AgentVersionClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgentVersionClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentVersionClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *AgentVersionClient) listCreateRequest(ctx context.Context, osType string, options *AgentVersionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.HybridCompute/osType/{osType}/agentVersions" + if osType == "" { + return nil, errors.New("parameter osType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{osType}", url.PathEscape(osType)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AgentVersionClient) listHandleResponse(resp *http.Response) (AgentVersionClientListResponse, error) { + result := AgentVersionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgentVersionsList); err != nil { + return AgentVersionClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md index 2de0ae740f4e..37b159d5fc5b 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.1.1 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go index 9c1de7e1a4e2..1a1c3db6fe5b 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -38,8 +37,23 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewMachinesClient() *MachinesClient { - subClient, _ := NewMachinesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAgentVersionClient() *AgentVersionClient { + subClient, _ := NewAgentVersionClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExtensionMetadataClient() *ExtensionMetadataClient { + subClient, _ := NewExtensionMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewHybridIdentityMetadataClient() *HybridIdentityMetadataClient { + subClient, _ := NewHybridIdentityMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLicenseProfilesClient() *LicenseProfilesClient { + subClient, _ := NewLicenseProfilesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -48,18 +62,28 @@ func (c *ClientFactory) NewMachineExtensionsClient() *MachineExtensionsClient { return subClient } +func (c *ClientFactory) NewMachinesClient() *MachinesClient { + subClient, _ := NewMachinesClient(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) NewNetworkProfileClient() *NetworkProfileClient { + subClient, _ := NewNetworkProfileClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { - subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -68,7 +92,7 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { + subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go index e405334a18ee..4fbc226c88f0 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go @@ -3,17 +3,95 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute const ( moduleName = "armhybridcompute" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.1" ) +// AgentConfigurationMode - Name of configuration mode to use. Modes are pre-defined configurations of security controls, +// extension allowlists and guest configuration, maintained by Microsoft. +type AgentConfigurationMode string + +const ( + AgentConfigurationModeFull AgentConfigurationMode = "full" + AgentConfigurationModeMonitor AgentConfigurationMode = "monitor" +) + +// PossibleAgentConfigurationModeValues returns the possible values for the AgentConfigurationMode const type. +func PossibleAgentConfigurationModeValues() []AgentConfigurationMode { + return []AgentConfigurationMode{ + AgentConfigurationModeFull, + AgentConfigurationModeMonitor, + } +} + +// ArcEnabledEsuStatus - The ESU enrollment state. +type ArcEnabledEsuStatus string + +const ( + ArcEnabledEsuStatusEnrolled ArcEnabledEsuStatus = "Enrolled" + ArcEnabledEsuStatusIneligible ArcEnabledEsuStatus = "Ineligible" + ArcEnabledEsuStatusNotEnrolled ArcEnabledEsuStatus = "NotEnrolled" + ArcEnabledEsuStatusUnknown ArcEnabledEsuStatus = "Unknown" +) + +// PossibleArcEnabledEsuStatusValues returns the possible values for the ArcEnabledEsuStatus const type. +func PossibleArcEnabledEsuStatusValues() []ArcEnabledEsuStatus { + return []ArcEnabledEsuStatus{ + ArcEnabledEsuStatusEnrolled, + ArcEnabledEsuStatusIneligible, + ArcEnabledEsuStatusNotEnrolled, + ArcEnabledEsuStatusUnknown, + } +} + +// ArcKindEnum - Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. +type ArcKindEnum string + +const ( + ArcKindEnumAVS ArcKindEnum = "AVS" + ArcKindEnumAWS ArcKindEnum = "AWS" + ArcKindEnumEPS ArcKindEnum = "EPS" + ArcKindEnumGCP ArcKindEnum = "GCP" + ArcKindEnumHCI ArcKindEnum = "HCI" + ArcKindEnumSCVMM ArcKindEnum = "SCVMM" + ArcKindEnumVMware ArcKindEnum = "VMware" +) + +// PossibleArcKindEnumValues returns the possible values for the ArcKindEnum const type. +func PossibleArcKindEnumValues() []ArcKindEnum { + return []ArcKindEnum{ + ArcKindEnumAVS, + ArcKindEnumAWS, + ArcKindEnumEPS, + ArcKindEnumGCP, + ArcKindEnumHCI, + ArcKindEnumSCVMM, + ArcKindEnumVMware, + } +} + +// ArcServerType - Indicates whether server is a Standard or Datacenter Sku. +type ArcServerType string + +const ( + ArcServerTypeDatacenter ArcServerType = "Datacenter" + ArcServerTypeStandard ArcServerType = "Standard" +) + +// PossibleArcServerTypeValues returns the possible values for the ArcServerType const type. +func PossibleArcServerTypeValues() []ArcServerType { + return []ArcServerType{ + ArcServerTypeDatacenter, + ArcServerTypeStandard, + } +} + // AssessmentModeTypes - Specifies the assessment mode. type AssessmentModeTypes string @@ -50,6 +128,22 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// EsuKeyState - The ESU key state. +type EsuKeyState string + +const ( + EsuKeyStateActive EsuKeyState = "Active" + EsuKeyStateInactive EsuKeyState = "Inactive" +) + +// PossibleEsuKeyStateValues returns the possible values for the EsuKeyState const type. +func PossibleEsuKeyStateValues() []EsuKeyState { + return []EsuKeyState{ + EsuKeyStateActive, + EsuKeyStateInactive, + } +} + type InstanceViewTypes string const ( @@ -63,6 +157,66 @@ func PossibleInstanceViewTypesValues() []InstanceViewTypes { } } +// LastAttemptStatusEnum - Specifies the status of Agent Upgrade. +type LastAttemptStatusEnum string + +const ( + LastAttemptStatusEnumFailed LastAttemptStatusEnum = "Failed" + LastAttemptStatusEnumSuccess LastAttemptStatusEnum = "Success" +) + +// PossibleLastAttemptStatusEnumValues returns the possible values for the LastAttemptStatusEnum const type. +func PossibleLastAttemptStatusEnumValues() []LastAttemptStatusEnum { + return []LastAttemptStatusEnum{ + LastAttemptStatusEnumFailed, + LastAttemptStatusEnumSuccess, + } +} + +// LicenseProfileProvisioningState - The provisioning state, which only appears in the response. +type LicenseProfileProvisioningState string + +const ( + LicenseProfileProvisioningStateAccepted LicenseProfileProvisioningState = "Accepted" + LicenseProfileProvisioningStateCanceled LicenseProfileProvisioningState = "Canceled" + LicenseProfileProvisioningStateCreating LicenseProfileProvisioningState = "Creating" + LicenseProfileProvisioningStateDeleted LicenseProfileProvisioningState = "Deleted" + LicenseProfileProvisioningStateDeleting LicenseProfileProvisioningState = "Deleting" + LicenseProfileProvisioningStateFailed LicenseProfileProvisioningState = "Failed" + LicenseProfileProvisioningStateSucceeded LicenseProfileProvisioningState = "Succeeded" + LicenseProfileProvisioningStateUpdating LicenseProfileProvisioningState = "Updating" +) + +// PossibleLicenseProfileProvisioningStateValues returns the possible values for the LicenseProfileProvisioningState const type. +func PossibleLicenseProfileProvisioningStateValues() []LicenseProfileProvisioningState { + return []LicenseProfileProvisioningState{ + LicenseProfileProvisioningStateAccepted, + LicenseProfileProvisioningStateCanceled, + LicenseProfileProvisioningStateCreating, + LicenseProfileProvisioningStateDeleted, + LicenseProfileProvisioningStateDeleting, + LicenseProfileProvisioningStateFailed, + LicenseProfileProvisioningStateSucceeded, + LicenseProfileProvisioningStateUpdating, + } +} + +// 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 @@ -83,6 +237,70 @@ func PossiblePatchModeTypesValues() []PatchModeTypes { } } +// PatchOperationStartedBy - Indicates if operation was triggered by user or by platform. +type PatchOperationStartedBy string + +const ( + PatchOperationStartedByPlatform PatchOperationStartedBy = "Platform" + PatchOperationStartedByUser PatchOperationStartedBy = "User" +) + +// PossiblePatchOperationStartedByValues returns the possible values for the PatchOperationStartedBy const type. +func PossiblePatchOperationStartedByValues() []PatchOperationStartedBy { + return []PatchOperationStartedBy{ + PatchOperationStartedByPlatform, + PatchOperationStartedByUser, + } +} + +// PatchOperationStatus - The overall success or failure status of the operation. It remains "InProgress" until the operation +// completes. At that point it will become "Unknown", "Failed", "Succeeded", or +// "CompletedWithWarnings." +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +// PossiblePatchOperationStatusValues returns the possible values for the PatchOperationStatus const type. +func PossiblePatchOperationStatusValues() []PatchOperationStatus { + return []PatchOperationStatus{ + PatchOperationStatusCompletedWithWarnings, + PatchOperationStatusFailed, + PatchOperationStatusInProgress, + PatchOperationStatusSucceeded, + PatchOperationStatusUnknown, + } +} + +// PatchServiceUsed - Specifies the patch service used for the operation. +type PatchServiceUsed string + +const ( + PatchServiceUsedAPT PatchServiceUsed = "APT" + PatchServiceUsedUnknown PatchServiceUsed = "Unknown" + PatchServiceUsedWU PatchServiceUsed = "WU" + PatchServiceUsedWUWSUS PatchServiceUsed = "WU_WSUS" + PatchServiceUsedYUM PatchServiceUsed = "YUM" + PatchServiceUsedZypper PatchServiceUsed = "Zypper" +) + +// PossiblePatchServiceUsedValues returns the possible values for the PatchServiceUsed const type. +func PossiblePatchServiceUsedValues() []PatchServiceUsed { + return []PatchServiceUsed{ + PatchServiceUsedAPT, + PatchServiceUsedUnknown, + PatchServiceUsedWU, + PatchServiceUsedWUWSUS, + PatchServiceUsedYUM, + PatchServiceUsedZypper, + } +} + // 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 @@ -139,3 +357,89 @@ func PossibleStatusTypesValues() []StatusTypes { StatusTypesError, } } + +type VMGuestPatchClassificationLinux string + +const ( + VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" + VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" + VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" +) + +// PossibleVMGuestPatchClassificationLinuxValues returns the possible values for the VMGuestPatchClassificationLinux const type. +func PossibleVMGuestPatchClassificationLinuxValues() []VMGuestPatchClassificationLinux { + return []VMGuestPatchClassificationLinux{ + VMGuestPatchClassificationLinuxCritical, + VMGuestPatchClassificationLinuxOther, + VMGuestPatchClassificationLinuxSecurity, + } +} + +type VMGuestPatchClassificationWindows string + +const ( + VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" + VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" + VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" + VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" + VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" + VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" + VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" + VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" +) + +// PossibleVMGuestPatchClassificationWindowsValues returns the possible values for the VMGuestPatchClassificationWindows const type. +func PossibleVMGuestPatchClassificationWindowsValues() []VMGuestPatchClassificationWindows { + return []VMGuestPatchClassificationWindows{ + VMGuestPatchClassificationWindowsCritical, + VMGuestPatchClassificationWindowsDefinition, + VMGuestPatchClassificationWindowsFeaturePack, + VMGuestPatchClassificationWindowsSecurity, + VMGuestPatchClassificationWindowsServicePack, + VMGuestPatchClassificationWindowsTools, + VMGuestPatchClassificationWindowsUpdateRollUp, + VMGuestPatchClassificationWindowsUpdates, + } +} + +// VMGuestPatchRebootSetting - Defines when it is acceptable to reboot a VM during a software update operation. +type VMGuestPatchRebootSetting string + +const ( + VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" + VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" + VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" +) + +// PossibleVMGuestPatchRebootSettingValues returns the possible values for the VMGuestPatchRebootSetting const type. +func PossibleVMGuestPatchRebootSettingValues() []VMGuestPatchRebootSetting { + return []VMGuestPatchRebootSetting{ + VMGuestPatchRebootSettingAlways, + VMGuestPatchRebootSettingIfRequired, + VMGuestPatchRebootSettingNever, + } +} + +// VMGuestPatchRebootStatus - The reboot state of the VM following completion of the operation. +type VMGuestPatchRebootStatus string + +const ( + VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" + VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" + VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" + VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" + VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" + VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" +) + +// PossibleVMGuestPatchRebootStatusValues returns the possible values for the VMGuestPatchRebootStatus const type. +func PossibleVMGuestPatchRebootStatusValues() []VMGuestPatchRebootStatus { + return []VMGuestPatchRebootStatus{ + VMGuestPatchRebootStatusCompleted, + VMGuestPatchRebootStatusFailed, + VMGuestPatchRebootStatusNotNeeded, + VMGuestPatchRebootStatusRequired, + VMGuestPatchRebootStatusStarted, + VMGuestPatchRebootStatusUnknown, + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go new file mode 100644 index 000000000000..4f1cdd062403 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go @@ -0,0 +1,183 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ExtensionMetadataClient contains the methods for the ExtensionMetadata group. +// Don't use this type directly, use NewExtensionMetadataClient() instead. +type ExtensionMetadataClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExtensionMetadataClient creates a new instance of ExtensionMetadataClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewExtensionMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionMetadataClient, error) { + cl, err := arm.NewClient(moduleName+".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 2023-06-20-preview +// - location - The location of the Extension being received. +// - publisher - The publisher of the Extension being received. +// - extensionType - The extensionType of the Extension being received. +// - version - The version of the Extension being received. +// - options - ExtensionMetadataClientGetOptions contains the optional parameters for the ExtensionMetadataClient.Get method. +func (client *ExtensionMetadataClient) Get(ctx context.Context, location string, publisher string, extensionType string, version string, options *ExtensionMetadataClientGetOptions) (ExtensionMetadataClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, location, publisher, extensionType, version, options) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtensionMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExtensionMetadataClient) getCreateRequest(ctx context.Context, location string, publisher string, extensionType string, version string, options *ExtensionMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publisher == "" { + return nil, errors.New("parameter publisher cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publisher}", url.PathEscape(publisher)) + if extensionType == "" { + return nil, errors.New("parameter extensionType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{extensionType}", url.PathEscape(extensionType)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{version}", url.PathEscape(version)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExtensionMetadataClient) getHandleResponse(resp *http.Response) (ExtensionMetadataClientGetResponse, error) { + result := ExtensionMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionValue); err != nil { + return ExtensionMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all Extension versions based on location, publisher, extensionType +// +// Generated from API version 2023-06-20-preview +// - location - The location of the Extension being received. +// - publisher - The publisher of the Extension being received. +// - extensionType - The extensionType of the Extension being received. +// - options - ExtensionMetadataClientListOptions contains the optional parameters for the ExtensionMetadataClient.NewListPager +// method. +func (client *ExtensionMetadataClient) NewListPager(location string, publisher string, extensionType string, options *ExtensionMetadataClientListOptions) *runtime.Pager[ExtensionMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ExtensionMetadataClientListResponse]{ + More: func(page ExtensionMetadataClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ExtensionMetadataClientListResponse) (ExtensionMetadataClientListResponse, error) { + 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", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ExtensionMetadataClient) listHandleResponse(resp *http.Response) (ExtensionMetadataClientListResponse, error) { + result := ExtensionMetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionValueListResult); err != nil { + return ExtensionMetadataClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod index 2d0c7d6192b1..17248fd97309 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go new file mode 100644 index 000000000000..de8b4b1fb3fa --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/hybrididentitymetadata_client.go @@ -0,0 +1,180 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// HybridIdentityMetadataClient contains the methods for the HybridIdentityMetadata group. +// Don't use this type directly, use NewHybridIdentityMetadataClient() instead. +type HybridIdentityMetadataClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHybridIdentityMetadataClient creates a new instance of HybridIdentityMetadataClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewHybridIdentityMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HybridIdentityMetadataClient, error) { + cl, err := arm.NewClient(moduleName+".HybridIdentityMetadataClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HybridIdentityMetadataClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Implements HybridIdentityMetadata GET method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - metadataName - Name of the HybridIdentityMetadata. +// - options - HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get +// method. +func (client *HybridIdentityMetadataClient) Get(ctx context.Context, resourceGroupName string, machineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (HybridIdentityMetadataClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, metadataName, options) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HybridIdentityMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HybridIdentityMetadataClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, metadataName string, options *HybridIdentityMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HybridIdentityMetadataClient) getHandleResponse(resp *http.Response) (HybridIdentityMetadataClientGetResponse, error) { + result := HybridIdentityMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadata); err != nil { + return HybridIdentityMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListByMachinesPager - Returns the list of HybridIdentityMetadata of the given machine. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - HybridIdentityMetadataClientListByMachinesOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByMachinesPager +// method. +func (client *HybridIdentityMetadataClient) NewListByMachinesPager(resourceGroupName string, machineName string, options *HybridIdentityMetadataClientListByMachinesOptions) *runtime.Pager[HybridIdentityMetadataClientListByMachinesResponse] { + return runtime.NewPager(runtime.PagingHandler[HybridIdentityMetadataClientListByMachinesResponse]{ + More: func(page HybridIdentityMetadataClientListByMachinesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HybridIdentityMetadataClientListByMachinesResponse) (HybridIdentityMetadataClientListByMachinesResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByMachinesCreateRequest(ctx, resourceGroupName, machineName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return HybridIdentityMetadataClientListByMachinesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HybridIdentityMetadataClientListByMachinesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HybridIdentityMetadataClientListByMachinesResponse{}, runtime.NewResponseError(resp) + } + return client.listByMachinesHandleResponse(resp) + }, + }) +} + +// listByMachinesCreateRequest creates the ListByMachines request. +func (client *HybridIdentityMetadataClient) listByMachinesCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *HybridIdentityMetadataClientListByMachinesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/hybridIdentityMetadata" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMachinesHandleResponse handles the ListByMachines response. +func (client *HybridIdentityMetadataClient) listByMachinesHandleResponse(resp *http.Response) (HybridIdentityMetadataClientListByMachinesResponse, error) { + result := HybridIdentityMetadataClientListByMachinesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HybridIdentityMetadataList); err != nil { + return HybridIdentityMetadataClientListByMachinesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go new file mode 100644 index 000000000000..c06a8f19120f --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go @@ -0,0 +1,390 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LicenseProfilesClient contains the methods for the LicenseProfiles group. +// Don't use this type directly, use NewLicenseProfilesClient() instead. +type LicenseProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLicenseProfilesClient creates a new instance of LicenseProfilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLicenseProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LicenseProfilesClient, error) { + cl, err := arm.NewClient(moduleName+".LicenseProfilesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LicenseProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - parameters - Parameters supplied to the Create license profile operation. +// - options - LicenseProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginCreateOrUpdate +// method. +func (client *LicenseProfilesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LicenseProfilesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[LicenseProfilesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LicenseProfilesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - The operation to create or update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LicenseProfilesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - LicenseProfilesClientBeginDeleteOptions contains the optional parameters for the LicenseProfilesClient.BeginDelete +// method. +func (client *LicenseProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*runtime.Poller[LicenseProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, machineName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[LicenseProfilesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LicenseProfilesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - The operation to delete a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LicenseProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves information about the view of a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - LicenseProfilesClientGetOptions contains the optional parameters for the LicenseProfilesClient.Get method. +func (client *LicenseProfilesClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientGetOptions) (LicenseProfilesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return LicenseProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LicenseProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LicenseProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LicenseProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LicenseProfilesClient) getHandleResponse(resp *http.Response) (LicenseProfilesClientGetResponse, error) { + result := LicenseProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicenseProfile); err != nil { + return LicenseProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - The operation to get all license profiles of a non-Azure machine +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the machine. +// - options - LicenseProfilesClientListOptions contains the optional parameters for the LicenseProfilesClient.NewListPager +// method. +func (client *LicenseProfilesClient) NewListPager(resourceGroupName string, machineName string, options *LicenseProfilesClientListOptions) *runtime.Pager[LicenseProfilesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LicenseProfilesClientListResponse]{ + More: func(page LicenseProfilesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LicenseProfilesClientListResponse) (LicenseProfilesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, machineName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LicenseProfilesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LicenseProfilesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LicenseProfilesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LicenseProfilesClient) listCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LicenseProfilesClient) listHandleResponse(resp *http.Response) (LicenseProfilesClientListResponse, error) { + result := LicenseProfilesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LicenseProfilesListResult); err != nil { + return LicenseProfilesClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - The operation to update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - parameters - Parameters supplied to the Update license profile operation. +// - options - LicenseProfilesClientBeginUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginUpdate +// method. +func (client *LicenseProfilesClient) BeginUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*runtime.Poller[LicenseProfilesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[LicenseProfilesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[LicenseProfilesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - The operation to update a license profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +func (client *LicenseProfilesClient) update(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *LicenseProfilesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + urlPath = strings.ReplaceAll(urlPath, "{licenseProfileName}", url.PathEscape("default")) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go index e1b16675f4e4..ac41ff0ed9c3 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -47,7 +46,7 @@ func NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be created or updated. // - extensionName - The name of the machine extension. @@ -60,7 +59,8 @@ func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MachineExtensionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MachineExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,16 +111,19 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extensionParameters) + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be deleted. // - extensionName - The name of the machine extension. @@ -130,7 +135,8 @@ func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MachineExtensionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MachineExtensionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, extensionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -179,7 +187,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,24 +196,27 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - extensionName - The name of the machine extension. // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, extensionName, options) if err != nil { return MachineExtensionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MachineExtensionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachineExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachineExtensionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (M // NewListPager - The operation to get all extensions of a non-Azure machine // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - options - MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager @@ -305,7 +316,7 @@ func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +334,7 @@ func (client *MachineExtensionsClient) listHandleResponse(resp *http.Response) ( // BeginUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be created or updated. // - extensionName - The name of the machine extension. @@ -336,7 +347,8 @@ func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[MachineExtensionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MachineExtensionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MachineExtensionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -345,20 +357,22 @@ func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resource // Update - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, extensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -385,8 +399,11 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extensionParameters) + if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go deleted file mode 100644 index 982d2c0bf58f..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go +++ /dev/null @@ -1,287 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().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]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armhybridcompute.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.HybridCompute/machines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armhybridcompute.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armhybridcompute.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // Level: to.Ptr(armhybridcompute.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/UpdateExtension.json -func ExampleMachineExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().BeginUpdate(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", armhybridcompute.MachineExtensionUpdate{ - Properties: &armhybridcompute.MachineExtensionUpdateProperties{ - Type: to.Ptr("CustomScriptExtension"), - Publisher: to.Ptr("Microsoft.Compute"), - Settings: map[string]any{ - "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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armhybridcompute.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.HybridCompute/machines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armhybridcompute.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armhybridcompute.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // Level: to.Ptr(armhybridcompute.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -lt 100 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/DELETEExtension.json -func ExampleMachineExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMachineExtensionsClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachineExtensionsClient().Get(ctx, "myResourceGroup", "myMachine", "CustomScriptExtension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MachineExtension = armhybridcompute.MachineExtension{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.HybridCompute/machines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armhybridcompute.MachineExtensionProperties{ - // Type: to.Ptr("string"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armhybridcompute.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armhybridcompute.StatusLevelTypes("Information")), - // Message: to.Ptr("Finished executing command, StdOut: , StdErr:"), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-08T20:42:10.999Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProtectedSettings: map[string]any{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: "@{commandToExecute=powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"}", - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/LISTExtension.json -func ExampleMachineExtensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachineExtensionsClient().NewListPager("myResourceGroup", "myMachine", &armhybridcompute.MachineExtensionsClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineExtensionsListResult = armhybridcompute.MachineExtensionsListResult{ - // Value: []*armhybridcompute.MachineExtension{ - // { - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("Microsoft.HybridCompute/machines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/CustomScriptExtension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armhybridcompute.MachineExtensionProperties{ - // Type: to.Ptr("CustomScriptExtension"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ - // Name: to.Ptr("CustomScriptExtension"), - // Type: to.Ptr("CustomScriptExtension"), - // Status: &armhybridcompute.MachineExtensionInstanceViewStatus{ - // Code: to.Ptr("success"), - // DisplayStatus: to.Ptr("Provisioning succeeded"), - // Level: to.Ptr(armhybridcompute.StatusLevelTypes("Information")), - // Message: to.Ptr("formattedMessage: Finished executing command, StdOut: , StdErr: "), - // Time: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-13T17:18:57.405Z"); return t}()), - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("Microsoft.Compute"), - // Settings: map[string]any{ - // "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"", - // }, - // TypeHandlerVersion: to.Ptr("1.10.3"), - // }, - // }, - // { - // Name: to.Ptr("winosupdateextension"), - // Type: to.Ptr("Microsoft.HybridCompute/machines/extensions"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/Extensions/winosupdateextension"), - // Location: to.Ptr("eastus2euap"), - // Properties: &armhybridcompute.MachineExtensionProperties{ - // Type: to.Ptr("windowsosupdateextension"), - // AutoUpgradeMinorVersion: to.Ptr(false), - // InstanceView: &armhybridcompute.MachineExtensionInstanceView{ - // Name: to.Ptr("winosupdateextension"), - // Type: to.Ptr("windowsosupdateextension"), - // Status: &armhybridcompute.MachineExtensionInstanceViewStatus{ - // }, - // TypeHandlerVersion: to.Ptr("1.0.0.0"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // Publisher: to.Ptr("microsoft.softwareupdatemanagement.test"), - // Settings: map[string]any{ - // }, - // TypeHandlerVersion: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go index da87fe95a307..f8b22ff91f65 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -44,27 +43,101 @@ func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// CreateOrUpdate - The operation to create or update a hybrid machine resource identity in Azure. +// BeginAssessPatches - The operation to assess patches on a hybrid machine identity in Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. +// - name - The name of the hybrid machine. +// - options - MachinesClientBeginAssessPatchesOptions contains the optional parameters for the MachinesClient.BeginAssessPatches +// method. +func (client *MachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*runtime.Poller[MachinesClientAssessPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.assessPatches(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientAssessPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } 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 2023-06-20-preview +func (client *MachinesClient) assessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*http.Response, error) { + var err error + req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, name, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// assessPatchesCreateRequest creates the AssessPatches request. +func (client *MachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// CreateOrUpdate - The operation to create or update a hybrid machine. Please note some properties can be set only during +// machine creation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - parameters - Parameters supplied to the Create hybrid machine operation. // - 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) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) if err != nil { return MachinesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachinesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -87,10 +160,13 @@ func (client *MachinesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -102,24 +178,26 @@ func (client *MachinesClient) createOrUpdateHandleResponse(resp *http.Response) return result, nil } -// Delete - The operation to remove a hybrid machine identity in Azure. +// Delete - The operation to delete a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - options - MachinesClientDeleteOptions contains the optional parameters for the MachinesClient.Delete method. func (client *MachinesClient) Delete(ctx context.Context, resourceGroupName string, machineName string, options *MachinesClientDeleteOptions) (MachinesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return MachinesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return MachinesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MachinesClientDeleteResponse{}, err } return MachinesClientDeleteResponse{}, nil } @@ -144,7 +222,7 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -153,23 +231,26 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Retrieves information about the model view or the instance view of a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return MachinesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachinesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -192,7 +273,7 @@ func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -210,10 +291,84 @@ func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesCl return result, nil } +// BeginInstallPatches - The operation to install patches on a hybrid machine identity in Azure. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-20-preview +// - resourceGroupName - The name of the resource group. +// - name - The name of the hybrid machine. +// - installPatchesInput - Input for InstallPatches as directly received by the API +// - options - MachinesClientBeginInstallPatchesOptions contains the optional parameters for the MachinesClient.BeginInstallPatches +// method. +func (client *MachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*runtime.Poller[MachinesClientInstallPatchesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.installPatches(ctx, resourceGroupName, name, installPatchesInput, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachinesClientInstallPatchesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } 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 2023-06-20-preview +func (client *MachinesClient) installPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*http.Response, error) { + var err error + req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, name, installPatchesInput, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// installPatchesCreateRequest creates the InstallPatches request. +func (client *MachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, installPatchesInput); err != nil { + return nil, err + } + return req, nil +} + // NewListByResourceGroupPager - Lists all the hybrid machines in the specified resource group. Use the nextLink property // in the response to get the next page of hybrid machines. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager // method. @@ -261,7 +416,7 @@ func (client *MachinesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +434,7 @@ func (client *MachinesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists all the hybrid machines in the specified subscription. Use the nextLink property in // the response to get the next page of hybrid machines. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - options - MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager // method. func (client *MachinesClient) NewListBySubscriptionPager(options *MachinesClientListBySubscriptionOptions) *runtime.Pager[MachinesClientListBySubscriptionResponse] { @@ -322,7 +477,7 @@ func (client *MachinesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,24 +495,27 @@ func (client *MachinesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - The operation to update a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - parameters - Parameters supplied to the Update hybrid machine operation. // - 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) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, machineName, parameters, options) if err != nil { return MachinesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MachinesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MachinesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachinesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -380,10 +538,13 @@ func (client *MachinesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go deleted file mode 100644 index cae4b7ec6ced..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go +++ /dev/null @@ -1,494 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Machine = armhybridcompute.Machine{ - // Name: to.Ptr("myMachine"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("string"), - // TenantID: to.Ptr("string"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // City: to.Ptr("redmond"), - // CountryOrRegion: to.Ptr("usa"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachinesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Machine = armhybridcompute.Machine{ - // Name: to.Ptr("myMachine"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("string"), - // TenantID: to.Ptr("string"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // ClientPublicKey: to.Ptr("string"), - // 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"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMachinesClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMachinesClient().Get(ctx, "myResourceGroup", "myMachine", &armhybridcompute.MachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Machine = armhybridcompute.Machine{ - // Name: to.Ptr("myMachine"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("string"), - // TenantID: to.Ptr("string"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // ExtensionsEnabled: to.Ptr("true"), - // GuestConfigurationEnabled: to.Ptr("true"), - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, - // ProxyBypass: []*string{ - // to.Ptr("proxy1"), - // to.Ptr("proxy2")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // City: to.Ptr("redmond"), - // CountryOrRegion: to.Ptr("usa"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceStatuses: &armhybridcompute.ServiceStatuses{ - // ExtensionService: &armhybridcompute.ServiceStatus{ - // StartupType: to.Ptr("Automatic"), - // Status: to.Ptr("Running"), - // }, - // GuestConfigurationService: &armhybridcompute.ServiceStatus{ - // StartupType: to.Ptr("Automatic"), - // Status: to.Ptr("Running"), - // }, - // }, - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListByResourceGroup.json -func ExampleMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachinesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineListResult = armhybridcompute.MachineListResult{ - // Value: []*armhybridcompute.Machine{ - // { - // Name: to.Ptr("myMachine"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("f7a068cc-b0b8-46e8-a203-22f301a62a8f"), - // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }, - // { - // Name: to.Ptr("myMachine2"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine2"), - // Location: to.Ptr("westus2"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), - // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Surfacebook"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("true"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/Machines_ListBySubscription.json -func ExampleMachinesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMachinesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MachineListResult = armhybridcompute.MachineListResult{ - // Value: []*armhybridcompute.Machine{ - // { - // Name: to.Ptr("myMachine"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/machines/myMachine"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("string"), - // TenantID: to.Ptr("string"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Virtual Machine"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("false"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }, - // { - // Name: to.Ptr("myMachine2"), - // Type: to.Ptr("Microsoft.HybridCompute/machines"), - // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup2/providers/Microsoft.HybridCompute/machines/myMachine2"), - // Location: to.Ptr("westus2"), - // Identity: &armhybridcompute.Identity{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("e7a068cc-b0b8-46e8-a203-22f301a62a8f"), - // TenantID: to.Ptr("c4098cc-91b8-46c2-a205-d82ab1a62a8f"), - // }, - // Properties: &armhybridcompute.MachineProperties{ - // AgentConfiguration: &armhybridcompute.AgentConfiguration{ - // IncomingConnectionsPorts: []*string{ - // to.Ptr("22"), - // to.Ptr("23")}, - // ProxyURL: to.Ptr("https://test.test"), - // }, - // ClientPublicKey: to.Ptr("string"), - // DetectedProperties: map[string]*string{ - // "cloudprovider": to.Ptr("N/A"), - // "manufacturer": to.Ptr("Microsoft Corporation"), - // "model": to.Ptr("Surfacebook"), - // }, - // LocationData: &armhybridcompute.LocationData{ - // Name: to.Ptr("Redmond"), - // }, - // MssqlDiscovered: to.Ptr("true"), - // OSProfile: &armhybridcompute.OSProfile{ - // LinuxConfiguration: &armhybridcompute.OSProfileLinuxConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // WindowsConfiguration: &armhybridcompute.OSProfileWindowsConfiguration{ - // PatchSettings: &armhybridcompute.PatchSettings{ - // }, - // }, - // }, - // ParentClusterResourceID: to.Ptr("{AzureStackHCIResourceId}"), - // ProvisioningState: to.Ptr("Succeeded"), - // VMID: to.Ptr("a4a098cc-b0b8-46e8-a205-62f301a62a8f"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go index 304730e40838..0031cd331d33 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -47,7 +46,7 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // BeginUpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. @@ -59,7 +58,8 @@ func (client *ManagementClient) BeginUpgradeExtensions(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[ManagementClientUpgradeExtensionsResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagementClientUpgradeExtensionsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagementClientUpgradeExtensionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *ManagementClient) BeginUpgradeExtensions(ctx context.Context, reso // UpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *ManagementClient) upgradeExtensions(ctx context.Context, resourceGroupName string, machineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *ManagementClientBeginUpgradeExtensionsOptions) (*http.Response, error) { + var err error req, err := client.upgradeExtensionsCreateRequest(ctx, resourceGroupName, machineName, extensionUpgradeParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // upgradeExtensionsCreateRequest creates the UpgradeExtensions request. @@ -104,8 +106,11 @@ func (client *ManagementClient) upgradeExtensionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, extensionUpgradeParameters) + if err := runtime.MarshalAsJSON(req, extensionUpgradeParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go deleted file mode 100644 index c79a1f833326..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go +++ /dev/null @@ -1,49 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().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/models.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go index d5e55cb5dd94..9d0c658e363e 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -14,6 +13,10 @@ import "time" // AgentConfiguration - Configurable properties that the user can set locally via the azcmagent config command, or remotely // via ARM. type AgentConfiguration struct { + // READ-ONLY; Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension allowlists + // and guest configuration, maintained by Microsoft. + ConfigMode *AgentConfigurationMode + // READ-ONLY; Array of extensions that are allowed to be installed or updated. ExtensionsAllowList []*ConfigurationExtension @@ -36,6 +39,81 @@ type AgentConfiguration struct { ProxyURL *string } +// AgentUpgrade - The info w.r.t Agent Upgrade. +type AgentUpgrade struct { + // The correlation ID passed in from RSM per upgrade. + CorrelationID *string + + // Specifies the version info w.r.t AgentUpgrade for the machine. + DesiredVersion *string + + // Specifies if RSM should try to upgrade this machine + EnableAutomaticUpgrade *bool + + // READ-ONLY; Specifies the version of the last attempt + LastAttemptDesiredVersion *string + + // READ-ONLY; Failure message of last upgrade attempt if any. + LastAttemptMessage *string + + // READ-ONLY; Specifies the status of Agent Upgrade. + LastAttemptStatus *LastAttemptStatusEnum + + // READ-ONLY; Timestamp of last upgrade attempt + LastAttemptTimestamp *string +} + +// AgentVersion - Describes properties of Agent Version. +type AgentVersion struct { + // Represents the agent version. + AgentVersion *string + + // Represents the download link of specific agent version. + DownloadLink *string + + // Defines the os type. + OSType *string +} + +// AgentVersionsList - Describes AgentVersions List. +type AgentVersionsList struct { + // The URI to fetch the next 10 available Agent Versions. + NextLink *string + + // The list of available Agent Versions. + Value []*AgentVersion +} + +// AvailablePatchCountByClassification - Summarization of patches available for installation on the machine by classification. +type AvailablePatchCountByClassification struct { + // READ-ONLY; Number of critical patches available for installation. + Critical *int32 + + // READ-ONLY; Number of definition patches available for installation. + Definition *int32 + + // READ-ONLY; Number of feature pack patches available for installation. + FeaturePack *int32 + + // READ-ONLY; Number of other patches available for installation. + Other *int32 + + // READ-ONLY; Number of security patches available for installation. + Security *int32 + + // READ-ONLY; Number of service pack patches available for installation. + ServicePack *int32 + + // READ-ONLY; Number of tools patches available for installation. + Tools *int32 + + // READ-ONLY; Number of update Rollup patches available for installation. + UpdateRollup *int32 + + // READ-ONLY; Number of updates category patches available for installation. + Updates *int32 +} + // CloudMetadata - The metadata of the cloud environment (Azure/GCP/AWS/OCI…). type CloudMetadata struct { // READ-ONLY; Specifies the cloud provider (Azure/AWS/GCP…). @@ -95,6 +173,24 @@ type ErrorDetail struct { Target *string } +// ErrorDetailAutoGenerated - The error detail. +type ErrorDetailAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetailAutoGenerated + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { @@ -102,12 +198,148 @@ type ErrorResponse struct { Error *ErrorDetail } +// 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 +} + +// EsuEnrollmentUpdateRecord - ESU enrollment record. +type EsuEnrollmentUpdateRecord struct { + // The Arc ESU enrollment state. + ArcEsuEnrollmentState *ArcEnabledEsuStatus + + // The ESU Key state. + EsuKeyState *EsuKeyState + + // The time that the state has been changed. + Time *time.Time +} + +// EsuKey - ESU key +type EsuKey struct { + // SKU number. + EsuSKU *string + + // The current status of the license profile key. + LicenseStatus *string +} + +// EsuProfileProperties - Describes the properties of a License Profile. +type EsuProfileProperties struct { + // The ESU enrollment state. + ArcEsuEnrollmentState *ArcEnabledEsuStatus + + // Indicates whether there is an ESU Key currently active for the machine. + EsuKeyState *EsuKeyState + + // READ-ONLY; The time records represent the state change of ESU enrollment. + EsuEnrollmentHistory []*EsuEnrollmentUpdateRecord + + // READ-ONLY; The list of ESU keys. + EsuKeys []*EsuKey +} + +// EsuProfileUpdateProperties - Describes the Update properties of a License Profile. +type EsuProfileUpdateProperties struct { + // The ESU enrollment state. + ArcEsuEnrollmentState *ArcEnabledEsuStatus +} + // ExtensionTargetProperties - Describes the Machine Extension Target Version Properties type ExtensionTargetProperties struct { // Properties for the specified Extension to Upgrade. TargetVersion *string } +// ExtensionValue - Describes a Extension Metadata +type ExtensionValue struct { + // The single extension based on search criteria + Properties *ExtensionValueProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ExtensionValueListResult - The List Extension Metadata response. +type ExtensionValueListResult struct { + // READ-ONLY; The list of extension metadata + Value []*ExtensionValue +} + +// ExtensionValueProperties - Describes Extension Metadata properties +type ExtensionValueProperties struct { + // READ-ONLY; The type of the Extension being received. + ExtensionType *string + + // READ-ONLY; The publisher of the Extension being received. + Publisher *string + + // READ-ONLY; The version of the Extension being received. + Version *string +} + +// HybridIdentityMetadata - Defines the HybridIdentityMetadata. +type HybridIdentityMetadata struct { + // REQUIRED; Resource properties. + Properties *HybridIdentityMetadataProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// HybridIdentityMetadataList - List of HybridIdentityMetadata. +type HybridIdentityMetadataList struct { + // REQUIRED; Array of HybridIdentityMetadata + Value []*HybridIdentityMetadata + + // Url to follow for getting next page of HybridIdentityMetadata. + NextLink *string +} + +// HybridIdentityMetadataProperties - Defines the resource properties. +type HybridIdentityMetadataProperties struct { + // The Public Key. + PublicKey *string + + // The unique identifier for the resource. + VMID *string + + // READ-ONLY; Identity for the resource. + Identity *Identity +} + +// IPAddress - Describes properties of the IP address. +type IPAddress struct { + // Represents the IP Address. + Address *string + + // Represents the Ip Address Version. + IPAddressVersion *string + + // READ-ONLY; The subnet to which this IP address belongs. + Subnet *Subnet +} + // Identity for the resource. type Identity struct { // The identity type. @@ -120,6 +352,75 @@ type Identity struct { TenantID *string } +// LicenseProfile - Describes a license profile in a hybrid machine. +type LicenseProfile struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Describe the properties of a license profile. + Properties *LicenseProfileProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LicenseProfileProperties - Describe the properties of a license profile. +type LicenseProfileProperties struct { + // Hybrid Compute ESU Profile properties + EsuProfile *EsuProfileProperties + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *LicenseProfileProvisioningState +} + +// LicenseProfileUpdate - Describes a License Profile Update. +type LicenseProfileUpdate struct { + // Describe the Update properties of a license profile. + Properties *LicenseProfileUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// LicenseProfileUpdateProperties - Describe the Update properties of a license profile. +type LicenseProfileUpdateProperties struct { + // Hybrid Compute ESU Profile Update properties + EsuProfile *EsuProfileUpdateProperties +} + +// LicenseProfilesListResult - The List hybrid machine operation response. +type LicenseProfilesListResult struct { + // REQUIRED; The list of license profiles. + Value []*LicenseProfile + + // The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the next page of license profile. + NextLink *string +} + +// LinuxParameters - Input for InstallPatches on a Linux VM, as directly received by the API +type LinuxParameters struct { + // The update classifications to select when installing patches for Linux. + ClassificationsToInclude []*VMGuestPatchClassificationLinux + + // packages to exclude in the patch operation. Format: packageName_packageVersion + PackageNameMasksToExclude []*string + + // packages to include in the patch operation. Format: packageName_packageVersion + PackageNameMasksToInclude []*string +} + // LocationData - Metadata pertaining to the geographic location of the resource. type LocationData struct { // REQUIRED; A canonical name for the geographic or physical location. @@ -143,6 +444,9 @@ type Machine struct { // Identity for the resource. Identity *Identity + // Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Kind *ArcKindEnum + // Hybrid Compute Machine properties Properties *MachineProperties @@ -155,13 +459,67 @@ type Machine struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; The list of extensions affiliated to the machine + Resources []*MachineExtension + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// MachineAssessPatchesResult - Describes the properties of an AssessPatches result. +type MachineAssessPatchesResult struct { + // Summarization of patches available for installation on the machine by classification. + AvailablePatchCountByClassification *AvailablePatchCountByClassification + + // READ-ONLY; The activity ID of the operation that produced this result. + AssessmentActivityID *string + + // READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + ErrorDetails *ErrorDetail + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time + + // READ-ONLY; The operating system type of the machine. + OSType *OsType + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed + + // READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete + // installation but the reboot has not yet occurred. + RebootPending *bool + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Unknown", "Failed", "Succeeded", or + // "CompletedWithWarnings." + Status *PatchOperationStatus +} + +// MachineEsuProperties - Properties for the Machine ESU profile. +type MachineEsuProperties struct { + // The Arc ESU enrollment state. + ArcEsuEnrollmentState *ArcEnabledEsuStatus + + // Indicates whether there is an ESU Key currently active for the machine. + EsuKeyState *EsuKeyState + + // The list of ESU keys. + EsuKeys []*EsuKey + + // Indicates whether server is a Standard or Datacenter Sku. + ServerType *ArcServerType +} + // MachineExtension - Describes a Machine Extension. type MachineExtension struct { // REQUIRED; The geo-location where the resource lives @@ -179,7 +537,7 @@ type MachineExtension struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -236,13 +594,13 @@ type MachineExtensionProperties struct { InstanceView *MachineExtensionInstanceView // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any + ProtectedSettings map[string]any // The name of the extension handler publisher. Publisher *string // Json formatted public settings for the extension. - Settings any + Settings map[string]any // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string @@ -270,17 +628,20 @@ type MachineExtensionUpdateProperties struct { // with this property set to true. AutoUpgradeMinorVersion *bool + // Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. + EnableAutomaticUpgrade *bool + // How the extension handler should be forced to update even if the extension configuration has not changed. ForceUpdateTag *string // The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - ProtectedSettings any + ProtectedSettings map[string]any // The name of the extension handler publisher. Publisher *string // Json formatted public settings for the extension. - Settings any + Settings map[string]any // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string @@ -289,51 +650,85 @@ type MachineExtensionUpdateProperties struct { TypeHandlerVersion *string } -// MachineExtensionUpgrade - Describes the Machine Extension Upgrade Properties +// MachineExtensionUpgrade - Describes the Machine Extension Upgrade Properties. type MachineExtensionUpgrade struct { // Describes the Extension Target Properties. ExtensionTargets map[string]*ExtensionTargetProperties } -// MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate -// method. -type MachineExtensionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// MachineExtensionsListResult - Describes the Machine Extensions List Result. +type MachineExtensionsListResult struct { + // The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. + NextLink *string -// MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete -// method. -type MachineExtensionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // The list of extensions + Value []*MachineExtension } -// MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate -// method. -type MachineExtensionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// 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 -// MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. -type MachineExtensionsClientGetOptions struct { - // placeholder for future optional parameters -} + // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. + RebootSetting *VMGuestPatchRebootSetting -// MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager method. -type MachineExtensionsClientListOptions struct { - // The expand expression to apply on the operation. - Expand *string + // Input for InstallPatches on a Linux VM, as directly received by the API + LinuxParameters *LinuxParameters + + // Input for InstallPatches on a Windows VM, as directly received by the API + WindowsParameters *WindowsParameters } -// MachineExtensionsListResult - Describes the Machine Extensions List Result. -type MachineExtensionsListResult struct { - // The uri to fetch the next page of machine extensions. Call ListNext() with this to fetch the next page of extensions. - NextLink *string +// 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 - // The list of extensions - Value []*MachineExtension + // READ-ONLY; The number of patches that were not installed due to the user blocking their installation. + ExcludedPatchCount *int32 + + // READ-ONLY; The number of patches that could not be installed due to some issue. See errors for details. + FailedPatchCount *int32 + + // READ-ONLY; The activity ID of the operation that produced this result. + InstallationActivityID *string + + // READ-ONLY; The number of patches successfully installed. + InstalledPatchCount *int32 + + // READ-ONLY; The UTC timestamp when the operation finished. + LastModifiedDateTime *time.Time + + // READ-ONLY; Whether the operation ran out of time before it completed all its intended actions. + MaintenanceWindowExceeded *bool + + // READ-ONLY; The number of patches that were detected as available for install, but did not meet the operation's criteria. + NotSelectedPatchCount *int32 + + // READ-ONLY; The operating system type of the machine. + OSType *OsType + + // READ-ONLY; Specifies the patch service used for the operation. + PatchServiceUsed *PatchServiceUsed + + // READ-ONLY; The number of patches that were identified as meeting the installation criteria, but were not able to be installed. + // Typically this happens when maintenanceWindowExceeded == true. + PendingPatchCount *int32 + + // READ-ONLY; The reboot state of the VM following completion of the operation. + RebootStatus *VMGuestPatchRebootStatus + + // READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *time.Time + + // READ-ONLY; Indicates if operation was triggered by user or by platform. + StartedBy *PatchOperationStartedBy + + // READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. + // At that point it will become "Failed", "Succeeded", "Unknown" or "CompletedWithWarnings." + Status *PatchOperationStatus } // MachineListResult - The List hybrid machine operation response. @@ -347,13 +742,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 + // Public Key that the client provides to be used during initial resource onboarding ClientPublicKey *string // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata - // Machine Extensions information + // Machine Extensions information (deprecated field) Extensions []*MachineExtensionInstanceView // Metadata pertaining to the geographic location of the resource. @@ -404,12 +802,18 @@ type MachineProperties struct { // READ-ONLY; Details about the error state. ErrorDetails []*ErrorDetail + // READ-ONLY; Specifies the ESU related properties for a machine. + EsuProperties *MachineEsuProperties + // READ-ONLY; The time of the last status change. LastStatusChange *time.Time // READ-ONLY; Specifies the hybrid machine FQDN. MachineFqdn *string + // READ-ONLY; Information about the network the machine is on. + NetworkProfile *NetworkProfile + // READ-ONLY; The Operating System running on the hybrid machine. OSName *string @@ -434,6 +838,9 @@ type MachineUpdate struct { // Identity for the resource. Identity *Identity + // Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Kind *ArcKindEnum + // Hybrid Compute Machine properties Properties *MachineUpdateProperties @@ -443,6 +850,9 @@ type MachineUpdate struct { // MachineUpdateProperties - Describes the ARM updatable properties of a hybrid machine. type MachineUpdateProperties struct { + // The info of the machine w.r.t Agent Upgrade + AgentUpgrade *AgentUpgrade + // The metadata of the cloud environment (Azure/GCP/AWS/OCI…). CloudMetadata *CloudMetadata @@ -459,44 +869,16 @@ type MachineUpdateProperties struct { PrivateLinkScopeResourceID *string } -// MachinesClientCreateOrUpdateOptions contains the optional parameters for the MachinesClient.CreateOrUpdate method. -type MachinesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MachinesClientDeleteOptions contains the optional parameters for the MachinesClient.Delete method. -type MachinesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. -type MachinesClientGetOptions struct { - // The expand expression to apply on the operation. - Expand *InstanceViewTypes -} - -// 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.NewListBySubscriptionPager -// method. -type MachinesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters +// NetworkInterface - Describes a network interface. +type NetworkInterface struct { + // The list of IP addresses in this interface. + IPAddresses []*IPAddress } -// MachinesClientUpdateOptions contains the optional parameters for the MachinesClient.Update method. -type MachinesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientBeginUpgradeExtensionsOptions contains the optional parameters for the ManagementClient.BeginUpgradeExtensions -// method. -type ManagementClientBeginUpgradeExtensionsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// NetworkProfile - Describes the network information on this machine. +type NetworkProfile struct { + // The list of network interfaces. + NetworkInterfaces []*NetworkInterface } // OSProfile - Specifies the operating system settings for the hybrid machine. @@ -559,11 +941,6 @@ type OperationValueDisplay struct { Resource *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PatchSettings - Specifies the patch settings. type PatchSettings struct { // Specifies the assessment mode. @@ -584,7 +961,7 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -630,32 +1007,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager -// method. -type PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpointProperty - Private endpoint which the connection belongs to. type PrivateEndpointProperty struct { // Resource id of the private endpoint. @@ -673,7 +1024,7 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system meta data relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -701,17 +1052,6 @@ type PrivateLinkResourceProperties struct { RequiredZoneNames []*string } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager -// method. -type PrivateLinkResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkScope - An Azure Arc PrivateLinkScope definition. type PrivateLinkScope struct { // REQUIRED; Resource location @@ -774,52 +1114,6 @@ type PrivateLinkScopeValidationDetails struct { ID *string } -// PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. -type PrivateLinkScopesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. -type PrivateLinkScopesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. -type PrivateLinkScopesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientGetValidationDetailsForMachineOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetailsForMachine -// method. -type PrivateLinkScopesClientGetValidationDetailsForMachineOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientGetValidationDetailsOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetails -// method. -type PrivateLinkScopesClientGetValidationDetailsOptions struct { - // placeholder for future optional parameters -} - -// 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.NewListPager method. -type PrivateLinkScopesClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags method. -type PrivateLinkScopesClientUpdateTagsOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkScopesResource - An azure resource object type PrivateLinkScopesResource struct { // REQUIRED; Resource location @@ -859,6 +1153,9 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -871,6 +1168,9 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -899,6 +1199,12 @@ type ServiceStatuses struct { GuestConfigurationService *ServiceStatus } +// Subnet - Describes the subnet. +type Subnet struct { + // Represents address prefix. + AddressPrefix *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -942,6 +1248,27 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } + +// 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 + + // Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is set to true. + ExcludeKbsRequiringReboot *bool + + // Kbs to exclude in the patch operation + KbNumbersToExclude []*string + + // Kbs to include in the patch operation + KbNumbersToInclude []*string + + // This is used to install patches that were published on or before this given max published date. + MaxPatchPublishDate *time.Time +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go index ee1d027bb6a0..a1ebcb000fa4 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -19,6 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AgentConfiguration. func (a AgentConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "configMode", a.ConfigMode) populate(objectMap, "extensionsAllowList", a.ExtensionsAllowList) populate(objectMap, "extensionsBlockList", a.ExtensionsBlockList) populate(objectMap, "extensionsEnabled", a.ExtensionsEnabled) @@ -38,6 +38,9 @@ func (a *AgentConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "configMode": + err = unpopulate(val, "ConfigMode", &a.ConfigMode) + delete(rawMsg, key) case "extensionsAllowList": err = unpopulate(val, "ExtensionsAllowList", &a.ExtensionsAllowList) delete(rawMsg, key) @@ -67,6 +70,182 @@ func (a *AgentConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AgentUpgrade. +func (a AgentUpgrade) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationId", a.CorrelationID) + populate(objectMap, "desiredVersion", a.DesiredVersion) + populate(objectMap, "enableAutomaticUpgrade", a.EnableAutomaticUpgrade) + populate(objectMap, "lastAttemptDesiredVersion", a.LastAttemptDesiredVersion) + populate(objectMap, "lastAttemptMessage", a.LastAttemptMessage) + populate(objectMap, "lastAttemptStatus", a.LastAttemptStatus) + populate(objectMap, "lastAttemptTimestamp", a.LastAttemptTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentUpgrade. +func (a *AgentUpgrade) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationId": + err = unpopulate(val, "CorrelationID", &a.CorrelationID) + delete(rawMsg, key) + case "desiredVersion": + err = unpopulate(val, "DesiredVersion", &a.DesiredVersion) + delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &a.EnableAutomaticUpgrade) + delete(rawMsg, key) + case "lastAttemptDesiredVersion": + err = unpopulate(val, "LastAttemptDesiredVersion", &a.LastAttemptDesiredVersion) + delete(rawMsg, key) + case "lastAttemptMessage": + err = unpopulate(val, "LastAttemptMessage", &a.LastAttemptMessage) + delete(rawMsg, key) + case "lastAttemptStatus": + err = unpopulate(val, "LastAttemptStatus", &a.LastAttemptStatus) + delete(rawMsg, key) + case "lastAttemptTimestamp": + err = unpopulate(val, "LastAttemptTimestamp", &a.LastAttemptTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentVersion. +func (a AgentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agentVersion", a.AgentVersion) + populate(objectMap, "downloadLink", a.DownloadLink) + populate(objectMap, "osType", a.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentVersion. +func (a *AgentVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentVersion": + err = unpopulate(val, "AgentVersion", &a.AgentVersion) + delete(rawMsg, key) + case "downloadLink": + err = unpopulate(val, "DownloadLink", &a.DownloadLink) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &a.OSType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgentVersionsList. +func (a AgentVersionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentVersionsList. +func (a *AgentVersionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailablePatchCountByClassification. +func (a AvailablePatchCountByClassification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "critical", a.Critical) + populate(objectMap, "definition", a.Definition) + populate(objectMap, "featurePack", a.FeaturePack) + populate(objectMap, "other", a.Other) + populate(objectMap, "security", a.Security) + populate(objectMap, "servicePack", a.ServicePack) + populate(objectMap, "tools", a.Tools) + populate(objectMap, "updateRollup", a.UpdateRollup) + populate(objectMap, "updates", a.Updates) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailablePatchCountByClassification. +func (a *AvailablePatchCountByClassification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "critical": + err = unpopulate(val, "Critical", &a.Critical) + delete(rawMsg, key) + case "definition": + err = unpopulate(val, "Definition", &a.Definition) + delete(rawMsg, key) + case "featurePack": + err = unpopulate(val, "FeaturePack", &a.FeaturePack) + delete(rawMsg, key) + case "other": + err = unpopulate(val, "Other", &a.Other) + delete(rawMsg, key) + case "security": + err = unpopulate(val, "Security", &a.Security) + delete(rawMsg, key) + case "servicePack": + err = unpopulate(val, "ServicePack", &a.ServicePack) + delete(rawMsg, key) + case "tools": + err = unpopulate(val, "Tools", &a.Tools) + delete(rawMsg, key) + case "updateRollup": + err = unpopulate(val, "UpdateRollup", &a.UpdateRollup) + delete(rawMsg, key) + case "updates": + err = unpopulate(val, "Updates", &a.Updates) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CloudMetadata. func (c CloudMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -242,6 +421,49 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { 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) @@ -269,63 +491,677 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionTargetProperties. -func (e ExtensionTargetProperties) MarshalJSON() ([]byte, error) { +// 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 EsuEnrollmentUpdateRecord. +func (e EsuEnrollmentUpdateRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcEsuEnrollmentState", e.ArcEsuEnrollmentState) + populate(objectMap, "esuKeyState", e.EsuKeyState) + populateTimeRFC3339(objectMap, "time", e.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuEnrollmentUpdateRecord. +func (e *EsuEnrollmentUpdateRecord) 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 "arcEsuEnrollmentState": + err = unpopulate(val, "ArcEsuEnrollmentState", &e.ArcEsuEnrollmentState) + delete(rawMsg, key) + case "esuKeyState": + err = unpopulate(val, "EsuKeyState", &e.EsuKeyState) + delete(rawMsg, key) + case "time": + err = unpopulateTimeRFC3339(val, "Time", &e.Time) + 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 EsuKey. +func (e EsuKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuSku", e.EsuSKU) + populate(objectMap, "licenseStatus", e.LicenseStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuKey. +func (e *EsuKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuSku": + err = unpopulate(val, "EsuSKU", &e.EsuSKU) + delete(rawMsg, key) + case "licenseStatus": + err = unpopulate(val, "LicenseStatus", &e.LicenseStatus) + 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 EsuProfileProperties. +func (e EsuProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcEsuEnrollmentState", e.ArcEsuEnrollmentState) + populate(objectMap, "esuEnrollmentHistory", e.EsuEnrollmentHistory) + populate(objectMap, "esuKeyState", e.EsuKeyState) + populate(objectMap, "esuKeys", e.EsuKeys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuProfileProperties. +func (e *EsuProfileProperties) 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 "arcEsuEnrollmentState": + err = unpopulate(val, "ArcEsuEnrollmentState", &e.ArcEsuEnrollmentState) + delete(rawMsg, key) + case "esuEnrollmentHistory": + err = unpopulate(val, "EsuEnrollmentHistory", &e.EsuEnrollmentHistory) + delete(rawMsg, key) + case "esuKeyState": + err = unpopulate(val, "EsuKeyState", &e.EsuKeyState) + delete(rawMsg, key) + case "esuKeys": + err = unpopulate(val, "EsuKeys", &e.EsuKeys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EsuProfileUpdateProperties. +func (e EsuProfileUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcEsuEnrollmentState", e.ArcEsuEnrollmentState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EsuProfileUpdateProperties. +func (e *EsuProfileUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arcEsuEnrollmentState": + err = unpopulate(val, "ArcEsuEnrollmentState", &e.ArcEsuEnrollmentState) + 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 HybridIdentityMetadata. +func (h HybridIdentityMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadata. +func (h *HybridIdentityMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataList. +func (h HybridIdentityMetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataList. +func (h *HybridIdentityMetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridIdentityMetadataProperties. +func (h HybridIdentityMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", h.Identity) + populate(objectMap, "publicKey", h.PublicKey) + populate(objectMap, "vmId", h.VMID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridIdentityMetadataProperties. +func (h *HybridIdentityMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &h.Identity) + delete(rawMsg, key) + case "publicKey": + err = unpopulate(val, "PublicKey", &h.PublicKey) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &h.VMID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAddress. +func (i IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", i.Address) + populate(objectMap, "ipAddressVersion", i.IPAddressVersion) + populate(objectMap, "subnet", i.Subnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. +func (i *IPAddress) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &i.Address) + delete(rawMsg, key) + case "ipAddressVersion": + err = unpopulate(val, "IPAddressVersion", &i.IPAddressVersion) + delete(rawMsg, key) + case "subnet": + err = unpopulate(val, "Subnet", &i.Subnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + objectMap["type"] = "SystemAssigned" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfile. +func (l LicenseProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfile. +func (l *LicenseProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileProperties. +func (l LicenseProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuProfile", l.EsuProfile) + populate(objectMap, "provisioningState", l.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileProperties. +func (l *LicenseProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuProfile": + err = unpopulate(val, "EsuProfile", &l.EsuProfile) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdate. +func (l LicenseProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdate. +func (l *LicenseProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfileUpdateProperties. +func (l LicenseProfileUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "esuProfile", l.EsuProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfileUpdateProperties. +func (l *LicenseProfileUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "esuProfile": + err = unpopulate(val, "EsuProfile", &l.EsuProfile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LicenseProfilesListResult. +func (l LicenseProfilesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "targetVersion", e.TargetVersion) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTargetProperties. -func (e *ExtensionTargetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LicenseProfilesListResult. +func (l *LicenseProfilesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "targetVersion": - err = unpopulate(val, "TargetVersion", &e.TargetVersion) + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LinuxParameters. +func (l LinuxParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + 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 Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// 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", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "classificationsToInclude": + err = unpopulate(val, "ClassificationsToInclude", &l.ClassificationsToInclude) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "packageNameMasksToExclude": + err = unpopulate(val, "PackageNameMasksToExclude", &l.PackageNameMasksToExclude) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "packageNameMasksToInclude": + err = unpopulate(val, "PackageNameMasksToInclude", &l.PackageNameMasksToInclude) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil @@ -375,9 +1211,11 @@ func (m Machine) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "identity", m.Identity) + populate(objectMap, "kind", m.Kind) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) + populate(objectMap, "resources", m.Resources) populate(objectMap, "systemData", m.SystemData) populate(objectMap, "tags", m.Tags) populate(objectMap, "type", m.Type) @@ -399,6 +1237,9 @@ func (m *Machine) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &m.Identity) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -408,6 +1249,9 @@ func (m *Machine) UnmarshalJSON(data []byte) error { 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) @@ -425,6 +1269,108 @@ func (m *Machine) UnmarshalJSON(data []byte) error { 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 MachineEsuProperties. +func (m MachineEsuProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arcEsuEnrollmentState", m.ArcEsuEnrollmentState) + populate(objectMap, "esuKeyState", m.EsuKeyState) + populate(objectMap, "esuKeys", m.EsuKeys) + populate(objectMap, "serverType", m.ServerType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineEsuProperties. +func (m *MachineEsuProperties) 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 "arcEsuEnrollmentState": + err = unpopulate(val, "ArcEsuEnrollmentState", &m.ArcEsuEnrollmentState) + delete(rawMsg, key) + case "esuKeyState": + err = unpopulate(val, "EsuKeyState", &m.EsuKeyState) + delete(rawMsg, key) + case "esuKeys": + err = unpopulate(val, "EsuKeys", &m.EsuKeys) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &m.ServerType) + 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) @@ -565,10 +1511,10 @@ func (m MachineExtensionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) populate(objectMap, "instanceView", m.InstanceView) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) + populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) @@ -656,10 +1602,11 @@ func (m *MachineExtensionUpdate) UnmarshalJSON(data []byte) error { func (m MachineExtensionUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoUpgradeMinorVersion", m.AutoUpgradeMinorVersion) + populate(objectMap, "enableAutomaticUpgrade", m.EnableAutomaticUpgrade) populate(objectMap, "forceUpdateTag", m.ForceUpdateTag) - populateAny(objectMap, "protectedSettings", m.ProtectedSettings) + populate(objectMap, "protectedSettings", m.ProtectedSettings) populate(objectMap, "publisher", m.Publisher) - populateAny(objectMap, "settings", m.Settings) + populate(objectMap, "settings", m.Settings) populate(objectMap, "type", m.Type) populate(objectMap, "typeHandlerVersion", m.TypeHandlerVersion) return json.Marshal(objectMap) @@ -677,6 +1624,9 @@ func (m *MachineExtensionUpdateProperties) UnmarshalJSON(data []byte) error { case "autoUpgradeMinorVersion": err = unpopulate(val, "AutoUpgradeMinorVersion", &m.AutoUpgradeMinorVersion) delete(rawMsg, key) + case "enableAutomaticUpgrade": + err = unpopulate(val, "EnableAutomaticUpgrade", &m.EnableAutomaticUpgrade) + delete(rawMsg, key) case "forceUpdateTag": err = unpopulate(val, "ForceUpdateTag", &m.ForceUpdateTag) delete(rawMsg, key) @@ -761,6 +1711,128 @@ func (m *MachineExtensionsListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesParameters. +func (m MachineInstallPatchesParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "linuxParameters", m.LinuxParameters) + populate(objectMap, "maximumDuration", m.MaximumDuration) + populate(objectMap, "rebootSetting", m.RebootSetting) + populate(objectMap, "windowsParameters", m.WindowsParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineInstallPatchesParameters. +func (m *MachineInstallPatchesParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linuxParameters": + err = unpopulate(val, "LinuxParameters", &m.LinuxParameters) + delete(rawMsg, key) + case "maximumDuration": + err = unpopulate(val, "MaximumDuration", &m.MaximumDuration) + delete(rawMsg, key) + case "rebootSetting": + err = unpopulate(val, "RebootSetting", &m.RebootSetting) + delete(rawMsg, key) + case "windowsParameters": + err = unpopulate(val, "WindowsParameters", &m.WindowsParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineInstallPatchesResult. +func (m MachineInstallPatchesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorDetails", m.ErrorDetails) + populate(objectMap, "excludedPatchCount", m.ExcludedPatchCount) + populate(objectMap, "failedPatchCount", m.FailedPatchCount) + populate(objectMap, "installationActivityId", m.InstallationActivityID) + populate(objectMap, "installedPatchCount", m.InstalledPatchCount) + 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) @@ -797,6 +1869,7 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adFqdn", m.AdFqdn) populate(objectMap, "agentConfiguration", m.AgentConfiguration) + populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "agentVersion", m.AgentVersion) populate(objectMap, "clientPublicKey", m.ClientPublicKey) populate(objectMap, "cloudMetadata", m.CloudMetadata) @@ -805,11 +1878,13 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "displayName", m.DisplayName) populate(objectMap, "domainName", m.DomainName) populate(objectMap, "errorDetails", m.ErrorDetails) + populate(objectMap, "esuProperties", m.EsuProperties) 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, "networkProfile", m.NetworkProfile) populate(objectMap, "osName", m.OSName) populate(objectMap, "osProfile", m.OSProfile) populate(objectMap, "osSku", m.OSSKU) @@ -840,6 +1915,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "agentConfiguration": err = unpopulate(val, "AgentConfiguration", &m.AgentConfiguration) delete(rawMsg, key) + case "agentUpgrade": + err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) + delete(rawMsg, key) case "agentVersion": err = unpopulate(val, "AgentVersion", &m.AgentVersion) delete(rawMsg, key) @@ -864,6 +1942,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "errorDetails": err = unpopulate(val, "ErrorDetails", &m.ErrorDetails) delete(rawMsg, key) + case "esuProperties": + err = unpopulate(val, "EsuProperties", &m.EsuProperties) + delete(rawMsg, key) case "extensions": err = unpopulate(val, "Extensions", &m.Extensions) delete(rawMsg, key) @@ -879,6 +1960,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "mssqlDiscovered": err = unpopulate(val, "MssqlDiscovered", &m.MssqlDiscovered) delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &m.NetworkProfile) + delete(rawMsg, key) case "osName": err = unpopulate(val, "OSName", &m.OSName) delete(rawMsg, key) @@ -927,6 +2011,7 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { func (m MachineUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", m.Identity) + populate(objectMap, "kind", m.Kind) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) @@ -944,6 +2029,9 @@ func (m *MachineUpdate) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &m.Identity) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) @@ -961,6 +2049,7 @@ func (m *MachineUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MachineUpdateProperties. func (m MachineUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentUpgrade", m.AgentUpgrade) populate(objectMap, "cloudMetadata", m.CloudMetadata) populate(objectMap, "locationData", m.LocationData) populate(objectMap, "osProfile", m.OSProfile) @@ -978,6 +2067,9 @@ func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "agentUpgrade": + err = unpopulate(val, "AgentUpgrade", &m.AgentUpgrade) + delete(rawMsg, key) case "cloudMetadata": err = unpopulate(val, "CloudMetadata", &m.CloudMetadata) delete(rawMsg, key) @@ -1001,6 +2093,60 @@ func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipAddresses", n.IPAddresses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. +func (n *NetworkInterface) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &n.IPAddresses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkInterfaces", n.NetworkInterfaces) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterfaces": + err = unpopulate(val, "NetworkInterfaces", &n.NetworkInterfaces) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OSProfile. func (o OSProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1753,6 +2899,7 @@ 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) } @@ -1772,6 +2919,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { 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) @@ -1788,6 +2938,7 @@ 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) } @@ -1807,6 +2958,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { 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) @@ -1907,6 +3061,33 @@ func (s *ServiceStatuses) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefix", s.AddressPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Subnet. +func (s *Subnet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefix": + err = unpopulate(val, "AddressPrefix", &s.AddressPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1987,6 +3168,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { 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) @@ -2010,6 +3192,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { 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) @@ -2024,6 +3209,49 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { 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 diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go new file mode 100644 index 000000000000..17931b23ebbb --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NetworkProfileClient contains the methods for the NetworkProfile group. +// Don't use this type directly, use NewNetworkProfileClient() instead. +type NetworkProfileClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkProfileClient creates a new instance of NetworkProfileClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewNetworkProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkProfileClient, error) { + cl, err := arm.NewClient(moduleName+".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 2023-06-20-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - NetworkProfileClientGetOptions contains the optional parameters for the NetworkProfileClient.Get method. +func (client *NetworkProfileClient) Get(ctx context.Context, resourceGroupName string, machineName string, options *NetworkProfileClientGetOptions) (NetworkProfileClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, options) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkProfileClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkProfileClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkProfileClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *NetworkProfileClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-20-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkProfileClient) getHandleResponse(resp *http.Response) (NetworkProfileClientGetResponse, error) { + result := NetworkProfileClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfile); err != nil { + return NetworkProfileClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go index 7a9f6844822b..2e7873e3bbd6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of hybrid compute operations. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +71,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go deleted file mode 100644 index c2624eb512fc..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armhybridcompute.OperationListResult{ - // Value: []*armhybridcompute.OperationValue{ - // { - // Name: to.Ptr("Microsoft.HybridCompute/operations/read"), - // Display: &armhybridcompute.OperationValueDisplay{ - // Description: to.Ptr("Read all Operations for Azure Arc for Servers"), - // Operation: to.Ptr("Read all Operations"), - // Provider: to.Ptr("Microsoft HybridCompute"), - // Resource: to.Ptr("Microsoft.HybridCompute Resource Provider"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.HybridCompute/register/action"), - // Display: &armhybridcompute.OperationValueDisplay{ - // Description: to.Ptr("Registers the subscription for the Microsoft.HybridCompute Resource Provider"), - // Operation: to.Ptr("Register Subscription for Azure Arc for Servers"), - // Provider: to.Ptr("Microsoft HybridCompute"), - // Resource: to.Ptr("Microsoft.HybridCompute Resource Provider"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr("user,system"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go new file mode 100644 index 000000000000..926b6c81d7a3 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go @@ -0,0 +1,246 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armhybridcompute + +// AgentVersionClientGetOptions contains the optional parameters for the AgentVersionClient.Get method. +type AgentVersionClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgentVersionClientListOptions contains the optional parameters for the AgentVersionClient.List method. +type AgentVersionClientListOptions struct { + // placeholder for future optional parameters +} + +// ExtensionMetadataClientGetOptions contains the optional parameters for the ExtensionMetadataClient.Get method. +type ExtensionMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtensionMetadataClientListOptions contains the optional parameters for the ExtensionMetadataClient.NewListPager method. +type ExtensionMetadataClientListOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientGetOptions contains the optional parameters for the HybridIdentityMetadataClient.Get method. +type HybridIdentityMetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// HybridIdentityMetadataClientListByMachinesOptions contains the optional parameters for the HybridIdentityMetadataClient.NewListByMachinesPager +// method. +type HybridIdentityMetadataClientListByMachinesOptions struct { + // placeholder for future optional parameters +} + +// LicenseProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginCreateOrUpdate +// method. +type LicenseProfilesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientBeginDeleteOptions contains the optional parameters for the LicenseProfilesClient.BeginDelete method. +type LicenseProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientBeginUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginUpdate method. +type LicenseProfilesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LicenseProfilesClientGetOptions contains the optional parameters for the LicenseProfilesClient.Get method. +type LicenseProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LicenseProfilesClientListOptions contains the optional parameters for the LicenseProfilesClient.NewListPager method. +type LicenseProfilesClientListOptions struct { + // placeholder for future optional parameters +} + +// MachineExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginCreateOrUpdate +// method. +type MachineExtensionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachineExtensionsClientBeginDeleteOptions contains the optional parameters for the MachineExtensionsClient.BeginDelete +// method. +type MachineExtensionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachineExtensionsClientBeginUpdateOptions contains the optional parameters for the MachineExtensionsClient.BeginUpdate +// method. +type MachineExtensionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachineExtensionsClientGetOptions contains the optional parameters for the MachineExtensionsClient.Get method. +type MachineExtensionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager method. +type MachineExtensionsClientListOptions struct { + // The expand expression to apply on the operation. + Expand *string +} + +// MachinesClientBeginAssessPatchesOptions contains the optional parameters for the MachinesClient.BeginAssessPatches method. +type MachinesClientBeginAssessPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachinesClientBeginInstallPatchesOptions contains the optional parameters for the MachinesClient.BeginInstallPatches method. +type MachinesClientBeginInstallPatchesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachinesClientCreateOrUpdateOptions contains the optional parameters for the MachinesClient.CreateOrUpdate method. +type MachinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MachinesClientDeleteOptions contains the optional parameters for the MachinesClient.Delete method. +type MachinesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. +type MachinesClientGetOptions struct { + // The expand expression to apply on the operation. + Expand *InstanceViewTypes +} + +// 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.NewListBySubscriptionPager +// method. +type MachinesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// MachinesClientUpdateOptions contains the optional parameters for the MachinesClient.Update method. +type MachinesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientBeginUpgradeExtensionsOptions contains the optional parameters for the ManagementClient.BeginUpgradeExtensions +// method. +type ManagementClientBeginUpgradeExtensionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkProfileClientGetOptions contains the optional parameters for the NetworkProfileClient.Get method. +type NetworkProfileClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager +// method. +type PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager +// method. +type PrivateLinkResourcesClientListByPrivateLinkScopeOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete +// method. +type PrivateLinkScopesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate +// method. +type PrivateLinkScopesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. +type PrivateLinkScopesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkScopesClientGetValidationDetailsForMachineOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetailsForMachine +// method. +type PrivateLinkScopesClientGetValidationDetailsForMachineOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkScopesClientGetValidationDetailsOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetails +// method. +type PrivateLinkScopesClientGetValidationDetailsOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager method. +type PrivateLinkScopesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags method. +type PrivateLinkScopesClientUpdateTagsOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go index 33486947f382..092747aff6e6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -47,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -59,7 +58,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -129,7 +134,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +144,22 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +186,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,25 +195,28 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager @@ -302,7 +313,7 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go deleted file mode 100644 index 538a2a6322b7..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "myPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armhybridcompute.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("hybridcompute")}, - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armhybridcompute.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("hybridcompute")}, - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByPrivateLinkScopePager("myResourceGroup", "myPrivateLinkScope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armhybridcompute.PrivateEndpointConnectionListResult{ - // Value: []*armhybridcompute.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("hybridcompute")}, - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("hybridcompute")}, - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Please approve my connection."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Pending"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go index 2dada9607828..a024ddf8d2fb 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -47,25 +46,28 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - groupName - The name of the private link resource. // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByPrivateLinkScopePager - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager @@ -162,7 +164,7 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go deleted file mode 100644 index 1bbfb2fb3fd3..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByPrivateLinkScopePager("myResourceGroup", "myPrivateLinkScope", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armhybridcompute.PrivateLinkResourceListResult{ - // Value: []*armhybridcompute.PrivateLinkResource{ - // { - // Name: to.Ptr("hybridcompute"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateLinkResources/hybridcompute"), - // Properties: &armhybridcompute.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("hybridcompute"), - // RequiredMembers: []*string{ - // to.Ptr("HybridCompute.ServerDP"), - // to.Ptr("HybridCompute.K8sConfigurationDP"), - // to.Ptr("HybridCompute.GuestConfigDP")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.his.arc.azure.com"), - // to.Ptr("privatelink.kubernetesconfiguration.azure.com"), - // to.Ptr("privatelink.Guestconfiguration.azure.com")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "myPrivateLinkScope", "hybridcompute", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armhybridcompute.PrivateLinkResource{ - // Name: to.Ptr("hybridcompute"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateLinkResources/hybridcompute"), - // Properties: &armhybridcompute.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("hybridcompute"), - // RequiredMembers: []*string{ - // to.Ptr("HybridCompute.Server"), - // to.Ptr("HybridCompute.K8sConfiguration"), - // to.Ptr("GuestConfig.DP")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.his.arc.azure.com"), - // to.Ptr("privatelink.kubernetesconfiguration.azure.com"), - // to.Ptr("privatelink.Guestconfiguration.azure.com")}, - // }, - // } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go index 7e126d0a9036..26d8dd0e0717 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute @@ -48,25 +47,28 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // nor AppId in the Put operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - parameters - Properties that need to be specified to create or update a Azure Arc for Servers and Clusters PrivateLinkScope. // - 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) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, parameters, options) if err != nil { return PrivateLinkScopesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkScopesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -89,10 +91,13 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -107,7 +112,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.R // BeginDelete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete @@ -118,7 +123,8 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[PrivateLinkScopesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateLinkScopesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateLinkScopesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -127,20 +133,22 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -163,7 +171,7 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,23 +180,26 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, // Get - Returns a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (PrivateLinkScopesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { return PrivateLinkScopesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkScopesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkScopesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -211,7 +222,7 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,24 +240,27 @@ func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (P // GetValidationDetails - Returns a Azure Arc PrivateLinkScope's validation details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - location - The location of the target resource. // - privateLinkScopeID - The id (Guid) of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetValidationDetailsOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetails // method. func (client *PrivateLinkScopesClient) GetValidationDetails(ctx context.Context, location string, privateLinkScopeID string, options *PrivateLinkScopesClientGetValidationDetailsOptions) (PrivateLinkScopesClientGetValidationDetailsResponse, error) { + var err error req, err := client.getValidationDetailsCreateRequest(ctx, location, privateLinkScopeID, options) if err != nil { return PrivateLinkScopesClientGetValidationDetailsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetValidationDetailsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkScopesClientGetValidationDetailsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkScopesClientGetValidationDetailsResponse{}, err } - return client.getValidationDetailsHandleResponse(resp) + resp, err := client.getValidationDetailsHandleResponse(httpResp) + return resp, err } // getValidationDetailsCreateRequest creates the GetValidationDetails request. @@ -269,7 +283,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,24 +301,27 @@ func (client *PrivateLinkScopesClient) getValidationDetailsHandleResponse(resp * // GetValidationDetailsForMachine - Returns a Azure Arc PrivateLinkScope's validation details for a given machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the target machine to get the private link scope validation details for. // - options - PrivateLinkScopesClientGetValidationDetailsForMachineOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetailsForMachine // method. func (client *PrivateLinkScopesClient) GetValidationDetailsForMachine(ctx context.Context, resourceGroupName string, machineName string, options *PrivateLinkScopesClientGetValidationDetailsForMachineOptions) (PrivateLinkScopesClientGetValidationDetailsForMachineResponse, error) { + var err error req, err := client.getValidationDetailsForMachineCreateRequest(ctx, resourceGroupName, machineName, options) if err != nil { return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkScopesClientGetValidationDetailsForMachineResponse{}, err } - return client.getValidationDetailsForMachineHandleResponse(resp) + resp, err := client.getValidationDetailsForMachineHandleResponse(httpResp) + return resp, err } // getValidationDetailsForMachineCreateRequest creates the GetValidationDetailsForMachine request. @@ -327,7 +344,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +361,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineHandleRespo // NewListPager - Gets a list of all Azure Arc PrivateLinkScopes within a subscription. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager // method. func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { @@ -387,7 +404,7 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -404,7 +421,7 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Gets a list of Azure Arc PrivateLinkScopes within a resource group. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager // method. @@ -452,7 +469,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -470,25 +487,28 @@ func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *h // UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-03-10 +// Generated from API version 2023-06-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. // - 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) { + var err error req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, scopeName, privateLinkScopeTags, options) if err != nil { return PrivateLinkScopesClientUpdateTagsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkScopesClientUpdateTagsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkScopesClientUpdateTagsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkScopesClientUpdateTagsResponse{}, err } - return client.updateTagsHandleResponse(resp) + resp, err := client.updateTagsHandleResponse(httpResp) + return resp, err } // updateTagsCreateRequest creates the UpdateTags request. @@ -511,10 +531,13 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-10") + reqQP.Set("api-version", "2023-06-20-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, privateLinkScopeTags) + if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { + return nil, err + } + return req, nil } // updateTagsHandleResponse handles the UpdateTags response. diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go deleted file mode 100644 index 3f726ca528d2..000000000000 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,478 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkScopeListResult = armhybridcompute.PrivateLinkScopeListResult{ - // Value: []*armhybridcompute.PrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateLinkScopeID: to.Ptr("e5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("f5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkScopeListResult = armhybridcompute.PrivateLinkScopeListResult{ - // Value: []*armhybridcompute.PrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("f5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("a5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopesClient().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/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().Get(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScope = armhybridcompute.PrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("f5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScope = armhybridcompute.PrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("e5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armhybridcompute.PrivateLinkScope{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScope = armhybridcompute.PrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridCompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("e5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScope = armhybridcompute.PrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // "Tag2": to.Ptr("Value2"), - // }, - // Properties: &armhybridcompute.PrivateLinkScopeProperties{ - // PrivateEndpointConnections: []*armhybridcompute.PrivateEndpointConnectionDataModel{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.HybridCompute/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/myPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armhybridcompute.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armhybridcompute.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armhybridcompute.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // PrivateLinkScopeID: to.Ptr("e5dc51d3-92ed-4d7e-947a-775ea79b4919"), - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidation.json -func ExamplePrivateLinkScopesClient_GetValidationDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().GetValidationDetails(ctx, "wus2", "f5dc51d3-92ed-4d7e-947a-775ea79b4919", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScopeValidationDetails = armhybridcompute.PrivateLinkScopeValidationDetails{ - // ConnectionDetails: []*armhybridcompute.ConnectionDetail{ - // { - // GroupID: to.Ptr("groupId"), - // ID: to.Ptr("id"), - // LinkIdentifier: to.Ptr("linkId"), - // MemberName: to.Ptr("memberName"), - // PrivateIPAddress: to.Ptr("ip"), - // }}, - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2022-03-10/examples/PrivateLinkScopesGetValidationForMachine.json -func ExamplePrivateLinkScopesClient_GetValidationDetailsForMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhybridcompute.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().GetValidationDetailsForMachine(ctx, "my-resource-group", "machineName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkScopeValidationDetails = armhybridcompute.PrivateLinkScopeValidationDetails{ - // ConnectionDetails: []*armhybridcompute.ConnectionDetail{ - // { - // GroupID: to.Ptr("groupId"), - // ID: to.Ptr("id"), - // LinkIdentifier: to.Ptr("linkId"), - // MemberName: to.Ptr("memberName"), - // PrivateIPAddress: to.Ptr("ip"), - // }}, - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.hybridcompute/privateLinkScopes/my-privatelinkscope"), - // PublicNetworkAccess: to.Ptr(armhybridcompute.PublicNetworkAccessTypeDisabled), - // } -} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go index 25b4052f5fdf..88a10ad01c33 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/response_types.go @@ -3,14 +3,79 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute +// AgentVersionClientGetResponse contains the response from method AgentVersionClient.Get. +type AgentVersionClientGetResponse struct { + // Describes properties of Agent Version. + AgentVersion +} + +// AgentVersionClientListResponse contains the response from method AgentVersionClient.List. +type AgentVersionClientListResponse struct { + // Describes AgentVersions List. + AgentVersionsList +} + +// ExtensionMetadataClientGetResponse contains the response from method ExtensionMetadataClient.Get. +type ExtensionMetadataClientGetResponse struct { + // Describes a Extension Metadata + ExtensionValue +} + +// ExtensionMetadataClientListResponse contains the response from method ExtensionMetadataClient.NewListPager. +type ExtensionMetadataClientListResponse struct { + // The List Extension Metadata response. + ExtensionValueListResult +} + +// HybridIdentityMetadataClientGetResponse contains the response from method HybridIdentityMetadataClient.Get. +type HybridIdentityMetadataClientGetResponse struct { + // Defines the HybridIdentityMetadata. + HybridIdentityMetadata +} + +// HybridIdentityMetadataClientListByMachinesResponse contains the response from method HybridIdentityMetadataClient.NewListByMachinesPager. +type HybridIdentityMetadataClientListByMachinesResponse struct { + // List of HybridIdentityMetadata. + HybridIdentityMetadataList +} + +// LicenseProfilesClientCreateOrUpdateResponse contains the response from method LicenseProfilesClient.BeginCreateOrUpdate. +type LicenseProfilesClientCreateOrUpdateResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + +// LicenseProfilesClientDeleteResponse contains the response from method LicenseProfilesClient.BeginDelete. +type LicenseProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// LicenseProfilesClientGetResponse contains the response from method LicenseProfilesClient.Get. +type LicenseProfilesClientGetResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + +// LicenseProfilesClientListResponse contains the response from method LicenseProfilesClient.NewListPager. +type LicenseProfilesClientListResponse struct { + // The List hybrid machine operation response. + LicenseProfilesListResult +} + +// LicenseProfilesClientUpdateResponse contains the response from method LicenseProfilesClient.BeginUpdate. +type LicenseProfilesClientUpdateResponse struct { + // Describes a license profile in a hybrid machine. + LicenseProfile +} + // MachineExtensionsClientCreateOrUpdateResponse contains the response from method MachineExtensionsClient.BeginCreateOrUpdate. type MachineExtensionsClientCreateOrUpdateResponse struct { + // Describes a Machine Extension. MachineExtension } @@ -21,21 +86,31 @@ type MachineExtensionsClientDeleteResponse struct { // MachineExtensionsClientGetResponse contains the response from method MachineExtensionsClient.Get. type MachineExtensionsClientGetResponse struct { + // Describes a Machine Extension. MachineExtension } // MachineExtensionsClientListResponse contains the response from method MachineExtensionsClient.NewListPager. type MachineExtensionsClientListResponse struct { + // Describes the Machine Extensions List Result. MachineExtensionsListResult } // MachineExtensionsClientUpdateResponse contains the response from method MachineExtensionsClient.BeginUpdate. type MachineExtensionsClientUpdateResponse struct { + // Describes a Machine Extension. MachineExtension } +// MachinesClientAssessPatchesResponse contains the response from method MachinesClient.BeginAssessPatches. +type MachinesClientAssessPatchesResponse struct { + // Describes the properties of an AssessPatches result. + MachineAssessPatchesResult +} + // MachinesClientCreateOrUpdateResponse contains the response from method MachinesClient.CreateOrUpdate. type MachinesClientCreateOrUpdateResponse struct { + // Describes a hybrid machine. Machine } @@ -46,21 +121,31 @@ type MachinesClientDeleteResponse struct { // MachinesClientGetResponse contains the response from method MachinesClient.Get. type MachinesClientGetResponse struct { + // Describes a hybrid machine. Machine } +// MachinesClientInstallPatchesResponse contains the response from method MachinesClient.BeginInstallPatches. +type MachinesClientInstallPatchesResponse struct { + // The result summary of an installation operation. + MachineInstallPatchesResult +} + // MachinesClientListByResourceGroupResponse contains the response from method MachinesClient.NewListByResourceGroupPager. type MachinesClientListByResourceGroupResponse struct { + // The List hybrid machine operation response. MachineListResult } // MachinesClientListBySubscriptionResponse contains the response from method MachinesClient.NewListBySubscriptionPager. type MachinesClientListBySubscriptionResponse struct { + // The List hybrid machine operation response. MachineListResult } // MachinesClientUpdateResponse contains the response from method MachinesClient.Update. type MachinesClientUpdateResponse struct { + // Describes a hybrid machine. Machine } @@ -69,13 +154,21 @@ type ManagementClientUpgradeExtensionsResponse struct { // placeholder for future response values } +// NetworkProfileClientGetResponse contains the response from method NetworkProfileClient.Get. +type NetworkProfileClientGetResponse struct { + // Describes the network information on this machine. + NetworkProfile +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // The List Compute Operation operation response. OperationListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection PrivateEndpointConnection } @@ -86,26 +179,31 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager. type PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse struct { + // A list of private endpoint connections. PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // A private link resource PrivateLinkResource } // PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.NewListByPrivateLinkScopePager. type PrivateLinkResourcesClientListByPrivateLinkScopeResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // PrivateLinkScopesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopesClient.CreateOrUpdate. type PrivateLinkScopesClientCreateOrUpdateResponse struct { + // An Azure Arc PrivateLinkScope definition. PrivateLinkScope } @@ -116,6 +214,7 @@ type PrivateLinkScopesClientDeleteResponse struct { // PrivateLinkScopesClientGetResponse contains the response from method PrivateLinkScopesClient.Get. type PrivateLinkScopesClientGetResponse struct { + // An Azure Arc PrivateLinkScope definition. PrivateLinkScope } @@ -131,15 +230,18 @@ type PrivateLinkScopesClientGetValidationDetailsResponse struct { // PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. type PrivateLinkScopesClientListByResourceGroupResponse struct { + // Describes the list of Azure Arc PrivateLinkScope resources. PrivateLinkScopeListResult } // PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. type PrivateLinkScopesClientListResponse struct { + // Describes the list of Azure Arc PrivateLinkScope resources. PrivateLinkScopeListResult } // PrivateLinkScopesClientUpdateTagsResponse contains the response from method PrivateLinkScopesClient.UpdateTags. type PrivateLinkScopesClientUpdateTagsResponse struct { + // An Azure Arc PrivateLinkScope definition. PrivateLinkScope } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go index 11928484add6..33bf0c4c7362 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armhybridcompute