From 0f3b96f3b9a51cbdcd3c4f58b4ee4b54775f5725 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 6 Sep 2023 16:23:02 +0000 Subject: [PATCH] CodeGen from PR 25044 in Azure/azure-rest-api-specs Merge 62471ade2f05e0ee0eca3179aed468174f0116d7 into eb29c07a0f08110c932b384d5dc41241dc0b03ab --- .../armbaremetalinfrastructure/CHANGELOG.md | 52 ++ .../armbaremetalinfrastructure/autorest.md | 6 +- .../azurebaremetalinstances_client.go | 283 +++++++++-- ...ebaremetalinstances_client_example_test.go | 445 ------------------ .../azurebaremetalstorageinstances_client.go | 396 ++++++++++++++++ .../client_factory.go | 10 +- .../armbaremetalinfrastructure/constants.go | 108 ++++- .../armbaremetalinfrastructure/go.mod | 22 +- .../armbaremetalinfrastructure/go.sum | 38 +- .../armbaremetalinfrastructure/models.go | 378 +++++++++------ .../models_serde.go | 427 +++++++++++++++-- .../operations_client.go | 9 +- .../operations_client_example_test.go | 66 --- .../armbaremetalinfrastructure/options.go | 98 ++++ .../response_types.go | 63 ++- .../time_rfc3339.go | 3 +- 16 files changed, 1609 insertions(+), 795 deletions(-) delete mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go create mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go delete mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go create mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md index 468d264e08f2..2b054bc98b8a 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md @@ -1,5 +1,57 @@ # Release History +## 2.0.0-beta.1 (2023-09-06) +### Breaking Changes + +- Type of `ErrorResponse.Error` has been changed from `*ErrorDefinition` to `*ErrorDetail` +- Type of `NetworkProfile.NetworkInterfaces` has been changed from `[]*IPAddress` to `[]*NetworkInterface` +- Type of `Operation.Display` has been changed from `*Display` to `*OperationDisplay` +- Struct `Display` has been removed +- Struct `ErrorDefinition` has been removed +- Struct `IPAddress` has been removed +- Struct `OperationList` has been removed +- Struct `Result` has been removed +- Field `OperationList` of struct `OperationsClientListResponse` has been removed + +### Features Added + +- New value `AzureBareMetalHardwareTypeNamesEnumSDFLEX` added to enum type `AzureBareMetalHardwareTypeNamesEnum` +- New value `AzureBareMetalInstanceSizeNamesEnumS448Se` added to enum type `AzureBareMetalInstanceSizeNamesEnum` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `AsyncOperationStatus` with values `AsyncOperationStatusExecuting`, `AsyncOperationStatusFailed`, `AsyncOperationStatusRequesting`, `AsyncOperationStatusSucceeded` +- New enum type `AzureBareMetalInstanceForcePowerState` with values `AzureBareMetalInstanceForcePowerStateActive`, `AzureBareMetalInstanceForcePowerStateInactive` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `ProvisioningState` with values `ProvisioningStateAccepted`, `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateMigrating`, `ProvisioningStateSucceeded`, `ProvisioningStateUpdating` +- New function `*AzureBareMetalInstancesClient.BeginRestart(context.Context, string, string, *AzureBareMetalInstancesClientBeginRestartOptions) (*runtime.Poller[AzureBareMetalInstancesClientRestartResponse], error)` +- New function `*AzureBareMetalInstancesClient.BeginShutdown(context.Context, string, string, *AzureBareMetalInstancesClientBeginShutdownOptions) (*runtime.Poller[AzureBareMetalInstancesClientShutdownResponse], error)` +- New function `*AzureBareMetalInstancesClient.BeginStart(context.Context, string, string, *AzureBareMetalInstancesClientBeginStartOptions) (*runtime.Poller[AzureBareMetalInstancesClientStartResponse], error)` +- New function `NewAzureBareMetalStorageInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AzureBareMetalStorageInstancesClient, error)` +- New function `*AzureBareMetalStorageInstancesClient.Create(context.Context, string, string, AzureBareMetalStorageInstance, *AzureBareMetalStorageInstancesClientCreateOptions) (AzureBareMetalStorageInstancesClientCreateResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.Delete(context.Context, string, string, *AzureBareMetalStorageInstancesClientDeleteOptions) (AzureBareMetalStorageInstancesClientDeleteResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.Get(context.Context, string, string, *AzureBareMetalStorageInstancesClientGetOptions) (AzureBareMetalStorageInstancesClientGetResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager(string, *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListByResourceGroupResponse]` +- New function `*AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager(*AzureBareMetalStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListBySubscriptionResponse]` +- New function `*AzureBareMetalStorageInstancesClient.Update(context.Context, string, string, Tags, *AzureBareMetalStorageInstancesClientUpdateOptions) (AzureBareMetalStorageInstancesClientUpdateResponse, error)` +- New function `*ClientFactory.NewAzureBareMetalStorageInstancesClient() *AzureBareMetalStorageInstancesClient` +- New struct `AzureBareMetalStorageInstance` +- New struct `AzureBareMetalStorageInstanceProperties` +- New struct `AzureBareMetalStorageInstancesListResult` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ForceState` +- New struct `NetworkInterface` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `OperationStatus` +- New struct `OperationStatusError` +- New struct `StorageBillingProperties` +- New struct `StorageProperties` +- New field `ActionType`, `Origin` in struct `Operation` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 1.1.0 (2023-03-27) ### Features Added diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md index 8732811c28b3..b5ee5c472fd6 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go index 4cdcdd7fca34..235f411b65b2 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure @@ -29,7 +28,7 @@ type AzureBareMetalInstancesClient struct { } // NewAzureBareMetalInstancesClient creates a new instance of AzureBareMetalInstancesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAzureBareMetalInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureBareMetalInstancesClient, error) { @@ -44,35 +43,35 @@ func NewAzureBareMetalInstancesClient(subscriptionID string, credential azcore.T return client, nil } -// Get - Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. +// Get - Gets an Azure Bare Metal Instance for the specified subscription, resource group, and instance name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-08-04-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureBareMetalInstanceName - Name of the Azure BareMetal on Azure instance. +// - azureBareMetalInstanceName - Name of the Azure Bare Metal Instance, also known as the ResourceName. // - options - AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get // method. func (client *AzureBareMetalInstancesClient) Get(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientGetOptions) (AzureBareMetalInstancesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, options) if err != nil { return AzureBareMetalInstancesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AzureBareMetalInstancesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AzureBareMetalInstancesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalInstancesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}" - 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") @@ -87,7 +86,7 @@ func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-08-04-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -102,10 +101,10 @@ func (client *AzureBareMetalInstancesClient) getHandleResponse(resp *http.Respon return result, nil } -// NewListByResourceGroupPager - Gets a list of AzureBareMetal instances in the specified subscription and resource group. -// The operations returns various properties of each Azure BareMetal instance. +// NewListByResourceGroupPager - Gets a list of Azure Bare Metal Instances in the specified subscription and resource group. +// The operations returns various properties of each Azure Bare Metal Instance. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-08-04-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureBareMetalInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListByResourceGroupPager // method. @@ -140,9 +139,6 @@ func (client *AzureBareMetalInstancesClient) NewListByResourceGroupPager(resourc // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureBareMetalInstancesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances" - 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") @@ -153,7 +149,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-08-04-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,10 +164,10 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupHandleResponse(r return result, nil } -// NewListBySubscriptionPager - Gets a list of AzureBareMetal instances in the specified subscription. The operations returns -// various properties of each Azure BareMetal instance. +// NewListBySubscriptionPager - Returns a list of Azure Bare Metal Instances in the specified subscription. The operations +// returns various properties of each Azure Bare Metal Instance. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-08-04-preview // - options - AzureBareMetalInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListBySubscriptionPager // method. func (client *AzureBareMetalInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalInstancesClientListBySubscriptionResponse] { @@ -205,16 +201,13 @@ func (client *AzureBareMetalInstancesClient) NewListBySubscriptionPager(options // listBySubscriptionCreateRequest creates the ListBySubscription request. func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureBareMetalInstancesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances" - 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", "2021-08-09") + reqQP.Set("api-version", "2023-08-04-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,37 +222,244 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionHandleResponse(re return result, nil } -// Update - Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance +// BeginRestart - The operation to restart an Azure Bare Metal Instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalInstanceName - Name of the Azure Bare Metal Instance, also known as the ResourceName. +// - options - AzureBareMetalInstancesClientBeginRestartOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginRestart +// method. +func (client *AzureBareMetalInstancesClient) BeginRestart(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginRestartOptions) (*runtime.Poller[AzureBareMetalInstancesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureBareMetalInstancesClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureBareMetalInstancesClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Restart - The operation to restart an Azure Bare Metal Instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +func (client *AzureBareMetalInstancesClient) restart(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginRestartOptions) (*http.Response, error) { + var err error + req, err := client.restartCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *AzureBareMetalInstancesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}/restart" + 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 azureBareMetalInstanceName == "" { + return nil, errors.New("parameter azureBareMetalInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalInstanceName}", url.PathEscape(azureBareMetalInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ForceParameter != nil { + if err := runtime.MarshalAsJSON(req, *options.ForceParameter); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// BeginShutdown - The operation to shutdown an Azure Bare Metal Instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalInstanceName - Name of the Azure Bare Metal Instance, also known as the ResourceName. +// - options - AzureBareMetalInstancesClientBeginShutdownOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginShutdown +// method. +func (client *AzureBareMetalInstancesClient) BeginShutdown(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginShutdownOptions) (*runtime.Poller[AzureBareMetalInstancesClientShutdownResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.shutdown(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureBareMetalInstancesClientShutdownResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureBareMetalInstancesClientShutdownResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Shutdown - The operation to shutdown an Azure Bare Metal Instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +func (client *AzureBareMetalInstancesClient) shutdown(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginShutdownOptions) (*http.Response, error) { + var err error + req, err := client.shutdownCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// shutdownCreateRequest creates the Shutdown request. +func (client *AzureBareMetalInstancesClient) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginShutdownOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}/shutdown" + 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 azureBareMetalInstanceName == "" { + return nil, errors.New("parameter azureBareMetalInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalInstanceName}", url.PathEscape(azureBareMetalInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - The operation to start an Azure Bare Metal instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalInstanceName - Name of the Azure Bare Metal Instance, also known as the ResourceName. +// - options - AzureBareMetalInstancesClientBeginStartOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginStart +// method. +func (client *AzureBareMetalInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginStartOptions) (*runtime.Poller[AzureBareMetalInstancesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureBareMetalInstancesClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AzureBareMetalInstancesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - The operation to start an Azure Bare Metal instance +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +func (client *AzureBareMetalInstancesClient) start(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *AzureBareMetalInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}/start" + 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 azureBareMetalInstanceName == "" { + return nil, errors.New("parameter azureBareMetalInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalInstanceName}", url.PathEscape(azureBareMetalInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Patches the Tags field of a Azure Bare Metal Instance for the specified subscription, resource group, and instance // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-08-04-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureBareMetalInstanceName - Name of the Azure BareMetal on Azure instance. +// - azureBareMetalInstanceName - Name of the Azure Bare Metal Instance, also known as the ResourceName. // - tagsParameter - Request body that only contains the new Tags field // - options - AzureBareMetalInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalInstancesClient.Update // method. func (client *AzureBareMetalInstancesClient) Update(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags, options *AzureBareMetalInstancesClientUpdateOptions) (AzureBareMetalInstancesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, tagsParameter, options) if err != nil { return AzureBareMetalInstancesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AzureBareMetalInstancesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AzureBareMetalInstancesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalInstancesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags, options *AzureBareMetalInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}" - 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") @@ -274,10 +474,13 @@ func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-08-04-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, tagsParameter) + if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go deleted file mode 100644 index 4d6a85f83858..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go +++ /dev/null @@ -1,445 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armbaremetalinfrastructure_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/baremetalinfrastructure/armbaremetalinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_ListBySubscription.json -func ExampleAzureBareMetalInstancesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureBareMetalInstancesClient().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.AzureBareMetalInstancesListResult = armbaremetalinfrastructure.AzureBareMetalInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalInstance{ - // { - // Name: to.Ptr("myAzureBareMetalInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance1"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myAzureBareMetalInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance2"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_ListByResourceGroup.json -func ExampleAzureBareMetalInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureBareMetalInstancesClient().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.AzureBareMetalInstancesListResult = armbaremetalinfrastructure.AzureBareMetalInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalInstance{ - // { - // Name: to.Ptr("myAzureBareMetalInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/azureBareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myAzureBareMetalInstance1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName1"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myABMInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/azureBareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myABMInstance2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS384), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumHPE), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.101"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myAzureBareMetalInstance1"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.201"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_Get.json -func ExampleAzureBareMetalInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Get(ctx, "myResourceGroup", "myAzureBareMetalInstance", 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.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myAzureBareMetalInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_PatchTags_Delete.json -func ExampleAzureBareMetalInstancesClient_Update_deleteTagsFieldOfAnAzureBareMetalInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Update(ctx, "myResourceGroup", "myABMInstance", armbaremetalinfrastructure.Tags{ - Tags: map[string]*string{}, - }, 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.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myABMInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance2"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_PatchTags.json -func ExampleAzureBareMetalInstancesClient_Update_updateTagsFieldOfAnAzureBareMetalInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Update(ctx, "myResourceGroup", "myABMInstance", armbaremetalinfrastructure.Tags{ - Tags: map[string]*string{ - "testkey": to.Ptr("testvalue"), - }, - }, 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.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myABMInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance2"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go new file mode 100644 index 000000000000..642132cdd94b --- /dev/null +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go @@ -0,0 +1,396 @@ +//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 armbaremetalinfrastructure + +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" +) + +// AzureBareMetalStorageInstancesClient contains the methods for the AzureBareMetalStorageInstances group. +// Don't use this type directly, use NewAzureBareMetalStorageInstancesClient() instead. +type AzureBareMetalStorageInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAzureBareMetalStorageInstancesClient creates a new instance of AzureBareMetalStorageInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAzureBareMetalStorageInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureBareMetalStorageInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AzureBareMetalStorageInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureBareMetalStorageInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create an azure bare metal storage resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the Azure Bare Metal Storage Instance, also known as the ResourceName. +// - requestBodyParameters - request body for put call +// - options - AzureBareMetalStorageInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Create +// method. +func (client *AzureBareMetalStorageInstancesClient) Create(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, options *AzureBareMetalStorageInstancesClientCreateOptions) (AzureBareMetalStorageInstancesClientCreateResponse, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, requestBodyParameters, options) + if err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *AzureBareMetalStorageInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, options *AzureBareMetalStorageInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *AzureBareMetalStorageInstancesClient) createHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientCreateResponse, error) { + result := AzureBareMetalStorageInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete an AzureBareMetalStorageInstance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the Azure Bare Metal Storage Instance, also known as the ResourceName. +// - options - AzureBareMetalStorageInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Delete +// method. +func (client *AzureBareMetalStorageInstancesClient) Delete(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientDeleteOptions) (AzureBareMetalStorageInstancesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, options) + if err != nil { + return AzureBareMetalStorageInstancesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalStorageInstancesClientDeleteResponse{}, err + } + return AzureBareMetalStorageInstancesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets an Azure Bare Metal Storage instance for the specified subscription, resource group, and instance name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the Azure Bare Metal Storage Instance, also known as the ResourceName. +// - options - AzureBareMetalStorageInstancesClientGetOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Get +// method. +func (client *AzureBareMetalStorageInstancesClient) Get(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientGetOptions) (AzureBareMetalStorageInstancesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, options) + if err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AzureBareMetalStorageInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureBareMetalStorageInstancesClient) getHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientGetResponse, error) { + result := AzureBareMetalStorageInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of AzureBareMetalStorage instances in the specified subscription and resource +// group. The operations returns various properties of each Azure Bare Metal Instance. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AzureBareMetalStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager +// method. +func (client *AzureBareMetalStorageInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureBareMetalStorageInstancesClientListByResourceGroupResponse]{ + More: func(page AzureBareMetalStorageInstancesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureBareMetalStorageInstancesClientListByResourceGroupResponse) (AzureBareMetalStorageInstancesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientListByResourceGroupResponse, error) { + result := AzureBareMetalStorageInstancesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstancesListResult); err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets a list of AzureBareMetalStorage instances in the specified subscription. The operations +// returns various properties of each Azure Bare Metal Instance. +// +// Generated from API version 2023-08-04-preview +// - options - AzureBareMetalStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager +// method. +func (client *AzureBareMetalStorageInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureBareMetalStorageInstancesClientListBySubscriptionResponse]{ + More: func(page AzureBareMetalStorageInstancesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureBareMetalStorageInstancesClientListBySubscriptionResponse) (AzureBareMetalStorageInstancesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientListBySubscriptionResponse, error) { + result := AzureBareMetalStorageInstancesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstancesListResult); err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches the Tags field of a Azure Bare Metal Storage instance for the specified subscription, resource group, +// and instance name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-04-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the Azure Bare Metal Storage Instance, also known as the ResourceName. +// - tagsParameter - Request body that only contains the new Tags field +// - options - AzureBareMetalStorageInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Update +// method. +func (client *AzureBareMetalStorageInstancesClient) Update(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter Tags, options *AzureBareMetalStorageInstancesClientUpdateOptions) (AzureBareMetalStorageInstancesClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, tagsParameter, options) + if err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AzureBareMetalStorageInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter Tags, options *AzureBareMetalStorageInstancesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-04-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AzureBareMetalStorageInstancesClient) updateHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientUpdateResponse, error) { + result := AzureBareMetalStorageInstancesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go index 0d02dad2c9f4..e98add4ca09d 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure @@ -24,7 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -43,6 +42,11 @@ func (c *ClientFactory) NewAzureBareMetalInstancesClient() *AzureBareMetalInstan return subClient } +func (c *ClientFactory) NewAzureBareMetalStorageInstancesClient() *AzureBareMetalStorageInstancesClient { + subClient, _ := NewAzureBareMetalStorageInstancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go index fc86451e6130..3024226f9dac 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go @@ -3,23 +3,57 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure const ( moduleName = "armbaremetalinfrastructure" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0-beta.1" ) +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AsyncOperationStatus - Status of the operation. +type AsyncOperationStatus string + +const ( + AsyncOperationStatusExecuting AsyncOperationStatus = "Executing" + AsyncOperationStatusFailed AsyncOperationStatus = "Failed" + AsyncOperationStatusRequesting AsyncOperationStatus = "Requesting" + AsyncOperationStatusSucceeded AsyncOperationStatus = "Succeeded" +) + +// PossibleAsyncOperationStatusValues returns the possible values for the AsyncOperationStatus const type. +func PossibleAsyncOperationStatusValues() []AsyncOperationStatus { + return []AsyncOperationStatus{ + AsyncOperationStatusExecuting, + AsyncOperationStatusFailed, + AsyncOperationStatusRequesting, + AsyncOperationStatusSucceeded, + } +} + // AzureBareMetalHardwareTypeNamesEnum - Name of the hardware type (vendor and/or their product name) type AzureBareMetalHardwareTypeNamesEnum string const ( AzureBareMetalHardwareTypeNamesEnumCiscoUCS AzureBareMetalHardwareTypeNamesEnum = "Cisco_UCS" AzureBareMetalHardwareTypeNamesEnumHPE AzureBareMetalHardwareTypeNamesEnum = "HPE" + AzureBareMetalHardwareTypeNamesEnumSDFLEX AzureBareMetalHardwareTypeNamesEnum = "SDFLEX" ) // PossibleAzureBareMetalHardwareTypeNamesEnumValues returns the possible values for the AzureBareMetalHardwareTypeNamesEnum const type. @@ -27,6 +61,23 @@ func PossibleAzureBareMetalHardwareTypeNamesEnumValues() []AzureBareMetalHardwar return []AzureBareMetalHardwareTypeNamesEnum{ AzureBareMetalHardwareTypeNamesEnumCiscoUCS, AzureBareMetalHardwareTypeNamesEnumHPE, + AzureBareMetalHardwareTypeNamesEnumSDFLEX, + } +} + +// AzureBareMetalInstanceForcePowerState - Whether to force restart by shutting all processes. +type AzureBareMetalInstanceForcePowerState string + +const ( + AzureBareMetalInstanceForcePowerStateActive AzureBareMetalInstanceForcePowerState = "active" + AzureBareMetalInstanceForcePowerStateInactive AzureBareMetalInstanceForcePowerState = "inactive" +) + +// PossibleAzureBareMetalInstanceForcePowerStateValues returns the possible values for the AzureBareMetalInstanceForcePowerState const type. +func PossibleAzureBareMetalInstanceForcePowerStateValues() []AzureBareMetalInstanceForcePowerState { + return []AzureBareMetalInstanceForcePowerState{ + AzureBareMetalInstanceForcePowerStateActive, + AzureBareMetalInstanceForcePowerStateInactive, } } @@ -54,7 +105,7 @@ func PossibleAzureBareMetalInstancePowerStateEnumValues() []AzureBareMetalInstan } } -// AzureBareMetalInstanceSizeNamesEnum - Specifies the AzureBareMetal instance SKU. +// AzureBareMetalInstanceSizeNamesEnum - Specifies the Azure Bare Metal Instance SKU. type AzureBareMetalInstanceSizeNamesEnum string const ( @@ -80,6 +131,7 @@ const ( AzureBareMetalInstanceSizeNamesEnumS448Oo AzureBareMetalInstanceSizeNamesEnum = "S448oo" AzureBareMetalInstanceSizeNamesEnumS448Oom AzureBareMetalInstanceSizeNamesEnum = "S448oom" AzureBareMetalInstanceSizeNamesEnumS448Ooo AzureBareMetalInstanceSizeNamesEnum = "S448ooo" + AzureBareMetalInstanceSizeNamesEnumS448Se AzureBareMetalInstanceSizeNamesEnum = "S448se" AzureBareMetalInstanceSizeNamesEnumS576M AzureBareMetalInstanceSizeNamesEnum = "S576m" AzureBareMetalInstanceSizeNamesEnumS576Xm AzureBareMetalInstanceSizeNamesEnum = "S576xm" AzureBareMetalInstanceSizeNamesEnumS672 AzureBareMetalInstanceSizeNamesEnum = "S672" @@ -128,6 +180,7 @@ func PossibleAzureBareMetalInstanceSizeNamesEnumValues() []AzureBareMetalInstanc AzureBareMetalInstanceSizeNamesEnumS448Oo, AzureBareMetalInstanceSizeNamesEnumS448Oom, AzureBareMetalInstanceSizeNamesEnumS448Ooo, + AzureBareMetalInstanceSizeNamesEnumS448Se, AzureBareMetalInstanceSizeNamesEnumS576M, AzureBareMetalInstanceSizeNamesEnumS576Xm, AzureBareMetalInstanceSizeNamesEnumS672, @@ -197,3 +250,50 @@ func PossibleCreatedByTypeValues() []CreatedByType { CreatedByTypeUser, } } + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - State of provisioning of the AzureBareMetalStorageInstance +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMigrating ProvisioningState = "Migrating" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMigrating, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod index 7ec243fdc76f..c224edb3fef4 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go index e6a16beaf868..29351fb22080 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure @@ -14,270 +13,379 @@ import "time" // AzureBareMetalInstance - AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) type AzureBareMetalInstance struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // AzureBareMetal instance properties - Properties *AzureBareMetalInstanceProperties `json:"properties,omitempty"` + Properties *AzureBareMetalInstanceProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + Name *string - // READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // 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 `json:"type,omitempty" azure:"ro"` + Type *string } -// AzureBareMetalInstanceProperties - Describes the properties of an AzureBareMetal instance. +// AzureBareMetalInstanceProperties - Describes the properties of an Azure Bare Metal Instance. type AzureBareMetalInstanceProperties struct { - // Specifies the hardware settings for the AzureBareMetal instance. - HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // Specifies the hardware settings for the Azure Bare Metal Instance. + HardwareProfile *HardwareProfile - // Specifies the network settings for the AzureBareMetal instance. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // Specifies the network settings for the Azure Bare Metal Instance. + NetworkProfile *NetworkProfile - // Specifies the operating system settings for the AzureBareMetal instance. - OSProfile *OSProfile `json:"osProfile,omitempty"` + // Specifies the operating system settings for the Azure Bare Metal Instance. + OSProfile *OSProfile // ARM ID of another AzureBareMetalInstance that will share a network with this AzureBareMetalInstance - PartnerNodeID *string `json:"partnerNodeId,omitempty"` + PartnerNodeID *string - // Specifies the storage settings for the AzureBareMetal instance disks. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // Specifies the storage settings for the Azure Bare Metal Instance disks. + StorageProfile *StorageProfile - // READ-ONLY; Specifies the AzureBareMetal instance unique ID. - AzureBareMetalInstanceID *string `json:"azureBareMetalInstanceId,omitempty" azure:"ro"` + // READ-ONLY; Specifies the Azure Bare Metal Instance unique ID. + AzureBareMetalInstanceID *string - // READ-ONLY; Hardware revision of an AzureBareMetal instance - HwRevision *string `json:"hwRevision,omitempty" azure:"ro"` + // READ-ONLY; Hardware revision of an Azure Bare Metal Instance + HwRevision *string // READ-ONLY; Resource power state - PowerState *AzureBareMetalInstancePowerStateEnum `json:"powerState,omitempty" azure:"ro"` + PowerState *AzureBareMetalInstancePowerStateEnum // READ-ONLY; State of provisioning of the AzureBareMetalInstance - ProvisioningState *AzureBareMetalProvisioningStatesEnum `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *AzureBareMetalProvisioningStatesEnum // READ-ONLY; Resource proximity placement group - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty" azure:"ro"` + ProximityPlacementGroup *string } -// AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get method. -type AzureBareMetalInstancesClientGetOptions struct { - // placeholder for future optional parameters -} +// AzureBareMetalInstancesListResult - The response from the List Azure Bare Metal Instances operation. +type AzureBareMetalInstancesListResult struct { + // The URL to get the next set of Azure Bare Metal Instances. + NextLink *string -// AzureBareMetalInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListByResourceGroupPager -// method. -type AzureBareMetalInstancesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters + // The list of Azure Bare Metal Instances. + Value []*AzureBareMetalInstance } -// AzureBareMetalInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListBySubscriptionPager -// method. -type AzureBareMetalInstancesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters +// AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) +type AzureBareMetalStorageInstance struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // AzureBareMetalStorageInstance properties + Properties *AzureBareMetalStorageInstanceProperties + + // 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 } -// AzureBareMetalInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalInstancesClient.Update -// method. -type AzureBareMetalInstancesClientUpdateOptions struct { - // placeholder for future optional parameters +// AzureBareMetalStorageInstanceProperties - Describes the properties of an AzureBareMetalStorageInstance. +type AzureBareMetalStorageInstanceProperties struct { + // Specifies the AzureBareMetaStorageInstance unique ID. + AzureBareMetalStorageInstanceUniqueIdentifier *string + + // Specifies the storage properties for the AzureBareMetalStorage instance. + StorageProperties *StorageProperties } -// AzureBareMetalInstancesListResult - The response from the List AzureBareMetal Instances operation. -type AzureBareMetalInstancesListResult struct { - // The URL to get the next set of AzureBareMetal instances. - NextLink *string `json:"nextLink,omitempty"` +// AzureBareMetalStorageInstancesListResult - The response from the Get AzureBareMetalStorageInstances operation. +type AzureBareMetalStorageInstancesListResult struct { + // The URL to get the next set of AzureBareMetalStorage instances. + NextLink *string - // The list of Azure BareMetal instances. - Value []*AzureBareMetalInstance `json:"value,omitempty"` + // The list of AzureBareMetalStorage instances. + Value []*AzureBareMetalStorageInstance } -// Disk - Specifies the disk information fo the AzureBareMetal instance +// Disk - Specifies the disk information fo the Azure Bare Metal Instance type Disk struct { // Specifies the size of an empty data disk in gigabytes. - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + DiskSizeGB *int32 // The disk name. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM // and therefore must be unique for each data disk attached to a VM. - Lun *int32 `json:"lun,omitempty" azure:"ro"` + Lun *int32 } -// Display - Detailed BareMetal operation information -type Display struct { - // READ-ONLY; The localized friendly description for the operation as shown to the user. - Description *string `json:"description,omitempty" azure:"ro"` +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // READ-ONLY; The localized friendly name for the operation as shown to the user. - Operation *string `json:"operation,omitempty" azure:"ro"` + // READ-ONLY; The additional info type. + Type *string +} - // READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty" azure:"ro"` +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty" azure:"ro"` -} + // READ-ONLY; The error code. + Code *string -// ErrorDefinition - Error definition. -type ErrorDefinition struct { - // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty" azure:"ro"` + // READ-ONLY; The error details. + Details []*ErrorDetail - // READ-ONLY; Internal error details. - Details []*ErrorDefinition `json:"details,omitempty" azure:"ro"` + // READ-ONLY; The error message. + Message *string - // READ-ONLY; Description of the error. - Message *string `json:"message,omitempty" azure:"ro"` + // READ-ONLY; The error target. + Target *string } -// ErrorResponse - Error response. +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). type ErrorResponse struct { - // The error details. - Error *ErrorDefinition `json:"error,omitempty"` + // The error object. + Error *ErrorDetail } -// HardwareProfile - Specifies the hardware settings for the AzureBareMetal instance. +// ForceState - The active state empowers the server with the ability to forcefully terminate and halt any existing processes +// that may be running on the server +type ForceState struct { + // Whether to force restart by shutting all processes. + ForceState *AzureBareMetalInstanceForcePowerState +} + +// HardwareProfile - Specifies the hardware settings for the Azure Bare Metal Instance. type HardwareProfile struct { - // READ-ONLY; Specifies the AzureBareMetal instance SKU. - AzureBareMetalInstanceSize *AzureBareMetalInstanceSizeNamesEnum `json:"azureBareMetalInstanceSize,omitempty" azure:"ro"` + // READ-ONLY; Specifies the Azure Bare Metal Instance SKU. + AzureBareMetalInstanceSize *AzureBareMetalInstanceSizeNamesEnum // READ-ONLY; Name of the hardware type (vendor and/or their product name) - HardwareType *AzureBareMetalHardwareTypeNamesEnum `json:"hardwareType,omitempty" azure:"ro"` + HardwareType *AzureBareMetalHardwareTypeNamesEnum } -// IPAddress - Specifies the IP address of the network interface. -type IPAddress struct { +// NetworkInterface - Specifies the network interfaces of a bare metal resource. +type NetworkInterface struct { // Specifies the IP address of the network interface. - IPAddress *string `json:"ipAddress,omitempty"` + IPAddress *string } -// NetworkProfile - Specifies the network settings for the AzureBareMetal instance disks. +// NetworkProfile - Specifies the network settings for the Azure Bare Metal Instance disks. type NetworkProfile struct { - // Specifies the network interfaces for the AzureBareMetal instance. - NetworkInterfaces []*IPAddress `json:"networkInterfaces,omitempty"` + // Specifies the network interfaces for the Azure Bare Metal Instance. + NetworkInterfaces []*NetworkInterface // READ-ONLY; Specifies the circuit id for connecting to express route. - CircuitID *string `json:"circuitId,omitempty" azure:"ro"` + CircuitID *string } -// OSProfile - Specifies the operating system settings for the AzureBareMetal instance. +// OSProfile - Specifies the operating system settings for the Azure Bare Metal instance. type OSProfile struct { - // Specifies the host OS name of the AzureBareMetal instance. - ComputerName *string `json:"computerName,omitempty"` + // Specifies the host OS name of the Azure Bare Metal instance. + ComputerName *string // Specifies the SSH public key used to access the operating system. - SSHPublicKey *string `json:"sshPublicKey,omitempty"` + SSHPublicKey *string // READ-ONLY; This property allows you to specify the type of the OS. - OSType *string `json:"osType,omitempty" azure:"ro"` + OSType *string // READ-ONLY; Specifies version of operating system. - Version *string `json:"version,omitempty" azure:"ro"` + Version *string } -// Operation - AzureBareMetal operation information +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Displayed AzureBareMetal operation information - Display *Display `json:"display,omitempty"` + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool - // READ-ONLY; indicates whether an operation is a data action or not. - IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"` + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string - // READ-ONLY; The name of the operation being performed on this particular object. This name should match the action name - // that appears in RBAC / the event service. - Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin } -// OperationList - List of AzureBareMetal operations -type OperationList struct { - // List of AzureBareMetal operations - Value []*Operation `json:"value,omitempty"` +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OperationStatus - The OperationStatus object returns the state of an asynchronous operation. +type OperationStatus struct { + // An error from the Azure Bare Metal Infrastructure service. + Error *OperationStatusError + + // Unique Operation Status Identifier. + Name *string + + // Start Time when the operation was initially executed. + StartTime *string + + // Status of the operation. + Status *AsyncOperationStatus +} + +// OperationStatusError - An error from the Azure Bare Metal Infrastructure service. +type OperationStatusError struct { + // Server-defined set of error codes. + Code *string + + // Human-readable representation of the error. + Message *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // 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 `json:"name,omitempty" azure:"ro"` + 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 `json:"type,omitempty" azure:"ro"` + Type *string } -// Result - Sample result definition -type Result struct { - // Sample property of type string - SampleProperty *string `json:"sampleProperty,omitempty"` +// StorageBillingProperties - Describes the billing related details of the AzureBareMetalStorageInstance. +type StorageBillingProperties struct { + // the SKU type that is provisioned + AzureBareMetalStorageInstanceSize *string + + // the billing mode for the storage instance + BillingMode *string } -// StorageProfile - Specifies the storage settings for the AzureBareMetal instance disks. +// StorageProfile - Specifies the storage settings for the Azure Bare Metal instance disks. type StorageProfile struct { - // Specifies information about the operating system disk used by baremetal instance. - OSDisks []*Disk `json:"osDisks,omitempty"` + // Specifies information about the operating system disk used by bare metal instance. + OSDisks []*Disk // READ-ONLY; IP Address to connect to storage. - NfsIPAddress *string `json:"nfsIpAddress,omitempty" azure:"ro"` + NfsIPAddress *string +} + +// StorageProperties - described the storage properties of the azure bare metal storage instance +type StorageProperties struct { + // the kind of storage instance + Generation *string + + // the hardware type of the storage instance + HardwareType *string + + // the offering type for which the resource is getting provisioned + OfferingType *string + + // State of provisioning of the AzureBareMetalStorageInstance + ProvisioningState *ProvisioningState + + // the billing related information for the resource + StorageBillingProperties *StorageBillingProperties + + // the storage protocol for which the resource is getting provisioned + StorageType *string + + // the workload for which the resource is getting provisioned + WorkloadType *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *CreatedByType } -// Tags field of the AzureBareMetal instance. +// Tags field of the AzureBareMetal/AzureBareMetaStorage instance. type Tags struct { - // Tags field of the AzureBareMetal instance. - Tags map[string]*string `json:"tags,omitempty"` + // Tags field of the AzureBareMetal/AzureBareMetaStorage instance. + Tags map[string]*string } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; 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 `json:"name,omitempty" azure:"ro"` + 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 `json:"type,omitempty" azure:"ro"` + Type *string } diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go index ca0429d4a405..136b3e2f291c 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure @@ -161,6 +160,119 @@ func (a *AzureBareMetalInstancesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstance. +func (a AzureBareMetalStorageInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstance. +func (a *AzureBareMetalStorageInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstanceProperties. +func (a AzureBareMetalStorageInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureBareMetalStorageInstanceUniqueIdentifier", a.AzureBareMetalStorageInstanceUniqueIdentifier) + populate(objectMap, "storageProperties", a.StorageProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceProperties. +func (a *AzureBareMetalStorageInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureBareMetalStorageInstanceUniqueIdentifier": + err = unpopulate(val, "AzureBareMetalStorageInstanceUniqueIdentifier", &a.AzureBareMetalStorageInstanceUniqueIdentifier) + delete(rawMsg, key) + case "storageProperties": + err = unpopulate(val, "StorageProperties", &a.StorageProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstancesListResult. +func (a AzureBareMetalStorageInstancesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstancesListResult. +func (a *AzureBareMetalStorageInstancesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Disk. func (d Disk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -196,56 +308,50 @@ func (d *Disk) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Display. -func (d Display) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", d.Description) - populate(objectMap, "operation", d.Operation) - populate(objectMap, "provider", d.Provider) - populate(objectMap, "resource", d.Resource) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Display. -func (d *Display) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &d.Operation) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &d.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &d.Resource) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. -func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -253,6 +359,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) @@ -262,6 +371,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -297,6 +409,33 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ForceState. +func (f ForceState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "forceState", f.ForceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ForceState. +func (f *ForceState) 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 "forceState": + err = unpopulate(val, "ForceState", &f.ForceState) + 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 HardwareProfile. func (h HardwareProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -328,28 +467,28 @@ func (h *HardwareProfile) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type IPAddress. -func (i IPAddress) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkInterface. +func (n NetworkInterface) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ipAddress", i.IPAddress) + populate(objectMap, "ipAddress", n.IPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. -func (i *IPAddress) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterface. +func (n *NetworkInterface) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { case "ipAddress": - err = unpopulate(val, "IPAddress", &i.IPAddress) + err = unpopulate(val, "IPAddress", &n.IPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil @@ -428,9 +567,11 @@ func (o *OSProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) } @@ -443,6 +584,9 @@ func (o *Operation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) @@ -452,6 +596,48 @@ func (o *Operation) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -460,15 +646,16 @@ func (o *Operation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. -func (o *OperationList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -476,6 +663,9 @@ func (o *OperationList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) @@ -487,11 +677,82 @@ func (o *OperationList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", o.Error) + populate(objectMap, "name", o.Name) + populate(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusError. +func (o OperationStatusError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusError. +func (o *OperationStatusError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -511,6 +772,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -522,28 +786,32 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Result. -func (r Result) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageBillingProperties. +func (s StorageBillingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sampleProperty", r.SampleProperty) + populate(objectMap, "azureBareMetalStorageInstanceSize", s.AzureBareMetalStorageInstanceSize) + populate(objectMap, "billingMode", s.BillingMode) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Result. -func (r *Result) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBillingProperties. +func (s *StorageBillingProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "sampleProperty": - err = unpopulate(val, "SampleProperty", &r.SampleProperty) + case "azureBareMetalStorageInstanceSize": + err = unpopulate(val, "AzureBareMetalStorageInstanceSize", &s.AzureBareMetalStorageInstanceSize) + delete(rawMsg, key) + case "billingMode": + err = unpopulate(val, "BillingMode", &s.BillingMode) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -580,6 +848,57 @@ func (s *StorageProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StorageProperties. +func (s StorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "generation", s.Generation) + populate(objectMap, "hardwareType", s.HardwareType) + populate(objectMap, "offeringType", s.OfferingType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "storageBillingProperties", s.StorageBillingProperties) + populate(objectMap, "storageType", s.StorageType) + populate(objectMap, "workloadType", s.WorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProperties. +func (s *StorageProperties) 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 "generation": + err = unpopulate(val, "Generation", &s.Generation) + delete(rawMsg, key) + case "hardwareType": + err = unpopulate(val, "HardwareType", &s.HardwareType) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &s.OfferingType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "storageBillingProperties": + err = unpopulate(val, "StorageBillingProperties", &s.StorageBillingProperties) + delete(rawMsg, key) + case "storageType": + err = unpopulate(val, "StorageType", &s.StorageType) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &s.WorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -660,6 +979,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -683,6 +1003,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -707,6 +1030,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go index 9ac499ed1751..796c2f152c99 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of AzureBareMetal management operations. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-08-04-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +71,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-08-04-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -81,7 +80,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go deleted file mode 100644 index 283bb6ef12fd..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armbaremetalinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalOperations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationList = armbaremetalinfrastructure.OperationList{ - // Value: []*armbaremetalinfrastructure.Operation{ - // { - // Name: to.Ptr("AzureBareMetalOp1"), - // Display: &armbaremetalinfrastructure.Display{ - // Description: to.Ptr("AzureBareMetalOp1Description"), - // Operation: to.Ptr("AzureBareMetalOp1OperationName"), - // Provider: to.Ptr("AzureBareMetalOp1ProviderName"), - // Resource: to.Ptr("AzureBareMetalOp1ResourceName"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("AzureBareMetalOp2"), - // Display: &armbaremetalinfrastructure.Display{ - // Description: to.Ptr("AzureBareMetalOp2Description"), - // Operation: to.Ptr("AzureBareMetalOp2OperationName"), - // Provider: to.Ptr("AzureBareMetalOp2ProviderName"), - // Resource: to.Ptr("AzureBareMetalOp2ResourceName"), - // }, - // IsDataAction: to.Ptr(true), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go new file mode 100644 index 000000000000..c8a30b1265ba --- /dev/null +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go @@ -0,0 +1,98 @@ +//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 armbaremetalinfrastructure + +// AzureBareMetalInstancesClientBeginRestartOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginRestart +// method. +type AzureBareMetalInstancesClientBeginRestartOptions struct { + // When set to 'active', this parameter empowers the server with the ability to forcefully terminate and halt any existing + // processes that may be running on the server + ForceParameter *ForceState + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureBareMetalInstancesClientBeginShutdownOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginShutdown +// method. +type AzureBareMetalInstancesClientBeginShutdownOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureBareMetalInstancesClientBeginStartOptions contains the optional parameters for the AzureBareMetalInstancesClient.BeginStart +// method. +type AzureBareMetalInstancesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get method. +type AzureBareMetalInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListByResourceGroupPager +// method. +type AzureBareMetalInstancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListBySubscriptionPager +// method. +type AzureBareMetalInstancesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalInstancesClient.Update +// method. +type AzureBareMetalInstancesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Create +// method. +type AzureBareMetalStorageInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Delete +// method. +type AzureBareMetalStorageInstancesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientGetOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Get +// method. +type AzureBareMetalStorageInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager +// method. +type AzureBareMetalStorageInstancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager +// method. +type AzureBareMetalStorageInstancesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Update +// method. +type AzureBareMetalStorageInstancesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go index acbc61ba3632..70e2dc13423c 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go @@ -3,33 +3,90 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure // AzureBareMetalInstancesClientGetResponse contains the response from method AzureBareMetalInstancesClient.Get. type AzureBareMetalInstancesClientGetResponse struct { + // AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) AzureBareMetalInstance } // AzureBareMetalInstancesClientListByResourceGroupResponse contains the response from method AzureBareMetalInstancesClient.NewListByResourceGroupPager. type AzureBareMetalInstancesClientListByResourceGroupResponse struct { + // The response from the List Azure Bare Metal Instances operation. AzureBareMetalInstancesListResult } // AzureBareMetalInstancesClientListBySubscriptionResponse contains the response from method AzureBareMetalInstancesClient.NewListBySubscriptionPager. type AzureBareMetalInstancesClientListBySubscriptionResponse struct { + // The response from the List Azure Bare Metal Instances operation. AzureBareMetalInstancesListResult } +// AzureBareMetalInstancesClientRestartResponse contains the response from method AzureBareMetalInstancesClient.BeginRestart. +type AzureBareMetalInstancesClientRestartResponse struct { + // The OperationStatus object returns the state of an asynchronous operation. + OperationStatus +} + +// AzureBareMetalInstancesClientShutdownResponse contains the response from method AzureBareMetalInstancesClient.BeginShutdown. +type AzureBareMetalInstancesClientShutdownResponse struct { + // The OperationStatus object returns the state of an asynchronous operation. + OperationStatus +} + +// AzureBareMetalInstancesClientStartResponse contains the response from method AzureBareMetalInstancesClient.BeginStart. +type AzureBareMetalInstancesClientStartResponse struct { + // The OperationStatus object returns the state of an asynchronous operation. + OperationStatus +} + // AzureBareMetalInstancesClientUpdateResponse contains the response from method AzureBareMetalInstancesClient.Update. type AzureBareMetalInstancesClientUpdateResponse struct { + // AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) AzureBareMetalInstance } +// AzureBareMetalStorageInstancesClientCreateResponse contains the response from method AzureBareMetalStorageInstancesClient.Create. +type AzureBareMetalStorageInstancesClientCreateResponse struct { + // AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) + AzureBareMetalStorageInstance +} + +// AzureBareMetalStorageInstancesClientDeleteResponse contains the response from method AzureBareMetalStorageInstancesClient.Delete. +type AzureBareMetalStorageInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureBareMetalStorageInstancesClientGetResponse contains the response from method AzureBareMetalStorageInstancesClient.Get. +type AzureBareMetalStorageInstancesClientGetResponse struct { + // AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) + AzureBareMetalStorageInstance +} + +// AzureBareMetalStorageInstancesClientListByResourceGroupResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager. +type AzureBareMetalStorageInstancesClientListByResourceGroupResponse struct { + // The response from the Get AzureBareMetalStorageInstances operation. + AzureBareMetalStorageInstancesListResult +} + +// AzureBareMetalStorageInstancesClientListBySubscriptionResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager. +type AzureBareMetalStorageInstancesClientListBySubscriptionResponse struct { + // The response from the Get AzureBareMetalStorageInstances operation. + AzureBareMetalStorageInstancesListResult +} + +// AzureBareMetalStorageInstancesClientUpdateResponse contains the response from method AzureBareMetalStorageInstancesClient.Update. +type AzureBareMetalStorageInstancesClientUpdateResponse struct { + // AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) + AzureBareMetalStorageInstance +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - OperationList + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult } diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go index 0629e66230c3..2234d9a19823 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armbaremetalinfrastructure