From a705e3ebfdb46b811f14bace9b813ecfa990d5d0 Mon Sep 17 00:00:00 2001 From: Judy Liu Date: Thu, 14 Nov 2024 17:02:48 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/hybridcompute/armhybridcompute/2.1.0-beta.1 generation from spec commit: 63d530d0def1c624f5d42d39170ff4ac196522e2 (#23753) --- .../armhybridcompute/CHANGELOG.md | 50 ++ .../armhybridcompute/autorest.md | 8 +- .../armhybridcompute/client_factory.go | 24 + .../armhybridcompute/constants.go | 60 +- .../extensionmetadata_client.go | 8 +- .../extensionmetadata_client_example_test.go | 4 +- .../armhybridcompute/fake/gateways_server.go | 340 +++++++ .../fake/machineruncommands_server.go | 284 ++++++ .../armhybridcompute/fake/server_factory.go | 17 + .../armhybridcompute/fake/settings_server.go | 222 +++++ .../armhybridcompute/gateways_client.go | 446 ++++++++++ .../gateways_client_example_test.go | 242 +++++ .../licenseprofiles_client.go | 26 +- .../licenseprofiles_client_example_test.go | 10 +- .../armhybridcompute/licenses_client.go | 36 +- .../licenses_client_example_test.go | 14 +- .../machineextensions_client.go | 30 +- .../machineextensions_client_example_test.go | 10 +- .../machineruncommands_client.go | 349 ++++++++ .../machineruncommands_client_example_test.go | 262 ++++++ .../armhybridcompute/machines_client.go | 36 +- .../machines_client_example_test.go | 80 +- .../armhybridcompute/management_client.go | 6 +- .../management_client_example_test.go | 2 +- .../hybridcompute/armhybridcompute/models.go | 355 +++++++- .../armhybridcompute/models_serde.go | 839 ++++++++++++++++++ .../armhybridcompute/networkprofile_client.go | 4 +- .../networkprofile_client_example_test.go | 8 +- ...ksecurityperimeterconfigurations_client.go | 14 +- ...meterconfigurations_client_example_test.go | 6 +- .../armhybridcompute/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../hybridcompute/armhybridcompute/options.go | 74 ++ .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 8 +- .../privatelinkresources_client.go | 8 +- ...rivatelinkresources_client_example_test.go | 4 +- .../privatelinkscopes_client.go | 34 +- .../privatelinkscopes_client_example_test.go | 18 +- .../armhybridcompute/responses.go | 73 ++ .../armhybridcompute/settings_client.go | 289 ++++++ .../settings_client_example_test.go | 124 +++ 42 files changed, 4281 insertions(+), 169 deletions(-) create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/fake/gateways_server.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineruncommands_server.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/fake/settings_server.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client_example_test.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client_example_test.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client.go create mode 100644 sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client_example_test.go diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md index b73e0e029c..5199b45d71 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/CHANGELOG.md @@ -1,5 +1,55 @@ # Release History +## 2.1.0-beta.1 (2024-11-14) +### Features Added + +- New enum type `ExecutionState` with values `ExecutionStateCanceled`, `ExecutionStateFailed`, `ExecutionStatePending`, `ExecutionStateRunning`, `ExecutionStateSucceeded`, `ExecutionStateTimedOut`, `ExecutionStateUnknown` +- New enum type `ExtensionsStatusLevelTypes` with values `ExtensionsStatusLevelTypesError`, `ExtensionsStatusLevelTypesInfo`, `ExtensionsStatusLevelTypesWarning` +- New enum type `GatewayType` with values `GatewayTypePublic` +- New function `*ClientFactory.NewGatewaysClient() *GatewaysClient` +- New function `*ClientFactory.NewMachineRunCommandsClient() *MachineRunCommandsClient` +- New function `*ClientFactory.NewSettingsClient() *SettingsClient` +- New function `NewGatewaysClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GatewaysClient, error)` +- New function `*GatewaysClient.BeginCreateOrUpdate(context.Context, string, string, Gateway, *GatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[GatewaysClientCreateOrUpdateResponse], error)` +- New function `*GatewaysClient.BeginDelete(context.Context, string, string, *GatewaysClientBeginDeleteOptions) (*runtime.Poller[GatewaysClientDeleteResponse], error)` +- New function `*GatewaysClient.Get(context.Context, string, string, *GatewaysClientGetOptions) (GatewaysClientGetResponse, error)` +- New function `*GatewaysClient.NewListByResourceGroupPager(string, *GatewaysClientListByResourceGroupOptions) *runtime.Pager[GatewaysClientListByResourceGroupResponse]` +- New function `*GatewaysClient.NewListBySubscriptionPager(*GatewaysClientListBySubscriptionOptions) *runtime.Pager[GatewaysClientListBySubscriptionResponse]` +- New function `*GatewaysClient.Update(context.Context, string, string, GatewayUpdate, *GatewaysClientUpdateOptions) (GatewaysClientUpdateResponse, error)` +- New function `NewMachineRunCommandsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MachineRunCommandsClient, error)` +- New function `*MachineRunCommandsClient.BeginCreateOrUpdate(context.Context, string, string, string, MachineRunCommand, *MachineRunCommandsClientBeginCreateOrUpdateOptions) (*runtime.Poller[MachineRunCommandsClientCreateOrUpdateResponse], error)` +- New function `*MachineRunCommandsClient.BeginDelete(context.Context, string, string, string, *MachineRunCommandsClientBeginDeleteOptions) (*runtime.Poller[MachineRunCommandsClientDeleteResponse], error)` +- New function `*MachineRunCommandsClient.Get(context.Context, string, string, string, *MachineRunCommandsClientGetOptions) (MachineRunCommandsClientGetResponse, error)` +- New function `*MachineRunCommandsClient.NewListPager(string, string, *MachineRunCommandsClientListOptions) *runtime.Pager[MachineRunCommandsClientListResponse]` +- New function `NewSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SettingsClient, error)` +- New function `*SettingsClient.Get(context.Context, string, string, string, string, string, *SettingsClientGetOptions) (SettingsClientGetResponse, error)` +- New function `*SettingsClient.Patch(context.Context, string, string, string, string, string, Settings, *SettingsClientPatchOptions) (SettingsClientPatchResponse, error)` +- New function `*SettingsClient.Update(context.Context, string, string, string, string, string, Settings, *SettingsClientUpdateOptions) (SettingsClientUpdateResponse, error)` +- New struct `Disk` +- New struct `ExtensionsResourceStatus` +- New struct `FirmwareProfile` +- New struct `Gateway` +- New struct `GatewayProperties` +- New struct `GatewayUpdate` +- New struct `GatewayUpdateProperties` +- New struct `GatewaysListResult` +- New struct `HardwareProfile` +- New struct `MachineRunCommand` +- New struct `MachineRunCommandInstanceView` +- New struct `MachineRunCommandProperties` +- New struct `MachineRunCommandScriptSource` +- New struct `MachineRunCommandsListResult` +- New struct `Processor` +- New struct `RunCommandInputParameter` +- New struct `RunCommandManagedIdentity` +- New struct `Settings` +- New struct `SettingsGatewayProperties` +- New struct `SettingsProperties` +- New struct `StorageProfile` +- New field `FirmwareProfile`, `HardwareProfile`, `StorageProfile` in struct `MachineProperties` +- New field `ID`, `MacAddress`, `Name` in struct `NetworkInterface` + + ## 2.0.0 (2024-10-11) ### Breaking Changes diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md b/sdk/resourcemanager/hybridcompute/armhybridcompute/autorest.md index 64e82c3cbb..098335df18 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/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2024-07 +module-version: 2.1.0-beta.1 +tag: package-preview-2024-07 ``` \ 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 8794103489..1e73d5c661 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/client_factory.go @@ -44,6 +44,14 @@ func (c *ClientFactory) NewExtensionMetadataClient() *ExtensionMetadataClient { } } +// NewGatewaysClient creates a new instance of GatewaysClient. +func (c *ClientFactory) NewGatewaysClient() *GatewaysClient { + return &GatewaysClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewLicenseProfilesClient creates a new instance of LicenseProfilesClient. func (c *ClientFactory) NewLicenseProfilesClient() *LicenseProfilesClient { return &LicenseProfilesClient{ @@ -68,6 +76,14 @@ func (c *ClientFactory) NewMachineExtensionsClient() *MachineExtensionsClient { } } +// NewMachineRunCommandsClient creates a new instance of MachineRunCommandsClient. +func (c *ClientFactory) NewMachineRunCommandsClient() *MachineRunCommandsClient { + return &MachineRunCommandsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewMachinesClient creates a new instance of MachinesClient. func (c *ClientFactory) NewMachinesClient() *MachinesClient { return &MachinesClient{ @@ -130,3 +146,11 @@ func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { internal: c.internal, } } + +// NewSettingsClient creates a new instance of SettingsClient. +func (c *ClientFactory) NewSettingsClient() *SettingsClient { + return &SettingsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go index afd5f90578..555bfd97c4 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/constants.go @@ -10,7 +10,7 @@ package armhybridcompute const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute" - moduleVersion = "v2.0.0" + moduleVersion = "v2.1.0-beta.1" ) // AccessMode - Property that impacts a resource's logging behavior and its connectivity with other resources and public networks. @@ -181,6 +181,64 @@ func PossibleEsuServerTypeValues() []EsuServerType { } } +// ExecutionState - Script execution status. +type ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +// PossibleExecutionStateValues returns the possible values for the ExecutionState const type. +func PossibleExecutionStateValues() []ExecutionState { + return []ExecutionState{ + ExecutionStateCanceled, + ExecutionStateFailed, + ExecutionStatePending, + ExecutionStateRunning, + ExecutionStateSucceeded, + ExecutionStateTimedOut, + ExecutionStateUnknown, + } +} + +// ExtensionsStatusLevelTypes - The level code. +type ExtensionsStatusLevelTypes string + +const ( + ExtensionsStatusLevelTypesError ExtensionsStatusLevelTypes = "Error" + ExtensionsStatusLevelTypesInfo ExtensionsStatusLevelTypes = "Info" + ExtensionsStatusLevelTypesWarning ExtensionsStatusLevelTypes = "Warning" +) + +// PossibleExtensionsStatusLevelTypesValues returns the possible values for the ExtensionsStatusLevelTypes const type. +func PossibleExtensionsStatusLevelTypesValues() []ExtensionsStatusLevelTypes { + return []ExtensionsStatusLevelTypes{ + ExtensionsStatusLevelTypesError, + ExtensionsStatusLevelTypesInfo, + ExtensionsStatusLevelTypesWarning, + } +} + +// GatewayType - The type of the Gateway resource. +type GatewayType string + +const ( + GatewayTypePublic GatewayType = "Public" +) + +// PossibleGatewayTypeValues returns the possible values for the GatewayType const type. +func PossibleGatewayTypeValues() []GatewayType { + return []GatewayType{ + GatewayTypePublic, + } +} + // HotpatchEnablementStatus - Status of hotpatch enablement or disablement. type HotpatchEnablementStatus string diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go index 33a87a26e0..340b7efe2b 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client.go @@ -46,7 +46,7 @@ func NewExtensionMetadataClient(subscriptionID string, credential azcore.TokenCr // 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 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -102,7 +102,7 @@ func (client *ExtensionMetadataClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +119,7 @@ func (client *ExtensionMetadataClient) getHandleResponse(resp *http.Response) (E // NewListPager - Gets all Extension versions based on location, publisher, extensionType // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -173,7 +173,7 @@ func (client *ExtensionMetadataClient) listCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go index 1949a4f60f..3095c599a6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/extensionmetadata_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/ExtensionMetadata_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/ExtensionMetadata_Get.json func ExampleExtensionMetadataClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleExtensionMetadataClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/ExtensionMetadata_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/ExtensionMetadata_List.json func ExampleExtensionMetadataClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/gateways_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/gateways_server.go new file mode 100644 index 0000000000..423c819d87 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/gateways_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// GatewaysServer is a fake server for instances of the armhybridcompute.GatewaysClient type. +type GatewaysServer struct { + // BeginCreateOrUpdate is the fake for method GatewaysClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, gatewayName string, parameters armhybridcompute.Gateway, options *armhybridcompute.GatewaysClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.GatewaysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method GatewaysClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, gatewayName string, options *armhybridcompute.GatewaysClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcompute.GatewaysClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method GatewaysClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, gatewayName string, options *armhybridcompute.GatewaysClientGetOptions) (resp azfake.Responder[armhybridcompute.GatewaysClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method GatewaysClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armhybridcompute.GatewaysClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhybridcompute.GatewaysClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method GatewaysClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armhybridcompute.GatewaysClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhybridcompute.GatewaysClientListBySubscriptionResponse]) + + // Update is the fake for method GatewaysClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, gatewayName string, parameters armhybridcompute.GatewayUpdate, options *armhybridcompute.GatewaysClientUpdateOptions) (resp azfake.Responder[armhybridcompute.GatewaysClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewGatewaysServerTransport creates a new instance of GatewaysServerTransport with the provided implementation. +// The returned GatewaysServerTransport instance is connected to an instance of armhybridcompute.GatewaysClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGatewaysServerTransport(srv *GatewaysServer) *GatewaysServerTransport { + return &GatewaysServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcompute.GatewaysClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcompute.GatewaysClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhybridcompute.GatewaysClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhybridcompute.GatewaysClientListBySubscriptionResponse]](), + } +} + +// GatewaysServerTransport connects instances of armhybridcompute.GatewaysClient to instances of GatewaysServer. +// Don't use this type directly, use NewGatewaysServerTransport instead. +type GatewaysServerTransport struct { + srv *GatewaysServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcompute.GatewaysClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcompute.GatewaysClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armhybridcompute.GatewaysClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armhybridcompute.GatewaysClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for GatewaysServerTransport. +func (g *GatewaysServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "GatewaysClient.BeginCreateOrUpdate": + resp, err = g.dispatchBeginCreateOrUpdate(req) + case "GatewaysClient.BeginDelete": + resp, err = g.dispatchBeginDelete(req) + case "GatewaysClient.Get": + resp, err = g.dispatchGet(req) + case "GatewaysClient.NewListByResourceGroupPager": + resp, err = g.dispatchNewListByResourceGroupPager(req) + case "GatewaysClient.NewListBySubscriptionPager": + resp, err = g.dispatchNewListBySubscriptionPager(req) + case "GatewaysClient.Update": + resp, err = g.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if g.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := g.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.Gateway](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + g.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + g.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + g.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if g.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := g.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginDelete(req.Context(), resourceGroupNameParam, gatewayNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + g.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + g.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + g.beginDelete.remove(req) + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if g.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, gatewayNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Gateway, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if g.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := g.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := g.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + g.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhybridcompute.GatewaysClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + g.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + g.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if g.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := g.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := g.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + g.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhybridcompute.GatewaysClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + g.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + g.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if g.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.GatewayUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Update(req.Context(), resourceGroupNameParam, gatewayNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Gateway, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineruncommands_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineruncommands_server.go new file mode 100644 index 0000000000..1de9a0e1f7 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/machineruncommands_server.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// MachineRunCommandsServer is a fake server for instances of the armhybridcompute.MachineRunCommandsClient type. +type MachineRunCommandsServer struct { + // BeginCreateOrUpdate is the fake for method MachineRunCommandsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, runCommandProperties armhybridcompute.MachineRunCommand, options *armhybridcompute.MachineRunCommandsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method MachineRunCommandsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *armhybridcompute.MachineRunCommandsClientBeginDeleteOptions) (resp azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MachineRunCommandsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *armhybridcompute.MachineRunCommandsClientGetOptions) (resp azfake.Responder[armhybridcompute.MachineRunCommandsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MachineRunCommandsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, machineName string, options *armhybridcompute.MachineRunCommandsClientListOptions) (resp azfake.PagerResponder[armhybridcompute.MachineRunCommandsClientListResponse]) +} + +// NewMachineRunCommandsServerTransport creates a new instance of MachineRunCommandsServerTransport with the provided implementation. +// The returned MachineRunCommandsServerTransport instance is connected to an instance of armhybridcompute.MachineRunCommandsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMachineRunCommandsServerTransport(srv *MachineRunCommandsServer) *MachineRunCommandsServerTransport { + return &MachineRunCommandsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armhybridcompute.MachineRunCommandsClientListResponse]](), + } +} + +// MachineRunCommandsServerTransport connects instances of armhybridcompute.MachineRunCommandsClient to instances of MachineRunCommandsServer. +// Don't use this type directly, use NewMachineRunCommandsServerTransport instead. +type MachineRunCommandsServerTransport struct { + srv *MachineRunCommandsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armhybridcompute.MachineRunCommandsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armhybridcompute.MachineRunCommandsClientListResponse]] +} + +// Do implements the policy.Transporter interface for MachineRunCommandsServerTransport. +func (m *MachineRunCommandsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MachineRunCommandsClient.BeginCreateOrUpdate": + resp, err = m.dispatchBeginCreateOrUpdate(req) + case "MachineRunCommandsClient.BeginDelete": + resp, err = m.dispatchBeginDelete(req) + case "MachineRunCommandsClient.Get": + resp, err = m.dispatchGet(req) + case "MachineRunCommandsClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MachineRunCommandsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runCommands/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.MachineRunCommand](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + runCommandNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("runCommandName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, machineNameParam, runCommandNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *MachineRunCommandsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runCommands/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + runCommandNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("runCommandName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, machineNameParam, runCommandNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *MachineRunCommandsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runCommands/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + runCommandNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("runCommandName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, machineNameParam, runCommandNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MachineRunCommand, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MachineRunCommandsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/machines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runCommands` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + machineNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("machineName")]) + if err != nil { + return nil, err + } + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + var options *armhybridcompute.MachineRunCommandsClientListOptions + if expandParam != nil { + options = &armhybridcompute.MachineRunCommandsClientListOptions{ + Expand: expandParam, + } + } + resp := m.srv.NewListPager(resourceGroupNameParam, machineNameParam, options) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhybridcompute.MachineRunCommandsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go index 4ca7e56355..f21887442c 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/server_factory.go @@ -20,9 +20,11 @@ import ( // ServerFactory is a fake server for instances of the armhybridcompute.ClientFactory type. type ServerFactory struct { ExtensionMetadataServer ExtensionMetadataServer + GatewaysServer GatewaysServer LicenseProfilesServer LicenseProfilesServer LicensesServer LicensesServer MachineExtensionsServer MachineExtensionsServer + MachineRunCommandsServer MachineRunCommandsServer MachinesServer MachinesServer ManagementServer ManagementServer NetworkProfileServer NetworkProfileServer @@ -31,6 +33,7 @@ type ServerFactory struct { PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer PrivateLinkScopesServer PrivateLinkScopesServer + SettingsServer SettingsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -48,9 +51,11 @@ type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex trExtensionMetadataServer *ExtensionMetadataServerTransport + trGatewaysServer *GatewaysServerTransport trLicenseProfilesServer *LicenseProfilesServerTransport trLicensesServer *LicensesServerTransport trMachineExtensionsServer *MachineExtensionsServerTransport + trMachineRunCommandsServer *MachineRunCommandsServerTransport trMachinesServer *MachinesServerTransport trManagementServer *ManagementServerTransport trNetworkProfileServer *NetworkProfileServerTransport @@ -59,6 +64,7 @@ type ServerFactoryTransport struct { trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport trPrivateLinkScopesServer *PrivateLinkScopesServerTransport + trSettingsServer *SettingsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -79,6 +85,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewExtensionMetadataServerTransport(&s.srv.ExtensionMetadataServer) }) resp, err = s.trExtensionMetadataServer.Do(req) + case "GatewaysClient": + initServer(s, &s.trGatewaysServer, func() *GatewaysServerTransport { return NewGatewaysServerTransport(&s.srv.GatewaysServer) }) + resp, err = s.trGatewaysServer.Do(req) case "LicenseProfilesClient": initServer(s, &s.trLicenseProfilesServer, func() *LicenseProfilesServerTransport { return NewLicenseProfilesServerTransport(&s.srv.LicenseProfilesServer) @@ -92,6 +101,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewMachineExtensionsServerTransport(&s.srv.MachineExtensionsServer) }) resp, err = s.trMachineExtensionsServer.Do(req) + case "MachineRunCommandsClient": + initServer(s, &s.trMachineRunCommandsServer, func() *MachineRunCommandsServerTransport { + return NewMachineRunCommandsServerTransport(&s.srv.MachineRunCommandsServer) + }) + resp, err = s.trMachineRunCommandsServer.Do(req) case "MachinesClient": initServer(s, &s.trMachinesServer, func() *MachinesServerTransport { return NewMachinesServerTransport(&s.srv.MachinesServer) }) resp, err = s.trMachinesServer.Do(req) @@ -126,6 +140,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkScopesServerTransport(&s.srv.PrivateLinkScopesServer) }) resp, err = s.trPrivateLinkScopesServer.Do(req) + case "SettingsClient": + initServer(s, &s.trSettingsServer, func() *SettingsServerTransport { return NewSettingsServerTransport(&s.srv.SettingsServer) }) + resp, err = s.trSettingsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/settings_server.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/settings_server.go new file mode 100644 index 0000000000..56dcd15345 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/fake/settings_server.go @@ -0,0 +1,222 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" + "net/http" + "net/url" + "regexp" +) + +// SettingsServer is a fake server for instances of the armhybridcompute.SettingsClient type. +type SettingsServer struct { + // Get is the fake for method SettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, options *armhybridcompute.SettingsClientGetOptions) (resp azfake.Responder[armhybridcompute.SettingsClientGetResponse], errResp azfake.ErrorResponder) + + // Patch is the fake for method SettingsClient.Patch + // HTTP status codes to indicate success: http.StatusOK + Patch func(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters armhybridcompute.Settings, options *armhybridcompute.SettingsClientPatchOptions) (resp azfake.Responder[armhybridcompute.SettingsClientPatchResponse], errResp azfake.ErrorResponder) + + // Update is the fake for method SettingsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters armhybridcompute.Settings, options *armhybridcompute.SettingsClientUpdateOptions) (resp azfake.Responder[armhybridcompute.SettingsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSettingsServerTransport creates a new instance of SettingsServerTransport with the provided implementation. +// The returned SettingsServerTransport instance is connected to an instance of armhybridcompute.SettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSettingsServerTransport(srv *SettingsServer) *SettingsServerTransport { + return &SettingsServerTransport{srv: srv} +} + +// SettingsServerTransport connects instances of armhybridcompute.SettingsClient to instances of SettingsServer. +// Don't use this type directly, use NewSettingsServerTransport instead. +type SettingsServerTransport struct { + srv *SettingsServer +} + +// Do implements the policy.Transporter interface for SettingsServerTransport. +func (s *SettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SettingsClient.Get": + resp, err = s.dispatchGet(req) + case "SettingsClient.Patch": + resp, err = s.dispatchPatch(req) + case "SettingsClient.Update": + resp, err = s.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/settings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + baseProviderParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseProvider")]) + if err != nil { + return nil, err + } + baseResourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceType")]) + if err != nil { + return nil, err + } + baseResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, baseProviderParam, baseResourceTypeParam, baseResourceNameParam, settingsResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Settings, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SettingsServerTransport) dispatchPatch(req *http.Request) (*http.Response, error) { + if s.srv.Patch == nil { + return nil, &nonRetriableError{errors.New("fake for method Patch not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/settings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.Settings](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + baseProviderParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseProvider")]) + if err != nil { + return nil, err + } + baseResourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceType")]) + if err != nil { + return nil, err + } + baseResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Patch(req.Context(), resourceGroupNameParam, baseProviderParam, baseResourceTypeParam, baseResourceNameParam, settingsResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Settings, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridCompute/settings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhybridcompute.Settings](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + baseProviderParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseProvider")]) + if err != nil { + return nil, err + } + baseResourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceType")]) + if err != nil { + return nil, err + } + baseResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("baseResourceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, baseProviderParam, baseResourceTypeParam, baseResourceNameParam, settingsResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Settings, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client.go new file mode 100644 index 0000000000..d7768607c6 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client.go @@ -0,0 +1,446 @@ +//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" +) + +// GatewaysClient contains the methods for the Gateways group. +// Don't use this type directly, use NewGatewaysClient() instead. +type GatewaysClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGatewaysClient creates a new instance of GatewaysClient 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 NewGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewaysClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GatewaysClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - gatewayName - The name of the Gateway. +// - parameters - Parameters supplied to the Create gateway operation. +// - options - GatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the GatewaysClient.BeginCreateOrUpdate +// method. +func (client *GatewaysClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, parameters Gateway, options *GatewaysClientBeginCreateOrUpdateOptions) (*runtime.Poller[GatewaysClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, gatewayName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GatewaysClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GatewaysClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update a gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +func (client *GatewaysClient) createOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, parameters Gateway, options *GatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "GatewaysClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, gatewayName, 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 *GatewaysClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, parameters Gateway, options *GatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + 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 gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + 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", "2024-07-31-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 gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - gatewayName - The name of the Gateway. +// - options - GatewaysClientBeginDeleteOptions contains the optional parameters for the GatewaysClient.BeginDelete method. +func (client *GatewaysClient) BeginDelete(ctx context.Context, resourceGroupName string, gatewayName string, options *GatewaysClientBeginDeleteOptions) (*runtime.Poller[GatewaysClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GatewaysClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GatewaysClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete a gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +func (client *GatewaysClient) deleteOperation(ctx context.Context, resourceGroupName string, gatewayName string, options *GatewaysClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "GatewaysClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, gatewayName, 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 *GatewaysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *GatewaysClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + 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 gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + 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", "2024-07-31-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 gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - gatewayName - The name of the Gateway. +// - options - GatewaysClientGetOptions contains the optional parameters for the GatewaysClient.Get method. +func (client *GatewaysClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, options *GatewaysClientGetOptions) (GatewaysClientGetResponse, error) { + var err error + const operationName = "GatewaysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, gatewayName, options) + if err != nil { + return GatewaysClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GatewaysClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GatewaysClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GatewaysClient) getCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, options *GatewaysClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + 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 gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + 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", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GatewaysClient) getHandleResponse(resp *http.Response) (GatewaysClientGetResponse, error) { + result := GatewaysClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Gateway); err != nil { + return GatewaysClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - The operation to get all gateways of a non-Azure machine +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - GatewaysClientListByResourceGroupOptions contains the optional parameters for the GatewaysClient.NewListByResourceGroupPager +// method. +func (client *GatewaysClient) NewListByResourceGroupPager(resourceGroupName string, options *GatewaysClientListByResourceGroupOptions) *runtime.Pager[GatewaysClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[GatewaysClientListByResourceGroupResponse]{ + More: func(page GatewaysClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GatewaysClientListByResourceGroupResponse) (GatewaysClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GatewaysClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return GatewaysClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *GatewaysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *GatewaysClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *GatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (GatewaysClientListByResourceGroupResponse, error) { + result := GatewaysClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GatewaysListResult); err != nil { + return GatewaysClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - The operation to get all gateways of a non-Azure machine +// +// Generated from API version 2024-07-31-preview +// - options - GatewaysClientListBySubscriptionOptions contains the optional parameters for the GatewaysClient.NewListBySubscriptionPager +// method. +func (client *GatewaysClient) NewListBySubscriptionPager(options *GatewaysClientListBySubscriptionOptions) *runtime.Pager[GatewaysClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[GatewaysClientListBySubscriptionResponse]{ + More: func(page GatewaysClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GatewaysClientListBySubscriptionResponse) (GatewaysClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GatewaysClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return GatewaysClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *GatewaysClient) listBySubscriptionCreateRequest(ctx context.Context, options *GatewaysClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/gateways" + 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", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *GatewaysClient) listBySubscriptionHandleResponse(resp *http.Response) (GatewaysClientListBySubscriptionResponse, error) { + result := GatewaysClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GatewaysListResult); err != nil { + return GatewaysClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - The operation to update a gateway. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - gatewayName - The name of the Gateway. +// - parameters - Parameters supplied to the Update gateway operation. +// - options - GatewaysClientUpdateOptions contains the optional parameters for the GatewaysClient.Update method. +func (client *GatewaysClient) Update(ctx context.Context, resourceGroupName string, gatewayName string, parameters GatewayUpdate, options *GatewaysClientUpdateOptions) (GatewaysClientUpdateResponse, error) { + var err error + const operationName = "GatewaysClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, gatewayName, parameters, options) + if err != nil { + return GatewaysClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GatewaysClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GatewaysClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *GatewaysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, gatewayName string, parameters GatewayUpdate, options *GatewaysClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + 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 gatewayName == "" { + return nil, errors.New("parameter gatewayName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{gatewayName}", url.PathEscape(gatewayName)) + 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", "2024-07-31-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 +} + +// updateHandleResponse handles the Update response. +func (client *GatewaysClient) updateHandleResponse(resp *http.Response) (GatewaysClientUpdateResponse, error) { + result := GatewaysClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Gateway); err != nil { + return GatewaysClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client_example_test.go new file mode 100644 index 0000000000..ec505ed2fa --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/gateways_client_example_test.go @@ -0,0 +1,242 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_CreateOrUpdate.json +func ExampleGatewaysClient_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.NewGatewaysClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "{gatewayName}", armhybridcompute.Gateway{ + Location: to.Ptr("eastus2euap"), + Properties: &armhybridcompute.GatewayProperties{ + AllowedFeatures: []*string{ + to.Ptr("*")}, + GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + }, + }, 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.Gateway = armhybridcompute.Gateway{ + // Name: to.Ptr("{gatewayName}"), + // Type: to.Ptr("Microsoft.HybridCompute/gateways"), + // ID: to.Ptr("/subscriptions/ffd506c8-3415-42d3-9612-fdb423fb17df/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/gateways/{gatewayName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.GatewayProperties{ + // AllowedFeatures: []*string{ + // to.Ptr("*")}, + // GatewayEndpoint: to.Ptr("https://uniqueValue.contoso.com"), + // GatewayID: to.Ptr(""), + // GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + // ProvisioningState: to.Ptr(armhybridcompute.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_Update.json +func ExampleGatewaysClient_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.NewGatewaysClient().Update(ctx, "myResourceGroup", "{gatewayName}", armhybridcompute.GatewayUpdate{ + Properties: &armhybridcompute.GatewayUpdateProperties{ + AllowedFeatures: []*string{ + to.Ptr("*")}, + }, + }, 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.Gateway = armhybridcompute.Gateway{ + // Name: to.Ptr("{gatewayName}"), + // Type: to.Ptr("Microsoft.HybridCompute/gateways"), + // ID: to.Ptr("/subscriptions/ffd506c8-3415-42d3-9612-fdb423fb17df/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/gateways/{gatewayName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.GatewayProperties{ + // AllowedFeatures: []*string{ + // to.Ptr("*")}, + // GatewayEndpoint: to.Ptr("https://uniqueValue.contoso.com"), + // GatewayID: to.Ptr(""), + // GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + // ProvisioningState: to.Ptr(armhybridcompute.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_Get.json +func ExampleGatewaysClient_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.NewGatewaysClient().Get(ctx, "myResourceGroup", "{gatewayName}", 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.Gateway = armhybridcompute.Gateway{ + // Name: to.Ptr("{gatewayName}"), + // Type: to.Ptr("Microsoft.HybridCompute/gateways"), + // ID: to.Ptr("/subscriptions/ffd506c8-3415-42d3-9612-fdb423fb17df/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/gateways/{gatewayName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.GatewayProperties{ + // AllowedFeatures: []*string{ + // to.Ptr("*")}, + // GatewayEndpoint: to.Ptr("https://uniqueValue.contoso.com"), + // GatewayID: to.Ptr(""), + // GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + // ProvisioningState: to.Ptr(armhybridcompute.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_Delete.json +func ExampleGatewaysClient_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.NewGatewaysClient().BeginDelete(ctx, "myResourceGroup", "{gatewayName}", 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/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_ListByResourceGroup.json +func ExampleGatewaysClient_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.NewGatewaysClient().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.GatewaysListResult = armhybridcompute.GatewaysListResult{ + // Value: []*armhybridcompute.Gateway{ + // { + // Name: to.Ptr("{gatewayName}"), + // Type: to.Ptr("Microsoft.HybridCompute/gateways"), + // ID: to.Ptr("/subscriptions/ffd506c8-3415-42d3-9612-fdb423fb17df/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/gateways/{gatewayName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.GatewayProperties{ + // AllowedFeatures: []*string{ + // to.Ptr("*")}, + // GatewayEndpoint: to.Ptr("https://uniqueValue.contoso.com"), + // GatewayID: to.Ptr(""), + // GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + // ProvisioningState: to.Ptr(armhybridcompute.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/gateway/Gateway_ListBySubscription.json +func ExampleGatewaysClient_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.NewGatewaysClient().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.GatewaysListResult = armhybridcompute.GatewaysListResult{ + // Value: []*armhybridcompute.Gateway{ + // { + // Name: to.Ptr("{gatewayName}"), + // Type: to.Ptr("Microsoft.HybridCompute/gateways"), + // ID: to.Ptr("/subscriptions/ffd506c8-3415-42d3-9612-fdb423fb17df/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/gateways/{gatewayName}"), + // Location: to.Ptr("eastus2euap"), + // Properties: &armhybridcompute.GatewayProperties{ + // AllowedFeatures: []*string{ + // to.Ptr("*")}, + // GatewayEndpoint: to.Ptr("https://uniqueValue.contoso.com"), + // GatewayID: to.Ptr(""), + // GatewayType: to.Ptr(armhybridcompute.GatewayTypePublic), + // ProvisioningState: to.Ptr(armhybridcompute.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go index 57055bc036..56606e4ab6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client.go @@ -46,7 +46,7 @@ func NewLicenseProfilesClient(subscriptionID string, credential azcore.TokenCred // BeginCreateOrUpdate - The operation to create or update a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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 or Update license profile operation. @@ -72,7 +72,7 @@ func (client *LicenseProfilesClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - The operation to create or update a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicenseProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfile, options *LicenseProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "LicenseProfilesClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *LicenseProfilesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,7 +127,7 @@ func (client *LicenseProfilesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - The operation to delete a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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 @@ -152,7 +152,7 @@ func (client *LicenseProfilesClient) BeginDelete(ctx context.Context, resourceGr // Delete - The operation to delete a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicenseProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, options *LicenseProfilesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "LicenseProfilesClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *LicenseProfilesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *LicenseProfilesClient) deleteCreateRequest(ctx context.Context, re // Get - Retrieves information about the view of a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -251,7 +251,7 @@ func (client *LicenseProfilesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +268,7 @@ func (client *LicenseProfilesClient) getHandleResponse(resp *http.Response) (Lic // NewListPager - The operation to get all license profiles of a non-Azure machine // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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 @@ -316,7 +316,7 @@ func (client *LicenseProfilesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *LicenseProfilesClient) listHandleResponse(resp *http.Response) (Li // BeginUpdate - The operation to update a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -360,7 +360,7 @@ func (client *LicenseProfilesClient) BeginUpdate(ctx context.Context, resourceGr // Update - The operation to update a license profile. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicenseProfilesClient) update(ctx context.Context, resourceGroupName string, machineName string, parameters LicenseProfileUpdate, options *LicenseProfilesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "LicenseProfilesClient.BeginUpdate" @@ -403,7 +403,7 @@ func (client *LicenseProfilesClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go index 68480c4f72..a110f10c78 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenseprofiles_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/licenseProfile/LicenseProfile_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/licenseProfile/LicenseProfile_CreateOrUpdate.json func ExampleLicenseProfilesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleLicenseProfilesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/licenseProfile/LicenseProfile_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/licenseProfile/LicenseProfile_Update.json func ExampleLicenseProfilesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -190,7 +190,7 @@ func ExampleLicenseProfilesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/licenseProfile/LicenseProfile_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/licenseProfile/LicenseProfile_Get.json func ExampleLicenseProfilesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -253,7 +253,7 @@ func ExampleLicenseProfilesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/licenseProfile/LicenseProfile_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/licenseProfile/LicenseProfile_Delete.json func ExampleLicenseProfilesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -274,7 +274,7 @@ func ExampleLicenseProfilesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/licenseProfile/LicenseProfile_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/licenseProfile/LicenseProfile_List.json func ExampleLicenseProfilesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go index c5d3dbf6a3..172f055cd5 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client.go @@ -46,7 +46,7 @@ func NewLicensesClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - The operation to create or update a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - licenseName - The name of the license. // - parameters - Parameters supplied to the Create license operation. @@ -72,7 +72,7 @@ func (client *LicensesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - The operation to create or update a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicensesClient) createOrUpdate(ctx context.Context, resourceGroupName string, licenseName string, parameters License, options *LicensesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "LicensesClient.BeginCreateOrUpdate" @@ -114,7 +114,7 @@ func (client *LicensesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -126,7 +126,7 @@ func (client *LicensesClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - The operation to delete a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - licenseName - The name of the license. // - options - LicensesClientBeginDeleteOptions contains the optional parameters for the LicensesClient.BeginDelete method. @@ -150,7 +150,7 @@ func (client *LicensesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - The operation to delete a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicensesClient) deleteOperation(ctx context.Context, resourceGroupName string, licenseName string, options *LicensesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "LicensesClient.BeginDelete" @@ -192,7 +192,7 @@ func (client *LicensesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +201,7 @@ func (client *LicensesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Retrieves information about the view of a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - licenseName - The name of the license. // - options - LicensesClientGetOptions contains the optional parameters for the LicensesClient.Get method. @@ -247,7 +247,7 @@ func (client *LicensesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +264,7 @@ func (client *LicensesClient) getHandleResponse(resp *http.Response) (LicensesCl // NewListByResourceGroupPager - The operation to get all licenses of a non-Azure machine // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - LicensesClientListByResourceGroupOptions contains the optional parameters for the LicensesClient.NewListByResourceGroupPager // method. @@ -307,7 +307,7 @@ func (client *LicensesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +324,7 @@ func (client *LicensesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - The operation to get all licenses of a non-Azure machine // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - options - LicensesClientListBySubscriptionOptions contains the optional parameters for the LicensesClient.NewListBySubscriptionPager // method. func (client *LicensesClient) NewListBySubscriptionPager(options *LicensesClientListBySubscriptionOptions) *runtime.Pager[LicensesClientListBySubscriptionResponse] { @@ -362,7 +362,7 @@ func (client *LicensesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +380,7 @@ func (client *LicensesClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginUpdate - The operation to update a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - licenseName - The name of the license. // - parameters - Parameters supplied to the Update license operation. @@ -405,7 +405,7 @@ func (client *LicensesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - The operation to update a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicensesClient) update(ctx context.Context, resourceGroupName string, licenseName string, parameters LicenseUpdate, options *LicensesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "LicensesClient.BeginUpdate" @@ -447,7 +447,7 @@ func (client *LicensesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -459,7 +459,7 @@ func (client *LicensesClient) updateCreateRequest(ctx context.Context, resourceG // BeginValidateLicense - The operation to validate a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - parameters - Parameters supplied to the license validation operation. // - options - LicensesClientBeginValidateLicenseOptions contains the optional parameters for the LicensesClient.BeginValidateLicense // method. @@ -483,7 +483,7 @@ func (client *LicensesClient) BeginValidateLicense(ctx context.Context, paramete // ValidateLicense - The operation to validate a license. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *LicensesClient) validateLicense(ctx context.Context, parameters License, options *LicensesClientBeginValidateLicenseOptions) (*http.Response, error) { var err error const operationName = "LicensesClient.BeginValidateLicense" @@ -517,7 +517,7 @@ func (client *LicensesClient) validateLicenseCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go index df385a932b..4fc4e055ed 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/licenses_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_ValidateLicense.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_ValidateLicense.json func ExampleLicensesClient_BeginValidateLicense() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,7 +73,7 @@ func ExampleLicensesClient_BeginValidateLicense() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_CreateOrUpdate.json func ExampleLicensesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -128,7 +128,7 @@ func ExampleLicensesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_Update.json func ExampleLicensesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -182,7 +182,7 @@ func ExampleLicensesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_Get.json func ExampleLicensesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -221,7 +221,7 @@ func ExampleLicensesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_Delete.json func ExampleLicensesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,7 +242,7 @@ func ExampleLicensesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_ListByResourceGroup.json func ExampleLicensesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -289,7 +289,7 @@ func ExampleLicensesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/license/License_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/license/License_ListBySubscription.json func ExampleLicensesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go index e50d323b1d..3e1bab97f1 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client.go @@ -46,7 +46,7 @@ func NewMachineExtensionsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be created or updated. // - extensionName - The name of the machine extension. @@ -73,7 +73,7 @@ func (client *MachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *MachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtension, options *MachineExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { @@ -131,7 +131,7 @@ func (client *MachineExtensionsClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine where the extension should be deleted. // - extensionName - The name of the machine extension. @@ -157,7 +157,7 @@ func (client *MachineExtensionsClient) BeginDelete(ctx context.Context, resource // Delete - The operation to delete the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *MachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, extensionName string, options *MachineExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *MachineExtensionsClient) deleteCreateRequest(ctx context.Context, // Get - The operation to get the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - extensionName - The name of the machine extension. @@ -263,7 +263,7 @@ func (client *MachineExtensionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *MachineExtensionsClient) getHandleResponse(resp *http.Response) (M // NewListPager - The operation to get all extensions of a non-Azure machine // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the machine containing the extension. // - options - MachineExtensionsClientListOptions contains the optional parameters for the MachineExtensionsClient.NewListPager @@ -331,7 +331,7 @@ func (client *MachineExtensionsClient) listCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -346,10 +346,10 @@ func (client *MachineExtensionsClient) listHandleResponse(resp *http.Response) ( return result, nil } -// BeginUpdate - The operation to update the extension. +// BeginUpdate - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -373,10 +373,10 @@ func (client *MachineExtensionsClient) BeginUpdate(ctx context.Context, resource } } -// Update - The operation to update the extension. +// Update - The operation to create or update the extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *MachineExtensionsClient) update(ctx context.Context, resourceGroupName string, machineName string, extensionName string, extensionParameters MachineExtensionUpdate, options *MachineExtensionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "MachineExtensionsClient.BeginUpdate" @@ -422,7 +422,7 @@ func (client *MachineExtensionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionParameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go index 11a766c3d5..3405203dea 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineextensions_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extension_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extension_CreateOrUpdate.json func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,7 +81,7 @@ func ExampleMachineExtensionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extension_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extension_Update.json func ExampleMachineExtensionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -145,7 +145,7 @@ func ExampleMachineExtensionsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extension_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extension_Delete.json func ExampleMachineExtensionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -166,7 +166,7 @@ func ExampleMachineExtensionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extension_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extension_Get.json func ExampleMachineExtensionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -216,7 +216,7 @@ func ExampleMachineExtensionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extension_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extension_List.json func ExampleMachineExtensionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client.go new file mode 100644 index 0000000000..248b887e54 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client.go @@ -0,0 +1,349 @@ +//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" +) + +// MachineRunCommandsClient contains the methods for the MachineRunCommands group. +// Don't use this type directly, use NewMachineRunCommandsClient() instead. +type MachineRunCommandsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMachineRunCommandsClient creates a new instance of MachineRunCommandsClient 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 NewMachineRunCommandsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachineRunCommandsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MachineRunCommandsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - The operation to create or update a run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - runCommandName - The name of the run command. +// - runCommandProperties - Parameters supplied to the Create Run Command. +// - options - MachineRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineRunCommandsClient.BeginCreateOrUpdate +// method. +func (client *MachineRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, runCommandProperties MachineRunCommand, options *MachineRunCommandsClientBeginCreateOrUpdateOptions) (*runtime.Poller[MachineRunCommandsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, machineName, runCommandName, runCommandProperties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachineRunCommandsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachineRunCommandsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - The operation to create or update a run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +func (client *MachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, runCommandProperties MachineRunCommand, options *MachineRunCommandsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "MachineRunCommandsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, machineName, runCommandName, runCommandProperties, 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 *MachineRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, runCommandProperties MachineRunCommand, options *MachineRunCommandsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + 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 runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, runCommandProperties); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - The operation to delete a run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - runCommandName - The name of the run command. +// - options - MachineRunCommandsClientBeginDeleteOptions contains the optional parameters for the MachineRunCommandsClient.BeginDelete +// method. +func (client *MachineRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *MachineRunCommandsClientBeginDeleteOptions) (*runtime.Poller[MachineRunCommandsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, machineName, runCommandName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MachineRunCommandsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MachineRunCommandsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - The operation to delete a run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +func (client *MachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *MachineRunCommandsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "MachineRunCommandsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, machineName, runCommandName, 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 *MachineRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *MachineRunCommandsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + 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 runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - The operation to get a run command. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - runCommandName - The name of the run command. +// - options - MachineRunCommandsClientGetOptions contains the optional parameters for the MachineRunCommandsClient.Get method. +func (client *MachineRunCommandsClient) Get(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *MachineRunCommandsClientGetOptions) (MachineRunCommandsClientGetResponse, error) { + var err error + const operationName = "MachineRunCommandsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, machineName, runCommandName, options) + if err != nil { + return MachineRunCommandsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MachineRunCommandsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MachineRunCommandsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MachineRunCommandsClient) getCreateRequest(ctx context.Context, resourceGroupName string, machineName string, runCommandName string, options *MachineRunCommandsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + 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 runCommandName == "" { + return nil, errors.New("parameter runCommandName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{runCommandName}", url.PathEscape(runCommandName)) + 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", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachineRunCommandsClient) getHandleResponse(resp *http.Response) (MachineRunCommandsClientGetResponse, error) { + result := MachineRunCommandsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineRunCommand); err != nil { + return MachineRunCommandsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - The operation to get all the run commands of a non-Azure machine. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - machineName - The name of the hybrid machine. +// - options - MachineRunCommandsClientListOptions contains the optional parameters for the MachineRunCommandsClient.NewListPager +// method. +func (client *MachineRunCommandsClient) NewListPager(resourceGroupName string, machineName string, options *MachineRunCommandsClientListOptions) *runtime.Pager[MachineRunCommandsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MachineRunCommandsClientListResponse]{ + More: func(page MachineRunCommandsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachineRunCommandsClientListResponse) (MachineRunCommandsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MachineRunCommandsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, machineName, options) + }, nil) + if err != nil { + return MachineRunCommandsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MachineRunCommandsClient) listCreateRequest(ctx context.Context, resourceGroupName string, machineName string, options *MachineRunCommandsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands" + 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() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MachineRunCommandsClient) listHandleResponse(resp *http.Response) (MachineRunCommandsClientListResponse, error) { + result := MachineRunCommandsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MachineRunCommandsListResult); err != nil { + return MachineRunCommandsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client_example_test.go new file mode 100644 index 0000000000..cc624d69a6 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machineruncommands_client_example_test.go @@ -0,0 +1,262 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/runCommand/RunCommands_CreateOrUpdate.json +func ExampleMachineRunCommandsClient_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.NewMachineRunCommandsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myMachine", "myRunCommand", armhybridcompute.MachineRunCommand{ + Location: to.Ptr("eastus2"), + Properties: &armhybridcompute.MachineRunCommandProperties{ + AsyncExecution: to.Ptr(false), + ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), + OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), + Parameters: []*armhybridcompute.RunCommandInputParameter{ + { + Name: to.Ptr("param1"), + Value: to.Ptr("value1"), + }, + { + Name: to.Ptr("param2"), + Value: to.Ptr("value2"), + }}, + RunAsPassword: to.Ptr(""), + RunAsUser: to.Ptr("user1"), + Source: &armhybridcompute.MachineRunCommandScriptSource{ + Script: to.Ptr("Write-Host Hello World!"), + }, + TimeoutInSeconds: to.Ptr[int32](3600), + }, + }, 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.MachineRunCommand = armhybridcompute.MachineRunCommand{ + // Name: to.Ptr("myRunCommand"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/runcommands"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/runcommands/myRunCommand"), + // Location: to.Ptr("eastus2"), + // Properties: &armhybridcompute.MachineRunCommandProperties{ + // AsyncExecution: to.Ptr(false), + // ErrorBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt"), + // OutputBlobURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt"), + // Parameters: []*armhybridcompute.RunCommandInputParameter{ + // { + // Name: to.Ptr("param1"), + // Value: to.Ptr("value1"), + // }, + // { + // Name: to.Ptr("param2"), + // Value: to.Ptr("value2"), + // }}, + // ProvisioningState: to.Ptr("Succeeded"), + // RunAsUser: to.Ptr("user1"), + // Source: &armhybridcompute.MachineRunCommandScriptSource{ + // Script: to.Ptr("Write-Host Hello World!"), + // }, + // TimeoutInSeconds: to.Ptr[int32](3600), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/runCommand/RunCommands_Delete.json +func ExampleMachineRunCommandsClient_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.NewMachineRunCommandsClient().BeginDelete(ctx, "myResourceGroup", "myMachine", "myRunCommand", 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/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/runCommand/RunCommands_Get.json +func ExampleMachineRunCommandsClient_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.NewMachineRunCommandsClient().Get(ctx, "myResourceGroup", "myMachine", "myRunCommand", 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.MachineRunCommand = armhybridcompute.MachineRunCommand{ + // Name: to.Ptr("myRunCommand"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/runcommands"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/runcommands/myRunCommand"), + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // Properties: &armhybridcompute.MachineRunCommandProperties{ + // AsyncExecution: to.Ptr(false), + // InstanceView: &armhybridcompute.MachineRunCommandInstanceView{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // Error: to.Ptr(""), + // ExecutionMessage: to.Ptr(""), + // ExecutionState: to.Ptr(armhybridcompute.ExecutionStateSucceeded), + // ExitCode: to.Ptr[int32](0), + // Output: to.Ptr("Hello World"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // }, + // Parameters: []*armhybridcompute.RunCommandInputParameter{ + // { + // Name: to.Ptr("param1"), + // Value: to.Ptr("value1"), + // }, + // { + // Name: to.Ptr("param2"), + // Value: to.Ptr("value2"), + // }}, + // ProtectedParameters: []*armhybridcompute.RunCommandInputParameter{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // RunAsUser: to.Ptr("user1"), + // Source: &armhybridcompute.MachineRunCommandScriptSource{ + // Script: to.Ptr("Write-Host Hello World!"), + // }, + // TimeoutInSeconds: to.Ptr[int32](3600), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/runCommand/RunCommands_List.json +func ExampleMachineRunCommandsClient_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.NewMachineRunCommandsClient().NewListPager("myResourceGroup", "myMachine", &armhybridcompute.MachineRunCommandsClientListOptions{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.MachineRunCommandsListResult = armhybridcompute.MachineRunCommandsListResult{ + // Value: []*armhybridcompute.MachineRunCommand{ + // { + // Name: to.Ptr("myRunCommand_1"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/runcommands"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/runcommands/myRunCommand_1"), + // Location: to.Ptr("eastus2"), + // Properties: &armhybridcompute.MachineRunCommandProperties{ + // AsyncExecution: to.Ptr(false), + // InstanceView: &armhybridcompute.MachineRunCommandInstanceView{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // Error: to.Ptr(""), + // ExecutionMessage: to.Ptr(""), + // ExecutionState: to.Ptr(armhybridcompute.ExecutionStateSucceeded), + // ExitCode: to.Ptr[int32](0), + // Output: to.Ptr("Hello World"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // }, + // Parameters: []*armhybridcompute.RunCommandInputParameter{ + // { + // Name: to.Ptr("param1"), + // Value: to.Ptr("value1"), + // }, + // { + // Name: to.Ptr("param2"), + // Value: to.Ptr("value2"), + // }}, + // ProtectedParameters: []*armhybridcompute.RunCommandInputParameter{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // RunAsUser: to.Ptr("user1"), + // Source: &armhybridcompute.MachineRunCommandScriptSource{ + // Script: to.Ptr("Write-Host Hello World!"), + // }, + // TimeoutInSeconds: to.Ptr[int32](3600), + // }, + // }, + // { + // Name: to.Ptr("myRunCommand_2"), + // Type: to.Ptr("Microsoft.HybridCompute/machines/runcommands"), + // ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/Machines/myMachine/runcommands/myRunCommand_2"), + // Location: to.Ptr("eastus2"), + // Properties: &armhybridcompute.MachineRunCommandProperties{ + // AsyncExecution: to.Ptr(false), + // InstanceView: &armhybridcompute.MachineRunCommandInstanceView{ + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // Error: to.Ptr(""), + // ExecutionMessage: to.Ptr(""), + // ExecutionState: to.Ptr(armhybridcompute.ExecutionStateSucceeded), + // ExitCode: to.Ptr[int32](0), + // Output: to.Ptr(""), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-15T20:48:41.464Z"); return t}()), + // }, + // Parameters: []*armhybridcompute.RunCommandInputParameter{ + // }, + // ProtectedParameters: []*armhybridcompute.RunCommandInputParameter{ + // }, + // ProvisioningState: to.Ptr("Succeeded"), + // RunAsUser: to.Ptr("userA"), + // Source: &armhybridcompute.MachineRunCommandScriptSource{ + // Script: to.Ptr("Get-Process | Where-Object { $_.CPU -gt 10000 }"), + // }, + // TimeoutInSeconds: to.Ptr[int32](100), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go index 9a14d6ab2e..44abca1527 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client.go @@ -46,7 +46,7 @@ func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, // 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 2024-07-10 +// Generated from API version 2024-07-31-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 @@ -72,7 +72,7 @@ func (client *MachinesClient) BeginAssessPatches(ctx context.Context, resourceGr // 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 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *MachinesClient) assessPatches(ctx context.Context, resourceGroupName string, name string, options *MachinesClientBeginAssessPatchesOptions) (*http.Response, error) { var err error const operationName = "MachinesClient.BeginAssessPatches" @@ -114,7 +114,7 @@ func (client *MachinesClient) assessPatchesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -124,7 +124,7 @@ func (client *MachinesClient) assessPatchesCreateRequest(ctx context.Context, re // machine creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -174,7 +174,7 @@ func (client *MachinesClient) createOrUpdateCreateRequest(ctx context.Context, r if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -195,7 +195,7 @@ func (client *MachinesClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - The operation to delete a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -240,7 +240,7 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +249,7 @@ func (client *MachinesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Retrieves information about the model view or the instance view of a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -298,7 +298,7 @@ func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGrou if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -316,7 +316,7 @@ func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesCl // 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 2024-07-10 +// Generated from API version 2024-07-31-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 @@ -343,7 +343,7 @@ func (client *MachinesClient) BeginInstallPatches(ctx context.Context, resourceG // 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 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *MachinesClient) installPatches(ctx context.Context, resourceGroupName string, name string, installPatchesInput MachineInstallPatchesParameters, options *MachinesClientBeginInstallPatchesOptions) (*http.Response, error) { var err error const operationName = "MachinesClient.BeginInstallPatches" @@ -385,7 +385,7 @@ func (client *MachinesClient) installPatchesCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, installPatchesInput); err != nil { @@ -397,7 +397,7 @@ func (client *MachinesClient) installPatchesCreateRequest(ctx context.Context, r // 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 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MachinesClientListByResourceGroupOptions contains the optional parameters for the MachinesClient.NewListByResourceGroupPager // method. @@ -443,7 +443,7 @@ func (client *MachinesClient) listByResourceGroupCreateRequest(ctx context.Conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +461,7 @@ func (client *MachinesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists all the hybrid machines in the specified subscription. Use the nextLink property in // the response to get the next page of hybrid machines. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - options - MachinesClientListBySubscriptionOptions contains the optional parameters for the MachinesClient.NewListBySubscriptionPager // method. func (client *MachinesClient) NewListBySubscriptionPager(options *MachinesClientListBySubscriptionOptions) *runtime.Pager[MachinesClientListBySubscriptionResponse] { @@ -499,7 +499,7 @@ func (client *MachinesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -517,7 +517,7 @@ func (client *MachinesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - The operation to update a hybrid machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -564,7 +564,7 @@ func (client *MachinesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go index 543be93af9..6e735ee5b1 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/machines_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_CreateOrUpdate.json func ExampleMachinesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,7 +144,7 @@ func ExampleMachinesClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_Update.json func ExampleMachinesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -269,7 +269,7 @@ func ExampleMachinesClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_Delete.json func ExampleMachinesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -286,7 +286,7 @@ func ExampleMachinesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_Get.json func ExampleMachinesClient_Get_getMachine() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -333,6 +333,19 @@ func ExampleMachinesClient_Get_getMachine() { // "manufacturer": to.Ptr("Microsoft Corporation"), // "model": to.Ptr("Virtual Machine"), // }, + // FirmwareProfile: &armhybridcompute.FirmwareProfile{ + // Type: to.Ptr("BIOS"), + // SerialNumber: to.Ptr("007f0232-1c2e-4978-8604-ea44e7a5f5a0"), + // }, + // HardwareProfile: &armhybridcompute.HardwareProfile{ + // NumberOfCPUSockets: to.Ptr[int32](2), + // Processors: []*armhybridcompute.Processor{ + // { + // Name: to.Ptr("Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz"), + // NumberOfCores: to.Ptr[int32](4), + // }}, + // TotalPhysicalMemoryInBytes: to.Ptr[int64](34359738368), + // }, // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ // EsuKeys: []*armhybridcompute.EsuKey{ @@ -381,6 +394,8 @@ func ExampleMachinesClient_Get_getMachine() { // NetworkProfile: &armhybridcompute.NetworkProfile{ // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ // { + // Name: to.Ptr("Wi-Fi"), + // ID: to.Ptr("8"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("192.168.12.345"), @@ -389,8 +404,11 @@ func ExampleMachinesClient_Get_getMachine() { // AddressPrefix: to.Ptr("192.168.12.0/24"), // }, // }}, + // MacAddress: to.Ptr("3c:49:6e:13:0e:73"), // }, // { + // Name: to.Ptr("Ethernet"), + // ID: to.Ptr("23"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), @@ -399,6 +417,7 @@ func ExampleMachinesClient_Get_getMachine() { // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), // }, // }}, + // MacAddress: to.Ptr("10:15:5c:52:f9:b8"), // }}, // }, // OSEdition: to.Ptr("Standard"), @@ -429,6 +448,18 @@ func ExampleMachinesClient_Get_getMachine() { // Status: to.Ptr("Running"), // }, // }, + // StorageProfile: &armhybridcompute.StorageProfile{ + // Disks: []*armhybridcompute.Disk{ + // { + // Name: to.Ptr("Windows"), + // Path: to.Ptr("C:/"), + // DiskType: to.Ptr("Fixed"), + // GeneratedID: to.Ptr("94318602-6e46-4eaa-997e-0e528afe3d17"), + // ID: to.Ptr("2"), + // MaxSizeInBytes: to.Ptr[int64](1022870155264), + // UsedSpaceInBytes: to.Ptr[int64](435501297664), + // }}, + // }, // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), // }, // Resources: []*armhybridcompute.MachineExtension{ @@ -436,7 +467,7 @@ func ExampleMachinesClient_Get_getMachine() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_Get_LicenseProfileInstanceView.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_Get_LicenseProfileInstanceView.json func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -483,6 +514,19 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // "manufacturer": to.Ptr("Microsoft Corporation"), // "model": to.Ptr("Virtual Machine"), // }, + // FirmwareProfile: &armhybridcompute.FirmwareProfile{ + // Type: to.Ptr("BIOS"), + // SerialNumber: to.Ptr("007f0232-1c2e-4978-8604-ea44e7a5f5a0"), + // }, + // HardwareProfile: &armhybridcompute.HardwareProfile{ + // NumberOfCPUSockets: to.Ptr[int32](2), + // Processors: []*armhybridcompute.Processor{ + // { + // Name: to.Ptr("Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz"), + // NumberOfCores: to.Ptr[int32](4), + // }}, + // TotalPhysicalMemoryInBytes: to.Ptr[int64](34359738368), + // }, // LicenseProfile: &armhybridcompute.LicenseProfileMachineInstanceView{ // EsuProfile: &armhybridcompute.LicenseProfileMachineInstanceViewEsuProperties{ // EsuKeys: []*armhybridcompute.EsuKey{ @@ -550,6 +594,8 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // NetworkProfile: &armhybridcompute.NetworkProfile{ // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ // { + // Name: to.Ptr("Wi-Fi"), + // ID: to.Ptr("8"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("192.168.12.345"), @@ -558,8 +604,11 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // AddressPrefix: to.Ptr("192.168.12.0/24"), // }, // }}, + // MacAddress: to.Ptr("3c:49:6e:13:0e:73"), // }, // { + // Name: to.Ptr("Ethernet"), + // ID: to.Ptr("23"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), @@ -568,6 +617,7 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), // }, // }}, + // MacAddress: to.Ptr("10:15:5c:52:f9:b8"), // }}, // }, // OSEdition: to.Ptr("Standard"), @@ -598,6 +648,18 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // Status: to.Ptr("Running"), // }, // }, + // StorageProfile: &armhybridcompute.StorageProfile{ + // Disks: []*armhybridcompute.Disk{ + // { + // Name: to.Ptr("Windows"), + // Path: to.Ptr("C:/"), + // DiskType: to.Ptr("Fixed"), + // GeneratedID: to.Ptr("94318602-6e46-4eaa-997e-0e528afe3d17"), + // ID: to.Ptr("2"), + // MaxSizeInBytes: to.Ptr[int64](1022870155264), + // UsedSpaceInBytes: to.Ptr[int64](435501297664), + // }}, + // }, // VMID: to.Ptr("b7a098cc-b0b8-46e8-a205-62f301a62a8f"), // }, // Resources: []*armhybridcompute.MachineExtension{ @@ -605,7 +667,7 @@ func ExampleMachinesClient_Get_getMachineWithLicenseProfileInstanceView() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machine_AssessPatches.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machine_AssessPatches.json func ExampleMachinesClient_BeginAssessPatches() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -648,7 +710,7 @@ func ExampleMachinesClient_BeginAssessPatches() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machine_InstallPatches.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machine_InstallPatches.json func ExampleMachinesClient_BeginInstallPatches() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -696,7 +758,7 @@ func ExampleMachinesClient_BeginInstallPatches() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_ListByResourceGroup.json func ExampleMachinesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -909,7 +971,7 @@ func ExampleMachinesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/machine/Machines_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/machine/Machines_ListBySubscription.json func ExampleMachinesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go index 02df22a6cf..1901f6a855 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client.go @@ -46,7 +46,7 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // BeginUpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the hybrid machine. // - extensionUpgradeParameters - Parameters supplied to the Upgrade Extensions operation. @@ -72,7 +72,7 @@ func (client *ManagementClient) BeginUpgradeExtensions(ctx context.Context, reso // UpgradeExtensions - The operation to Upgrade Machine Extensions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *ManagementClient) upgradeExtensions(ctx context.Context, resourceGroupName string, machineName string, extensionUpgradeParameters MachineExtensionUpgrade, options *ManagementClientBeginUpgradeExtensionsOptions) (*http.Response, error) { var err error const operationName = "ManagementClient.BeginUpgradeExtensions" @@ -114,7 +114,7 @@ func (client *ManagementClient) upgradeExtensionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, extensionUpgradeParameters); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go index e8456d6099..da1e0014d9 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/management_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/extension/Extensions_Upgrade.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/extension/Extensions_Upgrade.json func ExampleManagementClient_BeginUpgradeExtensions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go index 218e2348f0..528c00f376 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models.go @@ -59,13 +59,13 @@ type AgentConfiguration struct { // AgentUpgrade - The info w.r.t Agent Upgrade. type AgentUpgrade struct { - // The correlation ID passed in from RSM per upgrade. + // The correlation ID associated with an agent upgrade operation. CorrelationID *string // Specifies the version info w.r.t AgentUpgrade for the machine. DesiredVersion *string - // Specifies if RSM should try to upgrade this machine + // Specifies if the machine's agent should be upgraded EnableAutomaticUpgrade *bool // READ-ONLY; Specifies the version of the last attempt @@ -143,6 +143,30 @@ type ConnectionDetail struct { PrivateIPAddress *string } +// Disk - Describes a disk on the machine +type Disk struct { + // The type of the disk. + DiskType *string + + // The generated ID of the disk. + GeneratedID *string + + // The ID of the disk. + ID *string + + // The size of the disk, in bytes + MaxSizeInBytes *int64 + + // The name of the disk. + Name *string + + // The path of the disk. + Path *string + + // The amount of space used on the disk, in bytes + UsedSpaceInBytes *int64 +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -228,6 +252,111 @@ type ExtensionValueProperties struct { Version *string } +// ExtensionsResourceStatus - Instance view status. +type ExtensionsResourceStatus struct { + // The status code. + Code *string + + // The short localizable label for the status. + DisplayStatus *string + + // The level code. + Level *ExtensionsStatusLevelTypes + + // The detailed status message, including for alerts and error messages. + Message *string + + // The time of the status. + Time *time.Time +} + +// FirmwareProfile - Describes the firmware of the machine +type FirmwareProfile struct { + // READ-ONLY; The serial number of the firmware + SerialNumber *string + + // READ-ONLY; The type of the firmware + Type *string +} + +// Gateway - Describes an Arc Gateway. +type Gateway struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Hybrid Compute Gateway properties + Properties *GatewayProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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 +} + +// GatewayProperties - Describes the properties of a Gateway Profile. +type GatewayProperties struct { + // Specifies the list of features that are enabled for this Gateway. + AllowedFeatures []*string + + // The type of the Gateway resource. + GatewayType *GatewayType + + // READ-ONLY; The endpoint fqdn for the Gateway. + GatewayEndpoint *string + + // READ-ONLY; A unique, immutable, identifier for the Gateway. + GatewayID *string + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *ProvisioningState +} + +// GatewayUpdate - Describes a License Update. +type GatewayUpdate struct { + // Gateway Update properties + Properties *GatewayUpdateProperties + + // Resource tags + Tags map[string]*string +} + +// GatewayUpdateProperties - Describes the Update properties of a Gateway Profile. +type GatewayUpdateProperties struct { + // Specifies the list of features that are enabled for this Gateway. + AllowedFeatures []*string +} + +// GatewaysListResult - The List license operation response. +type GatewaysListResult struct { + // REQUIRED; The list of Gateways. + Value []*Gateway + + // The URI to fetch the next page of Gateways. Call ListNext() with this URI to fetch the next page of Gateways. + NextLink *string +} + +// HardwareProfile - Describes the hardware of the machine +type HardwareProfile struct { + // READ-ONLY; The total number of CPU sockets available on the machine + NumberOfCPUSockets *int32 + + // READ-ONLY; The physical processors of the machine. + Processors []*Processor + + // READ-ONLY; The total physical memory on the machine + TotalPhysicalMemoryInBytes *int64 +} + // IPAddress - Describes properties of the IP address. type IPAddress struct { // Represents the IP Address. @@ -912,6 +1041,12 @@ type MachineProperties struct { // READ-ONLY; Details about the error state. ErrorDetails []*ErrorDetail + // READ-ONLY; Information about the machine's firmware + FirmwareProfile *FirmwareProfile + + // READ-ONLY; Information about the machine's hardware + HardwareProfile *HardwareProfile + // READ-ONLY; The time of the last status change. LastStatusChange *time.Time @@ -939,10 +1074,146 @@ type MachineProperties struct { // READ-ONLY; The status of the hybrid machine agent. Status *StatusTypes + // READ-ONLY; Information about the machine's storage + StorageProfile *StorageProfile + // READ-ONLY; Specifies the Arc Machine's unique SMBIOS ID VMUUID *string } +// MachineRunCommand - Describes a Run Command +type MachineRunCommand struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Describes Run Command Properties + Properties *MachineRunCommandProperties + + // 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 +} + +// MachineRunCommandInstanceView - The instance view of a machine run command. +type MachineRunCommandInstanceView struct { + // Script end time. + EndTime *time.Time + + // Script error stream. + Error *string + + // Communicate script configuration errors or execution messages. + ExecutionMessage *string + + // Script execution status. + ExecutionState *ExecutionState + + // Exit code returned from script execution. + ExitCode *int32 + + // Script output stream. + Output *string + + // Script start time. + StartTime *time.Time + + // The status information. + Statuses []*ExtensionsResourceStatus +} + +// MachineRunCommandProperties - Describes the properties of a run command. +type MachineRunCommandProperties struct { + // Optional. If set to true, provisioning will complete as soon as script starts and will not wait for script to complete. + AsyncExecution *bool + + // User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + ErrorBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with read, append, create, write + // access OR use managed identity to provide the VM access to the blob. Refer + // errorBlobManagedIdentity parameter. + ErrorBlobURI *string + + // User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty object in case of system-assigned + // identity. Make sure managed identity has been given access to blob's + // container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned identity, make sure you add it + // under VM's identity. For more info on managed identity and Run Command, refer + // https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged + OutputBlobManagedIdentity *RunCommandManagedIdentity + + // Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI with read, append, create, + // write access OR use managed identity to provide the VM access to the blob. Refer + // outputBlobManagedIdentity parameter. + OutputBlobURI *string + + // The parameters used by the script. + Parameters []*RunCommandInputParameter + + // The parameters used by the script. + ProtectedParameters []*RunCommandInputParameter + + // Specifies the user account password on the machine when executing the run command. + RunAsPassword *string + + // Specifies the user account on the machine when executing the run command. + RunAsUser *string + + // The source of the run command script. + Source *MachineRunCommandScriptSource + + // The timeout in seconds to execute the run command. + TimeoutInSeconds *int32 + + // READ-ONLY; The machine run command instance view. + InstanceView *MachineRunCommandInstanceView + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string +} + +// MachineRunCommandScriptSource - Describes the script sources for run command. Use only one of script, scriptUri, commandId. +type MachineRunCommandScriptSource struct { + // Specifies the commandId of predefined built-in script. + CommandID *string + + // Specifies the script content to be executed on the machine. + Script *string + + // Specifies the script download location. It can be either SAS URI of an Azure storage blob with read access or public URI. + ScriptURI *string + + // User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use an empty object in case + // of system-assigned identity. Make sure the Azure storage blob exists, and managed + // identity has been given access to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned + // identity, make sure you add it under VM's identity. For more info on + // managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. + ScriptURIManagedIdentity *RunCommandManagedIdentity +} + +// MachineRunCommandsListResult - Describes the Run Commands List Result. +type MachineRunCommandsListResult struct { + // The uri to fetch the next page of run commands. Call ListNext() with this to fetch the next page of run commands. + NextLink *string + + // The list of run commands + Value []*MachineRunCommand +} + // MachineUpdate - Describes a hybrid machine Update. type MachineUpdate struct { // Identity for the resource. @@ -981,8 +1252,17 @@ type MachineUpdateProperties struct { // NetworkInterface - Describes a network interface. type NetworkInterface struct { + // Represents the ID of the network interface. + ID *string + // The list of IP addresses in this interface. IPAddresses []*IPAddress + + // Represents MAC address of the network interface. + MacAddress *string + + // Represents the name of the network interface. + Name *string } // NetworkProfile - Describes the network information on this machine. @@ -1332,6 +1612,15 @@ type PrivateLinkServiceConnectionStateProperty struct { ActionsRequired *string } +// Processor - Describes the firmware of the machine +type Processor struct { + // READ-ONLY; The name of the processor. + Name *string + + // READ-ONLY; The total number of physical cores on the processor. + NumberOfCores *int32 +} + // ProductFeature - Product Feature type ProductFeature struct { // Product feature name. @@ -1413,6 +1702,30 @@ type ResourceAssociation struct { Name *string } +// RunCommandInputParameter - Describes the properties of a run command parameter. +type RunCommandInputParameter struct { + // REQUIRED; The run command parameter name. + Name *string + + // REQUIRED; The run command parameter value. + Value *string +} + +// RunCommandManagedIdentity - Contains clientId or objectId (use only one, not both) of a user-assigned managed identity +// that has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object in case of +// system-assigned identity. Make sure the Azure storage blob exists in case of scriptUri, and managed identity has been given +// access to blob's container with 'Storage Blob Data Reader' role assignment +// with scriptUri blob and 'Storage Blob Data Contributor' for Append blobs(outputBlobUri, errorBlobUri). In case of user +// assigned identity, make sure you add it under VM's identity. For more info on +// managed identity and Run Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. +type RunCommandManagedIdentity struct { + // Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if this is provided. + ClientID *string + + // Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if this is provided. + ObjectID *string +} + // ServiceStatus - Describes the status and behavior of a service. type ServiceStatus struct { // The behavior of the service when the Arc-enabled machine starts up. @@ -1431,6 +1744,44 @@ type ServiceStatuses struct { GuestConfigurationService *ServiceStatus } +type Settings struct { + // Settings properties + Properties *SettingsProperties + + // 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 +} + +// SettingsGatewayProperties - Settings Gateway properties +type SettingsGatewayProperties struct { + // Associated Gateway Resource Id + GatewayResourceID *string +} + +// SettingsProperties - Settings properties +type SettingsProperties struct { + // Settings Gateway properties + GatewayProperties *SettingsGatewayProperties + + // READ-ONLY; Azure resource tenant Id + TenantID *string +} + +// StorageProfile - Describes the storage configuration of the machine +type StorageProfile struct { + // The disks on the machine. + Disks []*Disk +} + // Subnet - Describes the subnet. type Subnet struct { // Represents address prefix. diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go index 13ba377f31..1fc781f1e9 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/models_serde.go @@ -343,6 +343,57 @@ func (c *ConnectionDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskType", d.DiskType) + populate(objectMap, "generatedId", d.GeneratedID) + populate(objectMap, "id", d.ID) + populate(objectMap, "maxSizeInBytes", d.MaxSizeInBytes) + populate(objectMap, "name", d.Name) + populate(objectMap, "path", d.Path) + populate(objectMap, "usedSpaceInBytes", d.UsedSpaceInBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Disk. +func (d *Disk) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskType": + err = unpopulate(val, "DiskType", &d.DiskType) + delete(rawMsg, key) + case "generatedId": + err = unpopulate(val, "GeneratedID", &d.GeneratedID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "maxSizeInBytes": + err = unpopulate(val, "MaxSizeInBytes", &d.MaxSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &d.Path) + delete(rawMsg, key) + case "usedSpaceInBytes": + err = unpopulate(val, "UsedSpaceInBytes", &d.UsedSpaceInBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -607,6 +658,298 @@ func (e *ExtensionValueProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ExtensionsResourceStatus. +func (e ExtensionsResourceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "displayStatus", e.DisplayStatus) + populate(objectMap, "level", e.Level) + populate(objectMap, "message", e.Message) + populateDateTimeRFC3339(objectMap, "time", e.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionsResourceStatus. +func (e *ExtensionsResourceStatus) 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 "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &e.DisplayStatus) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &e.Level) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(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 FirmwareProfile. +func (f FirmwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serialNumber", f.SerialNumber) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirmwareProfile. +func (f *FirmwareProfile) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serialNumber": + err = unpopulate(val, "SerialNumber", &f.SerialNumber) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Gateway. +func (g Gateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Gateway. +func (g *Gateway) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayProperties. +func (g GatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedFeatures", g.AllowedFeatures) + populate(objectMap, "gatewayEndpoint", g.GatewayEndpoint) + populate(objectMap, "gatewayId", g.GatewayID) + populate(objectMap, "gatewayType", g.GatewayType) + populate(objectMap, "provisioningState", g.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayProperties. +func (g *GatewayProperties) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedFeatures": + err = unpopulate(val, "AllowedFeatures", &g.AllowedFeatures) + delete(rawMsg, key) + case "gatewayEndpoint": + err = unpopulate(val, "GatewayEndpoint", &g.GatewayEndpoint) + delete(rawMsg, key) + case "gatewayId": + err = unpopulate(val, "GatewayID", &g.GatewayID) + delete(rawMsg, key) + case "gatewayType": + err = unpopulate(val, "GatewayType", &g.GatewayType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayUpdate. +func (g GatewayUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayUpdate. +func (g *GatewayUpdate) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewayUpdateProperties. +func (g GatewayUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedFeatures", g.AllowedFeatures) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewayUpdateProperties. +func (g *GatewayUpdateProperties) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedFeatures": + err = unpopulate(val, "AllowedFeatures", &g.AllowedFeatures) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GatewaysListResult. +func (g GatewaysListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GatewaysListResult. +func (g *GatewaysListResult) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HardwareProfile. +func (h HardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "numberOfCpuSockets", h.NumberOfCPUSockets) + populate(objectMap, "processors", h.Processors) + populate(objectMap, "totalPhysicalMemoryInBytes", h.TotalPhysicalMemoryInBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HardwareProfile. +func (h *HardwareProfile) 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 "numberOfCpuSockets": + err = unpopulate(val, "NumberOfCPUSockets", &h.NumberOfCPUSockets) + delete(rawMsg, key) + case "processors": + err = unpopulate(val, "Processors", &h.Processors) + delete(rawMsg, key) + case "totalPhysicalMemoryInBytes": + err = unpopulate(val, "TotalPhysicalMemoryInBytes", &h.TotalPhysicalMemoryInBytes) + 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) @@ -2130,6 +2473,8 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "domainName", m.DomainName) populate(objectMap, "errorDetails", m.ErrorDetails) populate(objectMap, "extensions", m.Extensions) + populate(objectMap, "firmwareProfile", m.FirmwareProfile) + populate(objectMap, "hardwareProfile", m.HardwareProfile) populateDateTimeRFC3339(objectMap, "lastStatusChange", m.LastStatusChange) populate(objectMap, "licenseProfile", m.LicenseProfile) populate(objectMap, "locationData", m.LocationData) @@ -2147,6 +2492,7 @@ func (m MachineProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "serviceStatuses", m.ServiceStatuses) populate(objectMap, "status", m.Status) + populate(objectMap, "storageProfile", m.StorageProfile) populate(objectMap, "vmId", m.VMID) populate(objectMap, "vmUuid", m.VMUUID) return json.Marshal(objectMap) @@ -2197,6 +2543,12 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "extensions": err = unpopulate(val, "Extensions", &m.Extensions) delete(rawMsg, key) + case "firmwareProfile": + err = unpopulate(val, "FirmwareProfile", &m.FirmwareProfile) + delete(rawMsg, key) + case "hardwareProfile": + err = unpopulate(val, "HardwareProfile", &m.HardwareProfile) + delete(rawMsg, key) case "lastStatusChange": err = unpopulateDateTimeRFC3339(val, "LastStatusChange", &m.LastStatusChange) delete(rawMsg, key) @@ -2248,6 +2600,9 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) + case "storageProfile": + err = unpopulate(val, "StorageProfile", &m.StorageProfile) + delete(rawMsg, key) case "vmId": err = unpopulate(val, "VMID", &m.VMID) delete(rawMsg, key) @@ -2262,6 +2617,257 @@ func (m *MachineProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MachineRunCommand. +func (m MachineRunCommand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommand. +func (m *MachineRunCommand) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MachineRunCommandInstanceView. +func (m MachineRunCommandInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", m.EndTime) + populate(objectMap, "error", m.Error) + populate(objectMap, "executionMessage", m.ExecutionMessage) + populate(objectMap, "executionState", m.ExecutionState) + populate(objectMap, "exitCode", m.ExitCode) + populate(objectMap, "output", m.Output) + populateDateTimeRFC3339(objectMap, "startTime", m.StartTime) + populate(objectMap, "statuses", m.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandInstanceView. +func (m *MachineRunCommandInstanceView) 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 "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &m.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &m.Error) + delete(rawMsg, key) + case "executionMessage": + err = unpopulate(val, "ExecutionMessage", &m.ExecutionMessage) + delete(rawMsg, key) + case "executionState": + err = unpopulate(val, "ExecutionState", &m.ExecutionState) + delete(rawMsg, key) + case "exitCode": + err = unpopulate(val, "ExitCode", &m.ExitCode) + delete(rawMsg, key) + case "output": + err = unpopulate(val, "Output", &m.Output) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &m.Statuses) + 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 MachineRunCommandProperties. +func (m MachineRunCommandProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "asyncExecution", m.AsyncExecution) + populate(objectMap, "errorBlobManagedIdentity", m.ErrorBlobManagedIdentity) + populate(objectMap, "errorBlobUri", m.ErrorBlobURI) + populate(objectMap, "instanceView", m.InstanceView) + populate(objectMap, "outputBlobManagedIdentity", m.OutputBlobManagedIdentity) + populate(objectMap, "outputBlobUri", m.OutputBlobURI) + populate(objectMap, "parameters", m.Parameters) + populate(objectMap, "protectedParameters", m.ProtectedParameters) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "runAsPassword", m.RunAsPassword) + populate(objectMap, "runAsUser", m.RunAsUser) + populate(objectMap, "source", m.Source) + populate(objectMap, "timeoutInSeconds", m.TimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandProperties. +func (m *MachineRunCommandProperties) 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 "asyncExecution": + err = unpopulate(val, "AsyncExecution", &m.AsyncExecution) + delete(rawMsg, key) + case "errorBlobManagedIdentity": + err = unpopulate(val, "ErrorBlobManagedIdentity", &m.ErrorBlobManagedIdentity) + delete(rawMsg, key) + case "errorBlobUri": + err = unpopulate(val, "ErrorBlobURI", &m.ErrorBlobURI) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &m.InstanceView) + delete(rawMsg, key) + case "outputBlobManagedIdentity": + err = unpopulate(val, "OutputBlobManagedIdentity", &m.OutputBlobManagedIdentity) + delete(rawMsg, key) + case "outputBlobUri": + err = unpopulate(val, "OutputBlobURI", &m.OutputBlobURI) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &m.Parameters) + delete(rawMsg, key) + case "protectedParameters": + err = unpopulate(val, "ProtectedParameters", &m.ProtectedParameters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "runAsPassword": + err = unpopulate(val, "RunAsPassword", &m.RunAsPassword) + delete(rawMsg, key) + case "runAsUser": + err = unpopulate(val, "RunAsUser", &m.RunAsUser) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &m.TimeoutInSeconds) + 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 MachineRunCommandScriptSource. +func (m MachineRunCommandScriptSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "commandId", m.CommandID) + populate(objectMap, "script", m.Script) + populate(objectMap, "scriptUri", m.ScriptURI) + populate(objectMap, "scriptUriManagedIdentity", m.ScriptURIManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandScriptSource. +func (m *MachineRunCommandScriptSource) 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 "commandId": + err = unpopulate(val, "CommandID", &m.CommandID) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &m.Script) + delete(rawMsg, key) + case "scriptUri": + err = unpopulate(val, "ScriptURI", &m.ScriptURI) + delete(rawMsg, key) + case "scriptUriManagedIdentity": + err = unpopulate(val, "ScriptURIManagedIdentity", &m.ScriptURIManagedIdentity) + 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 MachineRunCommandsListResult. +func (m MachineRunCommandsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineRunCommandsListResult. +func (m *MachineRunCommandsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MachineUpdate. func (m MachineUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2351,7 +2957,10 @@ func (m *MachineUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkInterface. func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) populate(objectMap, "ipAddresses", n.IPAddresses) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } @@ -2364,9 +2973,18 @@ func (n *NetworkInterface) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) case "ipAddresses": err = unpopulate(val, "IPAddresses", &n.IPAddresses) delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -3363,6 +3981,37 @@ func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) e return nil } +// MarshalJSON implements the json.Marshaller interface for type Processor. +func (p Processor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "numberOfCores", p.NumberOfCores) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Processor. +func (p *Processor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "numberOfCores": + err = unpopulate(val, "NumberOfCores", &p.NumberOfCores) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProductFeature. func (p ProductFeature) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3585,6 +4234,68 @@ func (r *ResourceAssociation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RunCommandInputParameter. +func (r RunCommandInputParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandInputParameter. +func (r *RunCommandInputParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RunCommandManagedIdentity. +func (r RunCommandManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", r.ClientID) + populate(objectMap, "objectId", r.ObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RunCommandManagedIdentity. +func (r *RunCommandManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &r.ClientID) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &r.ObjectID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ServiceStatus. func (s ServiceStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3647,6 +4358,134 @@ func (s *ServiceStatuses) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Settings. +func (s Settings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Settings. +func (s *Settings) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 SettingsGatewayProperties. +func (s SettingsGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gatewayResourceId", s.GatewayResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsGatewayProperties. +func (s *SettingsGatewayProperties) 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 "gatewayResourceId": + err = unpopulate(val, "GatewayResourceID", &s.GatewayResourceID) + 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 SettingsProperties. +func (s SettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gatewayProperties", s.GatewayProperties) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsProperties. +func (s *SettingsProperties) 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 "gatewayProperties": + err = unpopulate(val, "GatewayProperties", &s.GatewayProperties) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) + 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 StorageProfile. +func (s StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "disks", s.Disks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProfile. +func (s *StorageProfile) 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 "disks": + err = unpopulate(val, "Disks", &s.Disks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Subnet. func (s Subnet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go index 7e85e1ad78..1733e5ae36 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client.go @@ -46,7 +46,7 @@ func NewNetworkProfileClient(subscriptionID string, credential azcore.TokenCrede // Get - The operation to get network information of hybrid machine // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-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. @@ -92,7 +92,7 @@ func (client *NetworkProfileClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go index 6d6985f203..529d4b60fb 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networkprofile_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/NetworkProfile_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/NetworkProfile_Get.json func ExampleNetworkProfileClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,6 +38,8 @@ func ExampleNetworkProfileClient_Get() { // res.NetworkProfile = armhybridcompute.NetworkProfile{ // NetworkInterfaces: []*armhybridcompute.NetworkInterface{ // { + // Name: to.Ptr("Wi-Fi"), + // ID: to.Ptr("8"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("192.168.12.345"), @@ -46,8 +48,11 @@ func ExampleNetworkProfileClient_Get() { // AddressPrefix: to.Ptr("192.168.12.0/24"), // }, // }}, + // MacAddress: to.Ptr("3c:49:6e:13:0e:73"), // }, // { + // Name: to.Ptr("Ethernet"), + // ID: to.Ptr("23"), // IPAddresses: []*armhybridcompute.IPAddress{ // { // Address: to.Ptr("1001:0:34aa:5000:1234:aaaa:bbbb:cccc"), @@ -56,6 +61,7 @@ func ExampleNetworkProfileClient_Get() { // AddressPrefix: to.Ptr("1001:0:34aa:5000::/64"), // }, // }}, + // MacAddress: to.Ptr("10:15:5c:52:f9:b8"), // }}, // } } diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client.go index 3d9e4b8cfe..c165856717 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client.go @@ -46,7 +46,7 @@ func NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, cred // GetByPrivateLinkScope - Gets the network security perimeter configuration for a private link scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - perimeterName - The name, in the format {perimeterGuid}.{associationName}, of the Network Security Perimeter resource. @@ -98,7 +98,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getByPrivateLinkScop return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getByPrivateLinkScop // NewListByPrivateLinkScopePager - Lists the network security perimeter configurations for a private link scope. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - NetworkSecurityPerimeterConfigurationsClientListByPrivateLinkScopeOptions contains the optional parameters for @@ -163,7 +163,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) listByPrivateLinkSco return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +181,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) listByPrivateLinkSco // BeginReconcileForPrivateLinkScope - Forces the network security perimeter configuration to refresh for a private link scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - perimeterName - The name, in the format {perimeterGuid}.{associationName}, of the Network Security Perimeter resource. @@ -207,7 +207,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) BeginReconcileForPri // ReconcileForPrivateLinkScope - Forces the network security perimeter configuration to refresh for a private link scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileForPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, perimeterName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileForPrivateLinkScopeOptions) (*http.Response, error) { var err error const operationName = "NetworkSecurityPerimeterConfigurationsClient.BeginReconcileForPrivateLinkScope" @@ -253,7 +253,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileForPrivateL return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client_example_test.go index ae791a558d..fdb787686b 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/networksecurityperimeterconfigurations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationGet.json func ExampleNetworkSecurityPerimeterConfigurationsClient_GetByPrivateLinkScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_GetByPrivateLinkScope() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationList.json func ExampleNetworkSecurityPerimeterConfigurationsClient_NewListByPrivateLinkScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -176,7 +176,7 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_NewListByPrivateLinkSco } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationReconcile.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationReconcile.json func ExampleNetworkSecurityPerimeterConfigurationsClient_BeginReconcileForPrivateLinkScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go index 9aae792ff5..80e300eb23 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of hybrid compute operations. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go index 4502c7edf2..705b2d83bc 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go index d881192fec..f64e118c22 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/options.go @@ -18,6 +18,40 @@ type ExtensionMetadataClientListOptions struct { // placeholder for future optional parameters } +// GatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the GatewaysClient.BeginCreateOrUpdate method. +type GatewaysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GatewaysClientBeginDeleteOptions contains the optional parameters for the GatewaysClient.BeginDelete method. +type GatewaysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GatewaysClientGetOptions contains the optional parameters for the GatewaysClient.Get method. +type GatewaysClientGetOptions struct { + // placeholder for future optional parameters +} + +// GatewaysClientListByResourceGroupOptions contains the optional parameters for the GatewaysClient.NewListByResourceGroupPager +// method. +type GatewaysClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// GatewaysClientListBySubscriptionOptions contains the optional parameters for the GatewaysClient.NewListBySubscriptionPager +// method. +type GatewaysClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// GatewaysClientUpdateOptions contains the optional parameters for the GatewaysClient.Update method. +type GatewaysClientUpdateOptions struct { + // placeholder for future optional parameters +} + // LicenseProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the LicenseProfilesClient.BeginCreateOrUpdate // method. type LicenseProfilesClientBeginCreateOrUpdateOptions struct { @@ -121,6 +155,31 @@ type MachineExtensionsClientListOptions struct { Expand *string } +// MachineRunCommandsClientBeginCreateOrUpdateOptions contains the optional parameters for the MachineRunCommandsClient.BeginCreateOrUpdate +// method. +type MachineRunCommandsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachineRunCommandsClientBeginDeleteOptions contains the optional parameters for the MachineRunCommandsClient.BeginDelete +// method. +type MachineRunCommandsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MachineRunCommandsClientGetOptions contains the optional parameters for the MachineRunCommandsClient.Get method. +type MachineRunCommandsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MachineRunCommandsClientListOptions contains the optional parameters for the MachineRunCommandsClient.NewListPager method. +type MachineRunCommandsClientListOptions 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. @@ -286,3 +345,18 @@ type PrivateLinkScopesClientListOptions struct { type PrivateLinkScopesClientUpdateTagsOptions struct { // placeholder for future optional parameters } + +// SettingsClientGetOptions contains the optional parameters for the SettingsClient.Get method. +type SettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SettingsClientPatchOptions contains the optional parameters for the SettingsClient.Patch method. +type SettingsClientPatchOptions struct { + // placeholder for future optional parameters +} + +// SettingsClientUpdateOptions contains the optional parameters for the SettingsClient.Update method. +type SettingsClientUpdateOptions 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 a5da9fe8ec..72f354b04a 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -72,7 +72,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -118,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -130,7 +130,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -156,7 +156,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -202,7 +202,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -263,7 +263,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByPrivateLinkScopePager @@ -328,7 +328,7 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go index c07ad94b5a..a4726217ea 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateEndpoint/PrivateEndpointConnection_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateEndpoint/PrivateEndpointConnection_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateEndpoint/PrivateEndpointConnection_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateEndpoint/PrivateEndpointConnection_Update.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateEndpoint/PrivateEndpointConnection_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateEndpoint/PrivateEndpointConnection_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +126,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateEndpoint/PrivateEndpointConnection_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateEndpoint/PrivateEndpointConnection_List.json func ExamplePrivateEndpointConnectionsClient_NewListByPrivateLinkScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go index b53e1986fd..7eed1b30f1 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - groupName - The name of the private link resource. @@ -98,7 +98,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByPrivateLinkScopePager - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByPrivateLinkScopePager @@ -163,7 +163,7 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go index a06aea3bce..1bd390f7d6 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go index 1711b4b110..07af4182f5 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // nor AppId in the Put operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - parameters - Properties that need to be specified to create or update a Azure Arc for Servers and Clusters PrivateLinkScope. @@ -95,7 +95,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -116,7 +116,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.R // BeginDelete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete @@ -141,7 +141,7 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateLinkScopesClient.BeginDelete" @@ -183,7 +183,7 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +192,7 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, // Get - Returns a Azure Arc PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. @@ -238,7 +238,7 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,7 +256,7 @@ func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (P // GetValidationDetails - Returns a Azure Arc PrivateLinkScope's validation details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - location - The location of the target resource. // - privateLinkScopeID - The id (Guid) of the Azure Arc PrivateLinkScope resource. // - options - PrivateLinkScopesClientGetValidationDetailsOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetails @@ -303,7 +303,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsHandleResponse(resp * // GetValidationDetailsForMachine - Returns a Azure Arc PrivateLinkScope's validation details for a given machine. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - machineName - The name of the target machine to get the private link scope validation details for. // - options - PrivateLinkScopesClientGetValidationDetailsForMachineOptions contains the optional parameters for the PrivateLinkScopesClient.GetValidationDetailsForMachine @@ -368,7 +368,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,7 @@ func (client *PrivateLinkScopesClient) getValidationDetailsForMachineHandleRespo // NewListPager - Gets a list of all Azure Arc PrivateLinkScopes within a subscription. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager // method. func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { @@ -423,7 +423,7 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +440,7 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Gets a list of Azure Arc PrivateLinkScopes within a resource group. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager // method. @@ -483,7 +483,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -501,7 +501,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *h // UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-10 +// Generated from API version 2024-07-31-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - scopeName - The name of the Azure Arc PrivateLinkScope resource. // - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. @@ -549,7 +549,7 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-10") + reqQP.Set("api-version", "2024-07-31-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go index f531e2b167..26c5a4e1da 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/privatelinkscopes_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_List.json func ExamplePrivateLinkScopesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,7 +89,7 @@ func ExamplePrivateLinkScopesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -177,7 +177,7 @@ func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_Delete.json func ExamplePrivateLinkScopesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -198,7 +198,7 @@ func ExamplePrivateLinkScopesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_Get.json func ExamplePrivateLinkScopesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -248,7 +248,7 @@ func ExamplePrivateLinkScopesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_Create.json func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -300,7 +300,7 @@ func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_Update.json func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -356,7 +356,7 @@ func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_UpdateTagsOnly.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_UpdateTagsOnly.json func ExamplePrivateLinkScopesClient_UpdateTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -413,7 +413,7 @@ func ExamplePrivateLinkScopesClient_UpdateTags() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_GetValidation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidation.json func ExamplePrivateLinkScopesClient_GetValidationDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -445,7 +445,7 @@ func ExamplePrivateLinkScopesClient_GetValidationDetails() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f41d0c9332078cb2ef07b749081d94915255ada5/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/stable/2024-07-10/examples/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json func ExamplePrivateLinkScopesClient_GetValidationDetailsForMachine() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/responses.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/responses.go index 358d36cc94..79d1fc0b39 100644 --- a/sdk/resourcemanager/hybridcompute/armhybridcompute/responses.go +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/responses.go @@ -20,6 +20,41 @@ type ExtensionMetadataClientListResponse struct { ExtensionValueListResult } +// GatewaysClientCreateOrUpdateResponse contains the response from method GatewaysClient.BeginCreateOrUpdate. +type GatewaysClientCreateOrUpdateResponse struct { + // Describes an Arc Gateway. + Gateway +} + +// GatewaysClientDeleteResponse contains the response from method GatewaysClient.BeginDelete. +type GatewaysClientDeleteResponse struct { + // placeholder for future response values +} + +// GatewaysClientGetResponse contains the response from method GatewaysClient.Get. +type GatewaysClientGetResponse struct { + // Describes an Arc Gateway. + Gateway +} + +// GatewaysClientListByResourceGroupResponse contains the response from method GatewaysClient.NewListByResourceGroupPager. +type GatewaysClientListByResourceGroupResponse struct { + // The List license operation response. + GatewaysListResult +} + +// GatewaysClientListBySubscriptionResponse contains the response from method GatewaysClient.NewListBySubscriptionPager. +type GatewaysClientListBySubscriptionResponse struct { + // The List license operation response. + GatewaysListResult +} + +// GatewaysClientUpdateResponse contains the response from method GatewaysClient.Update. +type GatewaysClientUpdateResponse struct { + // Describes an Arc Gateway. + Gateway +} + // LicenseProfilesClientCreateOrUpdateResponse contains the response from method LicenseProfilesClient.BeginCreateOrUpdate. type LicenseProfilesClientCreateOrUpdateResponse struct { // Describes a license profile in a hybrid machine. @@ -119,6 +154,29 @@ type MachineExtensionsClientUpdateResponse struct { MachineExtension } +// MachineRunCommandsClientCreateOrUpdateResponse contains the response from method MachineRunCommandsClient.BeginCreateOrUpdate. +type MachineRunCommandsClientCreateOrUpdateResponse struct { + // Describes a Run Command + MachineRunCommand +} + +// MachineRunCommandsClientDeleteResponse contains the response from method MachineRunCommandsClient.BeginDelete. +type MachineRunCommandsClientDeleteResponse struct { + // placeholder for future response values +} + +// MachineRunCommandsClientGetResponse contains the response from method MachineRunCommandsClient.Get. +type MachineRunCommandsClientGetResponse struct { + // Describes a Run Command + MachineRunCommand +} + +// MachineRunCommandsClientListResponse contains the response from method MachineRunCommandsClient.NewListPager. +type MachineRunCommandsClientListResponse struct { + // Describes the Run Commands List Result. + MachineRunCommandsListResult +} + // MachinesClientAssessPatchesResponse contains the response from method MachinesClient.BeginAssessPatches. type MachinesClientAssessPatchesResponse struct { // Describes the properties of an AssessPatches result. @@ -280,3 +338,18 @@ type PrivateLinkScopesClientUpdateTagsResponse struct { // An Azure Arc PrivateLinkScope definition. PrivateLinkScope } + +// SettingsClientGetResponse contains the response from method SettingsClient.Get. +type SettingsClientGetResponse struct { + Settings +} + +// SettingsClientPatchResponse contains the response from method SettingsClient.Patch. +type SettingsClientPatchResponse struct { + Settings +} + +// SettingsClientUpdateResponse contains the response from method SettingsClient.Update. +type SettingsClientUpdateResponse struct { + Settings +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client.go new file mode 100644 index 0000000000..b066be6955 --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client.go @@ -0,0 +1,289 @@ +//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" +) + +// SettingsClient contains the methods for the Settings group. +// Don't use this type directly, use NewSettingsClient() instead. +type SettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSettingsClient creates a new instance of SettingsClient 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 NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Returns the base Settings for the target resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - baseProvider - The name of the base Resource Provider. +// - baseResourceType - The name of the base Resource Type. +// - baseResourceName - The name of the base resource. +// - settingsResourceName - The name of the settings resource. +// - options - SettingsClientGetOptions contains the optional parameters for the SettingsClient.Get method. +func (client *SettingsClient) Get(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, options *SettingsClientGetOptions) (SettingsClientGetResponse, error) { + var err error + const operationName = "SettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, baseProvider, baseResourceType, baseResourceName, settingsResourceName, options) + if err != nil { + return SettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, options *SettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + 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 baseProvider == "" { + return nil, errors.New("parameter baseProvider cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseProvider}", url.PathEscape(baseProvider)) + if baseResourceType == "" { + return nil, errors.New("parameter baseResourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceType}", url.PathEscape(baseResourceType)) + if baseResourceName == "" { + return nil, errors.New("parameter baseResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceName}", url.PathEscape(baseResourceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + 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", "2024-07-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SettingsClient) getHandleResponse(resp *http.Response) (SettingsClientGetResponse, error) { + result := SettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Settings); err != nil { + return SettingsClientGetResponse{}, err + } + return result, nil +} + +// Patch - Update the base Settings of the target resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - baseProvider - The name of the base Resource Provider. +// - baseResourceType - The name of the base Resource Type. +// - baseResourceName - The name of the base resource. +// - settingsResourceName - The name of the settings resource. +// - parameters - Settings details +// - options - SettingsClientPatchOptions contains the optional parameters for the SettingsClient.Patch method. +func (client *SettingsClient) Patch(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters Settings, options *SettingsClientPatchOptions) (SettingsClientPatchResponse, error) { + var err error + const operationName = "SettingsClient.Patch" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.patchCreateRequest(ctx, resourceGroupName, baseProvider, baseResourceType, baseResourceName, settingsResourceName, parameters, options) + if err != nil { + return SettingsClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SettingsClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SettingsClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *SettingsClient) patchCreateRequest(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters Settings, options *SettingsClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + 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 baseProvider == "" { + return nil, errors.New("parameter baseProvider cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseProvider}", url.PathEscape(baseProvider)) + if baseResourceType == "" { + return nil, errors.New("parameter baseResourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceType}", url.PathEscape(baseResourceType)) + if baseResourceName == "" { + return nil, errors.New("parameter baseResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceName}", url.PathEscape(baseResourceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + 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", "2024-07-31-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 +} + +// patchHandleResponse handles the Patch response. +func (client *SettingsClient) patchHandleResponse(resp *http.Response) (SettingsClientPatchResponse, error) { + result := SettingsClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Settings); err != nil { + return SettingsClientPatchResponse{}, err + } + return result, nil +} + +// Update - Updates the base Settings of the target resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-07-31-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - baseProvider - The name of the base Resource Provider. +// - baseResourceType - The name of the base Resource Type. +// - baseResourceName - The name of the base resource. +// - settingsResourceName - The name of the settings resource. +// - parameters - Settings details +// - options - SettingsClientUpdateOptions contains the optional parameters for the SettingsClient.Update method. +func (client *SettingsClient) Update(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters Settings, options *SettingsClientUpdateOptions) (SettingsClientUpdateResponse, error) { + var err error + const operationName = "SettingsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, baseProvider, baseResourceType, baseResourceName, settingsResourceName, parameters, options) + if err != nil { + return SettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, baseProvider string, baseResourceType string, baseResourceName string, settingsResourceName string, parameters Settings, options *SettingsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + 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 baseProvider == "" { + return nil, errors.New("parameter baseProvider cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseProvider}", url.PathEscape(baseProvider)) + if baseResourceType == "" { + return nil, errors.New("parameter baseResourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceType}", url.PathEscape(baseResourceType)) + if baseResourceName == "" { + return nil, errors.New("parameter baseResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baseResourceName}", url.PathEscape(baseResourceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + 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", "2024-07-31-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 +} + +// updateHandleResponse handles the Update response. +func (client *SettingsClient) updateHandleResponse(resp *http.Response) (SettingsClientUpdateResponse, error) { + result := SettingsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Settings); err != nil { + return SettingsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client_example_test.go b/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client_example_test.go new file mode 100644 index 0000000000..fd115dfcff --- /dev/null +++ b/sdk/resourcemanager/hybridcompute/armhybridcompute/settings_client_example_test.go @@ -0,0 +1,124 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armhybridcompute_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcompute/armhybridcompute/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/settings/SettingsGet.json +func ExampleSettingsClient_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.NewSettingsClient().Get(ctx, "hybridRG", "Microsoft.HybridCompute", "machines", "testMachine", "default", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Settings = armhybridcompute.Settings{ + // Name: to.Ptr("current"), + // Type: to.Ptr("Microsoft.HybridCompute/settings"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridCompute/settings/default"), + // Properties: &armhybridcompute.SettingsProperties{ + // GatewayProperties: &armhybridcompute.SettingsGatewayProperties{ + // GatewayResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/gateways/newGateway"), + // }, + // TenantID: to.Ptr("00000000-1111-2222-5555-444444444444"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/settings/SettingsUpdate.json +func ExampleSettingsClient_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.NewSettingsClient().Update(ctx, "hybridRG", "Microsoft.HybridCompute", "machines", "testMachine", "default", armhybridcompute.Settings{ + Properties: &armhybridcompute.SettingsProperties{ + GatewayProperties: &armhybridcompute.SettingsGatewayProperties{ + GatewayResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/gateways/newGateway"), + }, + }, + }, 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.Settings = armhybridcompute.Settings{ + // Name: to.Ptr("current"), + // Type: to.Ptr("Microsoft.HybridCompute/settings"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridCompute/settings/default"), + // Properties: &armhybridcompute.SettingsProperties{ + // GatewayProperties: &armhybridcompute.SettingsGatewayProperties{ + // GatewayResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/gateways/newGateway"), + // }, + // TenantID: to.Ptr("00000000-1111-2222-5555-444444444444"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/63d530d0def1c624f5d42d39170ff4ac196522e2/specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2024-07-31-preview/examples/settings/SettingsPatch.json +func ExampleSettingsClient_Patch() { + 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.NewSettingsClient().Patch(ctx, "hybridRG", "Microsoft.HybridCompute", "machines", "testMachine", "default", armhybridcompute.Settings{ + Properties: &armhybridcompute.SettingsProperties{ + GatewayProperties: &armhybridcompute.SettingsGatewayProperties{ + GatewayResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/gateways/newGateway"), + }, + }, + }, 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.Settings = armhybridcompute.Settings{ + // Name: to.Ptr("current"), + // Type: to.Ptr("Microsoft.HybridCompute/settings"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridCompute/settings/default"), + // Properties: &armhybridcompute.SettingsProperties{ + // GatewayProperties: &armhybridcompute.SettingsGatewayProperties{ + // GatewayResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/gateways/newGateway"), + // }, + // TenantID: to.Ptr("00000000-1111-2222-5555-444444444444"), + // }, + // } +}