diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md index 56f40aaeae73..cc9c015bc371 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 2.0.0-beta.2 (2025-04-17) +### Breaking Changes + +- Function `*AzureBareMetalStorageInstancesClient.Update` parameter(s) have been changed from `(context.Context, string, string, Tags, *AzureBareMetalStorageInstancesClientUpdateOptions)` to `(context.Context, string, string, AzureBareMetalStorageInstanceBody, *AzureBareMetalStorageInstancesClientUpdateOptions)` +- Struct `AzureBareMetalInstancesListResult` has been removed +- Struct `AzureBareMetalStorageInstancesListResult` has been removed +- Field `AzureBareMetalInstancesListResult` of struct `AzureBareMetalInstancesClientListByResourceGroupResponse` has been removed +- Field `AzureBareMetalInstancesListResult` of struct `AzureBareMetalInstancesClientListBySubscriptionResponse` has been removed +- Field `AzureBareMetalStorageInstancesListResult` of struct `AzureBareMetalStorageInstancesClientListByResourceGroupResponse` has been removed +- Field `AzureBareMetalStorageInstancesListResult` of struct `AzureBareMetalStorageInstancesClientListBySubscriptionResponse` has been removed + +### Features Added + +- New enum type `ResourceIdentityType` with values `ResourceIdentityTypeNone`, `ResourceIdentityTypeSystemAssigned` +- New function `*AzureBareMetalInstancesClient.Create(context.Context, string, string, AzureBareMetalInstance, *AzureBareMetalInstancesClientCreateOptions) (AzureBareMetalInstancesClientCreateResponse, error)` +- New function `*AzureBareMetalInstancesClient.Delete(context.Context, string, string, *AzureBareMetalInstancesClientDeleteOptions) (AzureBareMetalInstancesClientDeleteResponse, error)` +- New struct `AzureBareMetalInstanceListResult` +- New struct `AzureBareMetalStorageInstanceBody` +- New struct `AzureBareMetalStorageInstanceIdentity` +- New struct `AzureBareMetalStorageInstanceListResult` +- New anonymous field `AzureBareMetalInstanceListResult` in struct `AzureBareMetalInstancesClientListByResourceGroupResponse` +- New anonymous field `AzureBareMetalInstanceListResult` in struct `AzureBareMetalInstancesClientListBySubscriptionResponse` +- New field `Identity` in struct `AzureBareMetalStorageInstance` +- New anonymous field `AzureBareMetalStorageInstanceListResult` in struct `AzureBareMetalStorageInstancesClientListByResourceGroupResponse` +- New anonymous field `AzureBareMetalStorageInstanceListResult` in struct `AzureBareMetalStorageInstancesClientListBySubscriptionResponse` + + ## 2.0.0-beta.1 (2023-12-08) ### Breaking Changes diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md index 66c60c7cbf87..c016c30a222d 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/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: 2.0.0-beta.1 -tag: package-preview-2023-08 +module-version: 2.0.0-beta.2 ``` \ 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 19da067ee0e2..aa9462450044 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go @@ -1,6 +1,3 @@ -//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. @@ -43,10 +40,134 @@ func NewAzureBareMetalInstancesClient(subscriptionID string, credential azcore.T return client, nil } +// Create - Creates 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 2024-08-01-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. +// - requestBodyParameters - Resource create parameters. +// - options - AzureBareMetalInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalInstancesClient.Create +// method. +func (client *AzureBareMetalInstancesClient) Create(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, requestBodyParameters AzureBareMetalInstance, options *AzureBareMetalInstancesClientCreateOptions) (AzureBareMetalInstancesClientCreateResponse, error) { + var err error + const operationName = "AzureBareMetalInstancesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, requestBodyParameters, options) + if err != nil { + return AzureBareMetalInstancesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalInstancesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *AzureBareMetalInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, requestBodyParameters AzureBareMetalInstance, _ *AzureBareMetalInstancesClientCreateOptions) (*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") + } + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01-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 *AzureBareMetalInstancesClient) createHandleResponse(resp *http.Response) (AzureBareMetalInstancesClientCreateResponse, error) { + result := AzureBareMetalInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalInstance); err != nil { + return AzureBareMetalInstancesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes 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 2024-08-01-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 - AzureBareMetalInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalInstancesClient.Delete +// method. +func (client *AzureBareMetalInstancesClient) Delete(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientDeleteOptions) (AzureBareMetalInstancesClientDeleteResponse, error) { + var err error + const operationName = "AzureBareMetalInstancesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureBareMetalInstanceName, options) + if err != nil { + return AzureBareMetalInstancesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalInstancesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AzureBareMetalInstancesClientDeleteResponse{}, err + } + return AzureBareMetalInstancesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureBareMetalInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, _ *AzureBareMetalInstancesClientDeleteOptions) (*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") + } + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // 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 2023-08-04-preview +// Generated from API version 2024-08-01-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 - AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get @@ -74,7 +195,7 @@ func (client *AzureBareMetalInstancesClient) Get(ctx context.Context, resourceGr } // getCreateRequest creates the Get request. -func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientGetOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, _ *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") @@ -93,7 +214,7 @@ func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +232,7 @@ func (client *AzureBareMetalInstancesClient) getHandleResponse(resp *http.Respon // 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 2023-08-04-preview +// Generated from API version 2024-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureBareMetalInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListByResourceGroupPager // method. @@ -139,7 +260,7 @@ func (client *AzureBareMetalInstancesClient) NewListByResourceGroupPager(resourc } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureBareMetalInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") @@ -154,7 +275,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -163,7 +284,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ct // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *AzureBareMetalInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureBareMetalInstancesClientListByResourceGroupResponse, error) { result := AzureBareMetalInstancesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalInstancesListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalInstanceListResult); err != nil { return AzureBareMetalInstancesClientListByResourceGroupResponse{}, err } return result, nil @@ -172,7 +293,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupHandleResponse(r // 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 2023-08-04-preview +// Generated from API version 2024-08-01-preview // - options - AzureBareMetalInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListBySubscriptionPager // method. func (client *AzureBareMetalInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalInstancesClientListBySubscriptionResponse] { @@ -199,7 +320,7 @@ func (client *AzureBareMetalInstancesClient) NewListBySubscriptionPager(options } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureBareMetalInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureBareMetalInstancesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -210,7 +331,7 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -219,7 +340,7 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *AzureBareMetalInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureBareMetalInstancesClientListBySubscriptionResponse, error) { result := AzureBareMetalInstancesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalInstancesListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalInstanceListResult); err != nil { return AzureBareMetalInstancesClientListBySubscriptionResponse{}, err } return result, nil @@ -228,7 +349,7 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionHandleResponse(re // 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 +// Generated from API version 2024-08-01-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 @@ -254,7 +375,7 @@ func (client *AzureBareMetalInstancesClient) BeginRestart(ctx context.Context, r // 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 +// Generated from API version 2024-08-01-preview func (client *AzureBareMetalInstancesClient) restart(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "AzureBareMetalInstancesClient.BeginRestart" @@ -296,7 +417,7 @@ func (client *AzureBareMetalInstancesClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.ForceParameter != nil { @@ -311,7 +432,7 @@ func (client *AzureBareMetalInstancesClient) restartCreateRequest(ctx context.Co // 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 +// Generated from API version 2024-08-01-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 @@ -337,7 +458,7 @@ func (client *AzureBareMetalInstancesClient) BeginShutdown(ctx context.Context, // 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 +// Generated from API version 2024-08-01-preview func (client *AzureBareMetalInstancesClient) shutdown(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginShutdownOptions) (*http.Response, error) { var err error const operationName = "AzureBareMetalInstancesClient.BeginShutdown" @@ -360,7 +481,7 @@ func (client *AzureBareMetalInstancesClient) shutdown(ctx context.Context, resou } // shutdownCreateRequest creates the Shutdown request. -func (client *AzureBareMetalInstancesClient) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginShutdownOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, _ *AzureBareMetalInstancesClientBeginShutdownOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}/shutdown" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -379,7 +500,7 @@ func (client *AzureBareMetalInstancesClient) shutdownCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +509,7 @@ func (client *AzureBareMetalInstancesClient) shutdownCreateRequest(ctx context.C // 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 +// Generated from API version 2024-08-01-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 @@ -414,7 +535,7 @@ func (client *AzureBareMetalInstancesClient) BeginStart(ctx context.Context, res // 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 +// Generated from API version 2024-08-01-preview func (client *AzureBareMetalInstancesClient) start(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "AzureBareMetalInstancesClient.BeginStart" @@ -437,7 +558,7 @@ func (client *AzureBareMetalInstancesClient) start(ctx context.Context, resource } // startCreateRequest creates the Start request. -func (client *AzureBareMetalInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *AzureBareMetalInstancesClientBeginStartOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, _ *AzureBareMetalInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -456,7 +577,7 @@ func (client *AzureBareMetalInstancesClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -466,7 +587,7 @@ func (client *AzureBareMetalInstancesClient) startCreateRequest(ctx context.Cont // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-04-preview +// Generated from API version 2024-08-01-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. // - tagsParameter - Request body that only contains the new Tags field @@ -495,7 +616,7 @@ func (client *AzureBareMetalInstancesClient) Update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags, options *AzureBareMetalInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags, _ *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") @@ -514,7 +635,7 @@ func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { 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 65602306b5f3..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go +++ /dev/null @@ -1,544 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalInstances_Start.json -func ExampleAzureBareMetalInstancesClient_BeginStart() { - 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) - } - poller, err := clientFactory.NewAzureBareMetalInstancesClient().BeginStart(ctx, "myResourceGroup", "myABMInstance", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armbaremetalinfrastructure.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armbaremetalinfrastructure.OperationStatusError{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr("2023-08-01T21:17:24.9052926Z"), - // Status: to.Ptr(armbaremetalinfrastructure.AsyncOperationStatus("InProgress")), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalInstances_Restart.json -func ExampleAzureBareMetalInstancesClient_BeginRestart() { - 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) - } - poller, err := clientFactory.NewAzureBareMetalInstancesClient().BeginRestart(ctx, "myResourceGroup", "myABMInstance", &armbaremetalinfrastructure.AzureBareMetalInstancesClientBeginRestartOptions{ForceParameter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armbaremetalinfrastructure.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-0000000000001"), - // Error: &armbaremetalinfrastructure.OperationStatusError{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr("2023-08-01T21:17:24.9052926Z"), - // Status: to.Ptr(armbaremetalinfrastructure.AsyncOperationStatus("InProgress")), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalInstances_Shutdown.json -func ExampleAzureBareMetalInstancesClient_BeginShutdown() { - 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) - } - poller, err := clientFactory.NewAzureBareMetalInstancesClient().BeginShutdown(ctx, "myResourceGroup", "myABMInstance", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armbaremetalinfrastructure.OperationStatus{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000001"), - // Error: &armbaremetalinfrastructure.OperationStatusError{ - // Code: to.Ptr(""), - // Message: to.Ptr(""), - // }, - // StartTime: to.Ptr("2023-08-01T21:17:24.9052926Z"), - // Status: to.Ptr(armbaremetalinfrastructure.AsyncOperationStatus("InProgress")), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); 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.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // }, - // { - // 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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); 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.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // }, - // { - // 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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); 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.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // 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.NetworkInterface{ - // { - // 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"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go index 243f53a515c4..453f89a5b254 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go @@ -1,6 +1,3 @@ -//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. @@ -43,10 +40,10 @@ func NewAzureBareMetalStorageInstancesClient(subscriptionID string, credential a return client, nil } -// Create - Create an azure bare metal storage resource. +// Create - Creates 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 +// Generated from API version 2024-08-01-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 @@ -75,7 +72,7 @@ func (client *AzureBareMetalStorageInstancesClient) Create(ctx context.Context, } // createCreateRequest creates the Create request. -func (client *AzureBareMetalStorageInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, options *AzureBareMetalStorageInstancesClientCreateOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, _ *AzureBareMetalStorageInstancesClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +91,7 @@ func (client *AzureBareMetalStorageInstancesClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { @@ -112,10 +109,10 @@ func (client *AzureBareMetalStorageInstancesClient) createHandleResponse(resp *h return result, nil } -// Delete - Delete an AzureBareMetalStorageInstance. +// Delete - Deletes 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 +// Generated from API version 2024-08-01-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 @@ -142,7 +139,7 @@ func (client *AzureBareMetalStorageInstancesClient) Delete(ctx context.Context, } // deleteCreateRequest creates the Delete request. -func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientDeleteOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, _ *AzureBareMetalStorageInstancesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,7 +158,7 @@ func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +167,7 @@ func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx cont // 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 +// Generated from API version 2024-08-01-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 @@ -198,7 +195,7 @@ func (client *AzureBareMetalStorageInstancesClient) Get(ctx context.Context, res } // getCreateRequest creates the Get request. -func (client *AzureBareMetalStorageInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientGetOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, _ *AzureBareMetalStorageInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -217,7 +214,7 @@ func (client *AzureBareMetalStorageInstancesClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +232,7 @@ func (client *AzureBareMetalStorageInstancesClient) getHandleResponse(resp *http // 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 +// Generated from API version 2024-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureBareMetalStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager // method. @@ -263,7 +260,7 @@ func (client *AzureBareMetalStorageInstancesClient) NewListByResourceGroupPager( } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -278,7 +275,7 @@ func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -287,7 +284,7 @@ func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateReq // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstanceListResult); err != nil { return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err } return result, nil @@ -296,7 +293,7 @@ func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupHandleRes // 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 +// Generated from API version 2024-08-01-preview // - options - AzureBareMetalStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager // method. func (client *AzureBareMetalStorageInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListBySubscriptionResponse] { @@ -323,7 +320,7 @@ func (client *AzureBareMetalStorageInstancesClient) NewListBySubscriptionPager(o } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -334,7 +331,7 @@ func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,29 +340,29 @@ func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequ // 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 { + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstanceListResult); 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. +// Update - Patches the Tags field of a Azure BareMetalStorage 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 +// Generated from API version 2024-08-01-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 +// - azureBareMetalStorageInstanceBodyParameter - Request body that only contains the Tags and Identity 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) { +func (client *AzureBareMetalStorageInstancesClient) Update(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, azureBareMetalStorageInstanceBodyParameter AzureBareMetalStorageInstanceBody, options *AzureBareMetalStorageInstancesClientUpdateOptions) (AzureBareMetalStorageInstancesClientUpdateResponse, error) { var err error const operationName = "AzureBareMetalStorageInstancesClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, tagsParameter, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, azureBareMetalStorageInstanceBodyParameter, options) if err != nil { return AzureBareMetalStorageInstancesClientUpdateResponse{}, err } @@ -382,7 +379,7 @@ func (client *AzureBareMetalStorageInstancesClient) Update(ctx context.Context, } // updateCreateRequest creates the Update request. -func (client *AzureBareMetalStorageInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter Tags, options *AzureBareMetalStorageInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *AzureBareMetalStorageInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, azureBareMetalStorageInstanceBodyParameter AzureBareMetalStorageInstanceBody, _ *AzureBareMetalStorageInstancesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -401,10 +398,10 @@ func (client *AzureBareMetalStorageInstancesClient) updateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-04-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, tagsParameter); err != nil { + if err := runtime.MarshalAsJSON(req, azureBareMetalStorageInstanceBodyParameter); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client_example_test.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client_example_test.go deleted file mode 100644 index 7840371c5ed6..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client_example_test.go +++ /dev/null @@ -1,453 +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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_ListBySubscription.json -func ExampleAzureBareMetalStorageInstancesClient_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.NewAzureBareMetalStorageInstancesClient().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.AzureBareMetalStorageInstancesListResult = armbaremetalinfrastructure.AzureBareMetalStorageInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // { - // Name: to.Ptr("myAzureBareMetalStorageInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance1"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureBareMetalStorageInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance2"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); 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.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("RI"), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_ListByResourceGroup.json -func ExampleAzureBareMetalStorageInstancesClient_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.NewAzureBareMetalStorageInstancesClient().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.AzureBareMetalStorageInstancesListResult = armbaremetalinfrastructure.AzureBareMetalStorageInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // { - // Name: to.Ptr("myAzureBareMetalStorageInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance1"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myAzureBareMetalStorageInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance2"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.000Z"); 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.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24f7"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("RI"), - // }, - // StorageType: to.Ptr("NFS"), - // WorkloadType: to.Ptr("Cogito"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_Get.json -func ExampleAzureBareMetalStorageInstancesClient_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.NewAzureBareMetalStorageInstancesClient().Get(ctx, "myResourceGroup", "myAzureBareMetalStorageInstance", 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.AzureBareMetalStorageInstance = armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // Name: to.Ptr("myAzureBareMetalStorageInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_Create.json -func ExampleAzureBareMetalStorageInstancesClient_Create() { - 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.NewAzureBareMetalStorageInstancesClient().Create(ctx, "myResourceGroup", "myAzureBareMetalStorageInstance", armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - Location: to.Ptr("westus2"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - Generation: to.Ptr("Gen4"), - HardwareType: to.Ptr("NetApp"), - OfferingType: to.Ptr("EPIC"), - ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - AzureBareMetalStorageInstanceSize: to.Ptr(""), - BillingMode: to.Ptr("PAYG"), - }, - StorageType: to.Ptr("FC"), - WorkloadType: to.Ptr("ODB"), - }, - }, - }, 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.AzureBareMetalStorageInstance = armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // Name: to.Ptr("myAzureBareMetalStorageInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_PatchTags_Delete.json -func ExampleAzureBareMetalStorageInstancesClient_Update_deleteTagsFieldOfAnAzureBareMetalStorageInstance() { - 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.NewAzureBareMetalStorageInstancesClient().Update(ctx, "myResourceGroup", "myABMSInstance", 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.AzureBareMetalStorageInstance = armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // Name: to.Ptr("myAzureBareMetalStorageInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_PatchTags.json -func ExampleAzureBareMetalStorageInstancesClient_Update_updateTagsFieldOfAnAzureBareMetalStorageInstance() { - 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.NewAzureBareMetalStorageInstancesClient().Update(ctx, "myResourceGroup", "myABMSInstance", 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.AzureBareMetalStorageInstance = armbaremetalinfrastructure.AzureBareMetalStorageInstance{ - // Name: to.Ptr("myAzureBareMetalStorageInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalStorageInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/myAzureBareMetalStorageInstance"), - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.682Z"); 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.000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalStorageInstanceProperties{ - // AzureBareMetalStorageInstanceUniqueIdentifier: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e9"), - // StorageProperties: &armbaremetalinfrastructure.StorageProperties{ - // Generation: to.Ptr("Gen4"), - // HardwareType: to.Ptr("NetApp"), - // OfferingType: to.Ptr("EPIC"), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.ProvisioningStateSucceeded), - // StorageBillingProperties: &armbaremetalinfrastructure.StorageBillingProperties{ - // AzureBareMetalStorageInstanceSize: to.Ptr(""), - // BillingMode: to.Ptr("PAYG"), - // }, - // StorageType: to.Ptr("FC"), - // WorkloadType: to.Ptr("ODB"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/examples/AzureBareMetalStorageInstances_Delete.json -func ExampleAzureBareMetalStorageInstancesClient_Delete() { - 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) - } - _, err = clientFactory.NewAzureBareMetalStorageInstancesClient().Delete(ctx, "myResourceGroup", "myAzureBareMetalStorageInstance", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go index 017b70b8ddab..b82eca093817 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go @@ -1,6 +1,3 @@ -//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. @@ -17,8 +14,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,30 +23,35 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewAzureBareMetalInstancesClient creates a new instance of AzureBareMetalInstancesClient. func (c *ClientFactory) NewAzureBareMetalInstancesClient() *AzureBareMetalInstancesClient { - subClient, _ := NewAzureBareMetalInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AzureBareMetalInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewAzureBareMetalStorageInstancesClient creates a new instance of AzureBareMetalStorageInstancesClient. func (c *ClientFactory) NewAzureBareMetalStorageInstancesClient() *AzureBareMetalStorageInstancesClient { - subClient, _ := NewAzureBareMetalStorageInstancesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &AzureBareMetalStorageInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go index 804af11dbf8f..3713e280bdcf 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go @@ -1,6 +1,3 @@ -//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. @@ -10,7 +7,7 @@ package armbaremetalinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure" - moduleVersion = "v2.0.0-beta.1" + moduleVersion = "v2.0.0-beta.2" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -297,3 +294,21 @@ func PossibleProvisioningStateValues() []ProvisioningState { ProvisioningStateUpdating, } } + +// ResourceIdentityType - The type of identity used for the Azure Bare Metal Storage Instance. The type 'SystemAssigned' refers +// to an implicitly created identity. The type 'None' will remove any identities from the Azure Bare +// Metal Storage Instance. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + } +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalinstances_server.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalinstances_server.go index 52ebc3a64be6..e26b4ffb799d 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalinstances_server.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalinstances_server.go @@ -1,6 +1,3 @@ -//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. @@ -25,6 +22,14 @@ import ( // AzureBareMetalInstancesServer is a fake server for instances of the armbaremetalinfrastructure.AzureBareMetalInstancesClient type. type AzureBareMetalInstancesServer struct { + // Create is the fake for method AzureBareMetalInstancesClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, requestBodyParameters armbaremetalinfrastructure.AzureBareMetalInstance, options *armbaremetalinfrastructure.AzureBareMetalInstancesClientCreateOptions) (resp azfake.Responder[armbaremetalinfrastructure.AzureBareMetalInstancesClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AzureBareMetalInstancesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *armbaremetalinfrastructure.AzureBareMetalInstancesClientDeleteOptions) (resp azfake.Responder[armbaremetalinfrastructure.AzureBareMetalInstancesClientDeleteResponse], errResp azfake.ErrorResponder) + // Get is the fake for method AzureBareMetalInstancesClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, options *armbaremetalinfrastructure.AzureBareMetalInstancesClientGetOptions) (resp azfake.Responder[armbaremetalinfrastructure.AzureBareMetalInstancesClientGetResponse], errResp azfake.ErrorResponder) @@ -87,32 +92,125 @@ func (a *AzureBareMetalInstancesServerTransport) Do(req *http.Request) (*http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "AzureBareMetalInstancesClient.Get": - resp, err = a.dispatchGet(req) - case "AzureBareMetalInstancesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureBareMetalInstancesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureBareMetalInstancesClient.BeginRestart": - resp, err = a.dispatchBeginRestart(req) - case "AzureBareMetalInstancesClient.BeginShutdown": - resp, err = a.dispatchBeginShutdown(req) - case "AzureBareMetalInstancesClient.BeginStart": - resp, err = a.dispatchBeginStart(req) - case "AzureBareMetalInstancesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) + return a.dispatchToMethodFake(req, method) +} + +func (a *AzureBareMetalInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if azureBareMetalInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureBareMetalInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureBareMetalInstancesClient.Create": + res.resp, res.err = a.dispatchCreate(req) + case "AzureBareMetalInstancesClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AzureBareMetalInstancesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureBareMetalInstancesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AzureBareMetalInstancesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AzureBareMetalInstancesClient.BeginRestart": + res.resp, res.err = a.dispatchBeginRestart(req) + case "AzureBareMetalInstancesClient.BeginShutdown": + res.resp, res.err = a.dispatchBeginShutdown(req) + case "AzureBareMetalInstancesClient.BeginStart": + res.resp, res.err = a.dispatchBeginStart(req) + case "AzureBareMetalInstancesClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } +} +func (a *AzureBareMetalInstancesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if a.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.BareMetalInfrastructure/bareMetalInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armbaremetalinfrastructure.AzureBareMetalInstance](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + azureBareMetalInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureBareMetalInstanceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, azureBareMetalInstanceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureBareMetalInstance, req) if err != nil { return nil, err } + return resp, nil +} +func (a *AzureBareMetalInstancesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.BareMetalInfrastructure/bareMetalInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + azureBareMetalInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureBareMetalInstanceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, azureBareMetalInstanceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } return resp, nil } @@ -397,3 +495,9 @@ func (a *AzureBareMetalInstancesServerTransport) dispatchUpdate(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to AzureBareMetalInstancesServerTransport +var azureBareMetalInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalstorageinstances_server.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalstorageinstances_server.go index d8b667ca2a0d..2319b3412b7e 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalstorageinstances_server.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/azurebaremetalstorageinstances_server.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ type AzureBareMetalStorageInstancesServer struct { // Update is the fake for method AzureBareMetalStorageInstancesClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter armbaremetalinfrastructure.Tags, options *armbaremetalinfrastructure.AzureBareMetalStorageInstancesClientUpdateOptions) (resp azfake.Responder[armbaremetalinfrastructure.AzureBareMetalStorageInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, azureBareMetalStorageInstanceBodyParameter armbaremetalinfrastructure.AzureBareMetalStorageInstanceBody, options *armbaremetalinfrastructure.AzureBareMetalStorageInstancesClientUpdateOptions) (resp azfake.Responder[armbaremetalinfrastructure.AzureBareMetalStorageInstancesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewAzureBareMetalStorageInstancesServerTransport creates a new instance of AzureBareMetalStorageInstancesServerTransport with the provided implementation. @@ -76,31 +73,50 @@ func (a *AzureBareMetalStorageInstancesServerTransport) Do(req *http.Request) (* return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AzureBareMetalStorageInstancesClient.Create": - resp, err = a.dispatchCreate(req) - case "AzureBareMetalStorageInstancesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AzureBareMetalStorageInstancesClient.Get": - resp, err = a.dispatchGet(req) - case "AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureBareMetalStorageInstancesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AzureBareMetalStorageInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if azureBareMetalStorageInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureBareMetalStorageInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureBareMetalStorageInstancesClient.Create": + res.resp, res.err = a.dispatchCreate(req) + case "AzureBareMetalStorageInstancesClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AzureBareMetalStorageInstancesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AzureBareMetalStorageInstancesClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AzureBareMetalStorageInstancesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -286,7 +302,7 @@ func (a *AzureBareMetalStorageInstancesServerTransport) dispatchUpdate(req *http if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armbaremetalinfrastructure.Tags](req) + body, err := server.UnmarshalRequestAsJSON[armbaremetalinfrastructure.AzureBareMetalStorageInstanceBody](req) if err != nil { return nil, err } @@ -312,3 +328,9 @@ func (a *AzureBareMetalStorageInstancesServerTransport) dispatchUpdate(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to AzureBareMetalStorageInstancesServerTransport +var azureBareMetalStorageInstancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/internal.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/internal.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/internal.go @@ -1,6 +1,3 @@ -//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. @@ -14,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/operations_server.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/operations_server.go index dd25e50978a7..0d427cace057 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/operations_server.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/operations_server.go @@ -1,6 +1,3 @@ -//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. @@ -14,6 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/v2" "net/http" ) @@ -50,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,6 +93,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armbaremetalinfrastructure.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { @@ -90,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/server_factory.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/server_factory.go index 68c1d9651baf..a61c4bd44d5b 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/server_factory.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. @@ -19,9 +16,14 @@ import ( // ServerFactory is a fake server for instances of the armbaremetalinfrastructure.ClientFactory type. type ServerFactory struct { - AzureBareMetalInstancesServer AzureBareMetalInstancesServer + // AzureBareMetalInstancesServer contains the fakes for client AzureBareMetalInstancesClient + AzureBareMetalInstancesServer AzureBareMetalInstancesServer + + // AzureBareMetalStorageInstancesServer contains the fakes for client AzureBareMetalStorageInstancesClient AzureBareMetalStorageInstancesServer AzureBareMetalStorageInstancesServer - OperationsServer OperationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/time_rfc3339.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/time_rfc3339.go index b0535a7b63e6..7691a451714b 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/time_rfc3339.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/fake/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -19,12 +16,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +41,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod index 8acaf8858f5a..56a7e5abb633 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastruc go 1.23.0 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go index 09214e40b9cc..5ad6e08cb7e8 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go @@ -1,6 +1,3 @@ -//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. @@ -34,11 +31,26 @@ type AzureBareMetalInstance struct { Type *string } +// AzureBareMetalInstanceListResult - The response of a AzureBareMetalInstance list operation. +type AzureBareMetalInstanceListResult struct { + // REQUIRED; The AzureBareMetalInstance items on this page + Value []*AzureBareMetalInstance + + // The link to the next page of items + NextLink *string +} + // AzureBareMetalInstanceProperties - Describes the properties of an Azure Bare Metal Instance. type AzureBareMetalInstanceProperties struct { + // Specifies the Azure Bare Metal Instance unique ID. + AzureBareMetalInstanceID *string + // Specifies the hardware settings for the Azure Bare Metal Instance. HardwareProfile *HardwareProfile + // Hardware revision of an Azure Bare Metal Instance + HwRevision *string + // Specifies the network settings for the Azure Bare Metal Instance. NetworkProfile *NetworkProfile @@ -48,32 +60,17 @@ type AzureBareMetalInstanceProperties struct { // ARM ID of another AzureBareMetalInstance that will share a network with this AzureBareMetalInstance PartnerNodeID *string - // Specifies the storage settings for the Azure Bare Metal Instance disks. - StorageProfile *StorageProfile - - // READ-ONLY; Specifies the Azure Bare Metal Instance unique ID. - AzureBareMetalInstanceID *string - - // READ-ONLY; Hardware revision of an Azure Bare Metal Instance - HwRevision *string - - // READ-ONLY; Resource power state + // Resource power state PowerState *AzureBareMetalInstancePowerStateEnum - // READ-ONLY; State of provisioning of the AzureBareMetalInstance - ProvisioningState *AzureBareMetalProvisioningStatesEnum - - // READ-ONLY; Resource proximity placement group + // Resource proximity placement group ProximityPlacementGroup *string -} -// 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 + // Specifies the storage settings for the Azure Bare Metal Instance disks. + StorageProfile *StorageProfile - // The list of Azure Bare Metal Instances. - Value []*AzureBareMetalInstance + // READ-ONLY; State of provisioning of the AzureBareMetalInstance + ProvisioningState *AzureBareMetalProvisioningStatesEnum } // AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) @@ -81,6 +78,9 @@ type AzureBareMetalStorageInstance struct { // REQUIRED; The geo-location where the resource lives Location *string + // The identity of Azure Bare Metal Storage Instance, if configured. + Identity *AzureBareMetalStorageInstanceIdentity + // AzureBareMetalStorageInstance properties Properties *AzureBareMetalStorageInstanceProperties @@ -100,6 +100,40 @@ type AzureBareMetalStorageInstance struct { Type *string } +// AzureBareMetalStorageInstanceBody - properties of body during PUT/PATCH for an AzureBareMetalStorageInstance. +type AzureBareMetalStorageInstanceBody struct { + // The identity of Azure Bare Metal Storage Instance, if configured. + Identity *AzureBareMetalStorageInstanceIdentity + + // Tags field of the AzureBareMetal/AzureBareMetaStorage instance. + Tags map[string]*string +} + +// AzureBareMetalStorageInstanceIdentity - Identity for Azure Bare Metal Storage Instance. +type AzureBareMetalStorageInstanceIdentity struct { + // The type of identity used for the Azure Bare Metal Storage Instance. The type 'SystemAssigned' refers to an implicitly + // created identity. The type 'None' will remove any identities from the Azure Bare + // Metal Storage Instance. + Type *ResourceIdentityType + + // READ-ONLY; The principal ID of Azure Bare Metal Storage Instance identity. This property will only be provided for a system + // assigned identity. + PrincipalID *string + + // READ-ONLY; The tenant ID associated with the Azure Bare Metal Storage Instance. This property will only be provided for + // a system assigned identity. + TenantID *string +} + +// AzureBareMetalStorageInstanceListResult - The response of a AzureBareMetalStorageInstance list operation. +type AzureBareMetalStorageInstanceListResult struct { + // REQUIRED; The AzureBareMetalStorageInstance items on this page + Value []*AzureBareMetalStorageInstance + + // The link to the next page of items + NextLink *string +} + // AzureBareMetalStorageInstanceProperties - Describes the properties of an AzureBareMetalStorageInstance. type AzureBareMetalStorageInstanceProperties struct { // Specifies the AzureBareMetaStorageInstance unique ID. @@ -109,15 +143,6 @@ type AzureBareMetalStorageInstanceProperties struct { StorageProperties *StorageProperties } -// 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 AzureBareMetalStorage instances. - Value []*AzureBareMetalStorageInstance -} - // Disk - Specifies the disk information fo the Azure Bare Metal Instance type Disk struct { // Specifies the size of an empty data disk in gigabytes. @@ -140,10 +165,10 @@ type ForceState struct { // HardwareProfile - Specifies the hardware settings for the Azure Bare Metal Instance. type HardwareProfile struct { - // READ-ONLY; Specifies the Azure Bare Metal Instance SKU. + // Specifies the Azure Bare Metal Instance SKU. AzureBareMetalInstanceSize *AzureBareMetalInstanceSizeNamesEnum - // READ-ONLY; Name of the hardware type (vendor and/or their product name) + // Name of the hardware type (vendor and/or their product name) HardwareType *AzureBareMetalHardwareTypeNamesEnum } @@ -155,11 +180,11 @@ type NetworkInterface struct { // NetworkProfile - Specifies the network settings for the Azure Bare Metal Instance disks. type NetworkProfile struct { + // Specifies the circuit id for connecting to express route. + CircuitID *string + // 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 } // OSProfile - Specifies the operating system settings for the Azure Bare Metal instance. @@ -167,13 +192,13 @@ type OSProfile struct { // Specifies the host OS name of the Azure Bare Metal instance. ComputerName *string + // This property allows you to specify the type of the OS. + OSType *string + // Specifies the SSH public key used to access the operating system. SSHPublicKey *string - // READ-ONLY; This property allows you to specify the type of the OS. - OSType *string - - // READ-ONLY; Specifies version of operating system. + // Specifies version of operating system. Version *string } @@ -237,7 +262,7 @@ type OperationStatus struct { // Start Time when the operation was initially executed. StartTime *string - // Status of the operation. + // READ-ONLY; Status of the operation. Status *AsyncOperationStatus } @@ -261,11 +286,11 @@ type StorageBillingProperties struct { // StorageProfile - Specifies the storage settings for the Azure Bare Metal instance disks. type StorageProfile struct { + // IP Address to connect to storage. + NfsIPAddress *string + // Specifies information about the operating system disk used by bare metal instance. OSDisks []*Disk - - // READ-ONLY; IP Address to connect to storage. - NfsIPAddress *string } // StorageProperties - described the storage properties of the azure bare metal storage instance @@ -279,9 +304,6 @@ type StorageProperties struct { // 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 @@ -290,6 +312,9 @@ type StorageProperties struct { // the workload for which the resource is getting provisioned WorkloadType *string + + // READ-ONLY; State of provisioning of the AzureBareMetalStorageInstance + ProvisioningState *ProvisioningState } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -313,7 +338,7 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// Tags field of the AzureBareMetal/AzureBareMetaStorage instance. +// Tags field of the AzureBareMetal/AzureBareMetalStorage instance. type Tags struct { // Tags field of the AzureBareMetal/AzureBareMetaStorage instance. Tags map[string]*string diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go index c2e6ae10a151..22c23fc6a9ed 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go @@ -1,6 +1,3 @@ -//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. @@ -66,6 +63,37 @@ func (a *AzureBareMetalInstance) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalInstanceListResult. +func (a AzureBareMetalInstanceListResult) 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 AzureBareMetalInstanceListResult. +func (a *AzureBareMetalInstanceListResult) 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 AzureBareMetalInstanceProperties. func (a AzureBareMetalInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -129,41 +157,11 @@ func (a *AzureBareMetalInstanceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalInstancesListResult. -func (a AzureBareMetalInstancesListResult) 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 AzureBareMetalInstancesListResult. -func (a *AzureBareMetalInstancesListResult) 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 AzureBareMetalStorageInstance. func (a AzureBareMetalStorageInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -185,6 +183,9 @@ func (a *AzureBareMetalStorageInstance) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -211,16 +212,16 @@ func (a *AzureBareMetalStorageInstance) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstanceProperties. -func (a AzureBareMetalStorageInstanceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstanceBody. +func (a AzureBareMetalStorageInstanceBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureBareMetalStorageInstanceUniqueIdentifier", a.AzureBareMetalStorageInstanceUniqueIdentifier) - populate(objectMap, "storageProperties", a.StorageProperties) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceProperties. -func (a *AzureBareMetalStorageInstanceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceBody. +func (a *AzureBareMetalStorageInstanceBody) 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) @@ -228,11 +229,46 @@ func (a *AzureBareMetalStorageInstanceProperties) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "azureBareMetalStorageInstanceUniqueIdentifier": - err = unpopulate(val, "AzureBareMetalStorageInstanceUniqueIdentifier", &a.AzureBareMetalStorageInstanceUniqueIdentifier) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) - case "storageProperties": - err = unpopulate(val, "StorageProperties", &a.StorageProperties) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AzureBareMetalStorageInstanceIdentity. +func (a AzureBareMetalStorageInstanceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceIdentity. +func (a *AzureBareMetalStorageInstanceIdentity) 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 "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -242,16 +278,16 @@ func (a *AzureBareMetalStorageInstanceProperties) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstancesListResult. -func (a AzureBareMetalStorageInstancesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstanceListResult. +func (a AzureBareMetalStorageInstanceListResult) 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 { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceListResult. +func (a *AzureBareMetalStorageInstanceListResult) 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) @@ -273,6 +309,37 @@ func (a *AzureBareMetalStorageInstancesListResult) UnmarshalJSON(data []byte) er 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 Disk. func (d Disk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -844,7 +911,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go index 762cc8b0bae9..aeedafd992ed 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go @@ -1,6 +1,3 @@ -//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. @@ -37,28 +34,27 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Gets a list of AzureBareMetal management operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2023-08-04-preview +// Generated from API version 2024-08-01-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]{ More: func(page OperationsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -66,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.BareMetalInfrastructure/operations" 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") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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 198c7b57d912..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/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/90115af9fda46f323e5c42c274f2b376108d1d47/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/preview/2023-08-04-preview/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.OperationListResult = armbaremetalinfrastructure.OperationListResult{ - // Value: []*armbaremetalinfrastructure.Operation{ - // { - // Name: to.Ptr("AzureBareMetalOp1"), - // Display: &armbaremetalinfrastructure.OperationDisplay{ - // 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.OperationDisplay{ - // 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 index c8a30b1265ba..b7a3e47fd09b 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/options.go @@ -1,6 +1,3 @@ -//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. @@ -15,24 +12,36 @@ type AzureBareMetalInstancesClientBeginRestartOptions struct { // processes that may be running on the server ForceParameter *ForceState - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } +// AzureBareMetalInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalInstancesClient.Create +// method. +type AzureBareMetalInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalInstancesClient.Delete +// method. +type AzureBareMetalInstancesClientDeleteOptions struct { + // placeholder for future optional parameters +} + // AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get method. type AzureBareMetalInstancesClientGetOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/responses.go similarity index 82% rename from sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go rename to sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/responses.go index 70e2dc13423c..ea808674d387 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/responses.go @@ -1,6 +1,3 @@ -//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. @@ -8,6 +5,17 @@ package armbaremetalinfrastructure +// AzureBareMetalInstancesClientCreateResponse contains the response from method AzureBareMetalInstancesClient.Create. +type AzureBareMetalInstancesClientCreateResponse struct { + // AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) + AzureBareMetalInstance +} + +// AzureBareMetalInstancesClientDeleteResponse contains the response from method AzureBareMetalInstancesClient.Delete. +type AzureBareMetalInstancesClientDeleteResponse struct { + // placeholder for future response values +} + // AzureBareMetalInstancesClientGetResponse contains the response from method AzureBareMetalInstancesClient.Get. type AzureBareMetalInstancesClientGetResponse struct { // AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) @@ -16,14 +24,14 @@ type AzureBareMetalInstancesClientGetResponse struct { // AzureBareMetalInstancesClientListByResourceGroupResponse contains the response from method AzureBareMetalInstancesClient.NewListByResourceGroupPager. type AzureBareMetalInstancesClientListByResourceGroupResponse struct { - // The response from the List Azure Bare Metal Instances operation. - AzureBareMetalInstancesListResult + // The response of a AzureBareMetalInstance list operation. + AzureBareMetalInstanceListResult } // AzureBareMetalInstancesClientListBySubscriptionResponse contains the response from method AzureBareMetalInstancesClient.NewListBySubscriptionPager. type AzureBareMetalInstancesClientListBySubscriptionResponse struct { - // The response from the List Azure Bare Metal Instances operation. - AzureBareMetalInstancesListResult + // The response of a AzureBareMetalInstance list operation. + AzureBareMetalInstanceListResult } // AzureBareMetalInstancesClientRestartResponse contains the response from method AzureBareMetalInstancesClient.BeginRestart. @@ -69,14 +77,14 @@ type AzureBareMetalStorageInstancesClientGetResponse struct { // AzureBareMetalStorageInstancesClientListByResourceGroupResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager. type AzureBareMetalStorageInstancesClientListByResourceGroupResponse struct { - // The response from the Get AzureBareMetalStorageInstances operation. - AzureBareMetalStorageInstancesListResult + // The response of a AzureBareMetalStorageInstance list operation. + AzureBareMetalStorageInstanceListResult } // AzureBareMetalStorageInstancesClientListBySubscriptionResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager. type AzureBareMetalStorageInstancesClientListBySubscriptionResponse struct { - // The response from the Get AzureBareMetalStorageInstances operation. - AzureBareMetalStorageInstancesListResult + // The response of a AzureBareMetalStorageInstance list operation. + AzureBareMetalStorageInstanceListResult } // AzureBareMetalStorageInstancesClientUpdateResponse contains the response from method AzureBareMetalStorageInstancesClient.Update. diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go index deff423a9dff..e2752de037b6 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -19,12 +16,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +41,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339