From d0659cc251fd48aed7dcc23d0244ea75ca21126d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 19 May 2023 05:42:09 +0000 Subject: [PATCH] CodeGen from PR 24061 in Azure/azure-rest-api-specs Merge 4dac5ba90584c72e3c314afb2c2ca6450ff5e841 into d27233c75caefa067a59c37538486da5b535cf15 --- .../armbaremetalinfrastructure/CHANGELOG.md | 26 + .../armbaremetalinfrastructure/autorest.md | 6 +- .../azurebaremetalinstances_client.go | 16 +- ...ebaremetalinstances_client_example_test.go | 445 ------------------ .../azurebaremetalstorageinstances_client.go | 398 ++++++++++++++++ .../client_factory.go | 5 + .../armbaremetalinfrastructure/constants.go | 30 +- .../armbaremetalinfrastructure/go.mod | 16 +- .../armbaremetalinfrastructure/go.sum | 22 +- .../armbaremetalinfrastructure/models.go | 267 ++++++++--- .../models_serde.go | 252 +++++++++- .../operations_client.go | 4 +- .../operations_client_example_test.go | 66 --- .../response_types.go | 30 ++ 14 files changed, 953 insertions(+), 630 deletions(-) delete mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go create mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go delete mode 100644 sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md index 468d264e08f2..290eb1a9af3a 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/CHANGELOG.md @@ -1,5 +1,31 @@ # Release History +## 2.0.0 (2023-05-19) +### Breaking Changes + +- Type of `ErrorResponse.Error` has been changed from `*ErrorDefinition` to `*ErrorDetail` +- Struct `ErrorDefinition` has been removed + +### Features Added + +- New enum type `ProvisioningState` with values `ProvisioningStateAccepted`, `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateMigrating`, `ProvisioningStateSucceeded`, `ProvisioningStateUpdating` +- New function `NewAzureBareMetalStorageInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AzureBareMetalStorageInstancesClient, error)` +- New function `*AzureBareMetalStorageInstancesClient.Create(context.Context, string, string, AzureBareMetalStorageInstance, *AzureBareMetalStorageInstancesClientCreateOptions) (AzureBareMetalStorageInstancesClientCreateResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.Delete(context.Context, string, string, *AzureBareMetalStorageInstancesClientDeleteOptions) (AzureBareMetalStorageInstancesClientDeleteResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.Get(context.Context, string, string, *AzureBareMetalStorageInstancesClientGetOptions) (AzureBareMetalStorageInstancesClientGetResponse, error)` +- New function `*AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager(string, *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListByResourceGroupResponse]` +- New function `*AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager(*AzureBareMetalStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListBySubscriptionResponse]` +- New function `*AzureBareMetalStorageInstancesClient.Update(context.Context, string, string, Tags, *AzureBareMetalStorageInstancesClientUpdateOptions) (AzureBareMetalStorageInstancesClientUpdateResponse, error)` +- New function `*ClientFactory.NewAzureBareMetalStorageInstancesClient() *AzureBareMetalStorageInstancesClient` +- New struct `AzureBareMetalStorageInstance` +- New struct `AzureBareMetalStorageInstanceProperties` +- New struct `AzureBareMetalStorageInstancesListResult` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `StorageBillingProperties` +- New struct `StorageProperties` + + ## 1.1.0 (2023-03-27) ### Features Added diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md index 8732811c28b3..bf509f6e3443 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go index 4cdcdd7fca34..50b5d57a0669 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client.go @@ -47,7 +47,7 @@ func NewAzureBareMetalInstancesClient(subscriptionID string, credential azcore.T // Get - Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-04-06 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureBareMetalInstanceName - Name of the Azure BareMetal on Azure instance. // - options - AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get @@ -87,7 +87,7 @@ func (client *AzureBareMetalInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-04-06") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,7 +105,7 @@ func (client *AzureBareMetalInstancesClient) getHandleResponse(resp *http.Respon // NewListByResourceGroupPager - Gets a list of AzureBareMetal instances in the specified subscription and resource group. // The operations returns various properties of each Azure BareMetal instance. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-04-06 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AzureBareMetalInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListByResourceGroupPager // method. @@ -153,7 +153,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-04-06") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +171,7 @@ func (client *AzureBareMetalInstancesClient) listByResourceGroupHandleResponse(r // NewListBySubscriptionPager - Gets a list of AzureBareMetal instances in the specified subscription. The operations returns // various properties of each Azure BareMetal instance. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-04-06 // - options - AzureBareMetalInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalInstancesClient.NewListBySubscriptionPager // method. func (client *AzureBareMetalInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalInstancesClientListBySubscriptionResponse] { @@ -214,7 +214,7 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-04-06") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +233,7 @@ func (client *AzureBareMetalInstancesClient) listBySubscriptionHandleResponse(re // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-04-06 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureBareMetalInstanceName - Name of the Azure BareMetal on Azure instance. // - tagsParameter - Request body that only contains the new Tags field @@ -274,7 +274,7 @@ func (client *AzureBareMetalInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-04-06") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, tagsParameter) diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go deleted file mode 100644 index 4d6a85f83858..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalinstances_client_example_test.go +++ /dev/null @@ -1,445 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armbaremetalinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_ListBySubscription.json -func ExampleAzureBareMetalInstancesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureBareMetalInstancesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureBareMetalInstancesListResult = armbaremetalinfrastructure.AzureBareMetalInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalInstance{ - // { - // Name: to.Ptr("myAzureBareMetalInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance1"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/57d3422f-467a-448e-b798-ebf490849542/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myAzureBareMetalInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance2"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_ListByResourceGroup.json -func ExampleAzureBareMetalInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureBareMetalInstancesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureBareMetalInstancesListResult = armbaremetalinfrastructure.AzureBareMetalInstancesListResult{ - // Value: []*armbaremetalinfrastructure.AzureBareMetalInstance{ - // { - // Name: to.Ptr("myAzureBareMetalInstance1"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/azureBareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myAzureBareMetalInstance1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName1"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myABMInstance2"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/azureBareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myABMInstance2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("589bce49-9fe6-4dc8-82df-cf6ae25e0cb9"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS384), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumHPE), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.101"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName2"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/azureBareMetalInstances/myAzureBareMetalInstance1"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.201"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-13T08:01:22.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_Get.json -func ExampleAzureBareMetalInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Get(ctx, "myResourceGroup", "myAzureBareMetalInstance", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myAzureBareMetalInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myAzureBareMetalInstance"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 4.2"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("123.123.123.123"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SLES 12 SP2"), - // Version: to.Ptr("12 SP2"), - // }, - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumRestarting), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("123.123.119.123"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_PatchTags_Delete.json -func ExampleAzureBareMetalInstancesClient_Update_deleteTagsFieldOfAnAzureBareMetalInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Update(ctx, "myResourceGroup", "myABMInstance", armbaremetalinfrastructure.Tags{ - Tags: map[string]*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myABMInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance2"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalInstances_PatchTags.json -func ExampleAzureBareMetalInstancesClient_Update_updateTagsFieldOfAnAzureBareMetalInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureBareMetalInstancesClient().Update(ctx, "myResourceGroup", "myABMInstance", armbaremetalinfrastructure.Tags{ - Tags: map[string]*string{ - "testkey": to.Ptr("testvalue"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBareMetalInstance = armbaremetalinfrastructure.AzureBareMetalInstance{ - // Name: to.Ptr("myABMInstance"), - // Type: to.Ptr("Microsoft.BareMetalInfrastructure/bareMetalInstances"), - // ID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("testvalue"), - // }, - // Properties: &armbaremetalinfrastructure.AzureBareMetalInstanceProperties{ - // AzureBareMetalInstanceID: to.Ptr("23415635-4d7e-41dc-9598-8194f22c24e1"), - // HardwareProfile: &armbaremetalinfrastructure.HardwareProfile{ - // AzureBareMetalInstanceSize: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstanceSizeNamesEnumS72), - // HardwareType: to.Ptr(armbaremetalinfrastructure.AzureBareMetalHardwareTypeNamesEnumCiscoUCS), - // }, - // HwRevision: to.Ptr("Rev 3"), - // NetworkProfile: &armbaremetalinfrastructure.NetworkProfile{ - // CircuitID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuit"), - // NetworkInterfaces: []*armbaremetalinfrastructure.IPAddress{ - // { - // IPAddress: to.Ptr("100.100.100.100"), - // }}, - // }, - // OSProfile: &armbaremetalinfrastructure.OSProfile{ - // ComputerName: to.Ptr("myComputerName"), - // OSType: to.Ptr("SUSE"), - // SSHPublicKey: to.Ptr("AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"), - // Version: to.Ptr("12 SP1"), - // }, - // PartnerNodeID: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/myABMInstance2"), - // PowerState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalInstancePowerStateEnumStarted), - // ProvisioningState: to.Ptr(armbaremetalinfrastructure.AzureBareMetalProvisioningStatesEnumSucceeded), - // ProximityPlacementGroup: to.Ptr("/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Compute/proximityPlacementGroups/myplacementgroup"), - // StorageProfile: &armbaremetalinfrastructure.StorageProfile{ - // NfsIPAddress: to.Ptr("200.200.200.200"), - // }, - // }, - // SystemData: &armbaremetalinfrastructure.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-20T23:10:22.6828621Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-21T08:01:22.0000000Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armbaremetalinfrastructure.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go new file mode 100644 index 000000000000..40b3d48746a7 --- /dev/null +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/azurebaremetalstorageinstances_client.go @@ -0,0 +1,398 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureBareMetalStorageInstancesClient contains the methods for the AzureBareMetalStorageInstances group. +// Don't use this type directly, use NewAzureBareMetalStorageInstancesClient() instead. +type AzureBareMetalStorageInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAzureBareMetalStorageInstancesClient creates a new instance of AzureBareMetalStorageInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAzureBareMetalStorageInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureBareMetalStorageInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AzureBareMetalStorageInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureBareMetalStorageInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create an azure baremetal storage resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-06 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the AzureBareMetalStorage on Azure instance. +// - requestBodyParameters - request body for put call +// - options - AzureBareMetalStorageInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Create +// method. +func (client *AzureBareMetalStorageInstancesClient) Create(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, options *AzureBareMetalStorageInstancesClientCreateOptions) (AzureBareMetalStorageInstancesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, requestBodyParameters, options) + if err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AzureBareMetalStorageInstancesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AzureBareMetalStorageInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, requestBodyParameters AzureBareMetalStorageInstance, options *AzureBareMetalStorageInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, requestBodyParameters) +} + +// createHandleResponse handles the Create response. +func (client *AzureBareMetalStorageInstancesClient) createHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientCreateResponse, error) { + result := AzureBareMetalStorageInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete an AzureBareMetalStorageInstance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-04-06 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the AzureBareMetalStorage on Azure instance. +// - options - AzureBareMetalStorageInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Delete +// method. +func (client *AzureBareMetalStorageInstancesClient) Delete(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientDeleteOptions) (AzureBareMetalStorageInstancesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, options) + if err != nil { + return AzureBareMetalStorageInstancesClientDeleteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AzureBareMetalStorageInstancesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AzureBareMetalStorageInstancesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureBareMetalStorageInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets an Azure BareMetal 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-04-06 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the AzureBareMetalStorage on Azure instance. +// - options - AzureBareMetalStorageInstancesClientGetOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Get +// method. +func (client *AzureBareMetalStorageInstancesClient) Get(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientGetOptions) (AzureBareMetalStorageInstancesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, options) + if err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AzureBareMetalStorageInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, options *AzureBareMetalStorageInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureBareMetalStorageInstancesClient) getHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientGetResponse, error) { + result := AzureBareMetalStorageInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of AzureBareMetalStorage instances in the specified subscription and resource +// group. The operations returns various properties of each Azure BareMetal instance. +// +// Generated from API version 2023-04-06 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AzureBareMetalStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager +// method. +func (client *AzureBareMetalStorageInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureBareMetalStorageInstancesClientListByResourceGroupResponse]{ + More: func(page AzureBareMetalStorageInstancesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureBareMetalStorageInstancesClientListByResourceGroupResponse) (AzureBareMetalStorageInstancesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureBareMetalStorageInstancesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" + 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)) + 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-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AzureBareMetalStorageInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientListByResourceGroupResponse, error) { + result := AzureBareMetalStorageInstancesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstancesListResult); err != nil { + return AzureBareMetalStorageInstancesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Gets a list of AzureBareMetalStorage instances in the specified subscription. The operations +// returns various properties of each Azure BareMetal instance. +// +// Generated from API version 2023-04-06 +// - options - AzureBareMetalStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager +// method. +func (client *AzureBareMetalStorageInstancesClient) NewListBySubscriptionPager(options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureBareMetalStorageInstancesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureBareMetalStorageInstancesClientListBySubscriptionResponse]{ + More: func(page AzureBareMetalStorageInstancesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureBareMetalStorageInstancesClientListBySubscriptionResponse) (AzureBareMetalStorageInstancesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureBareMetalStorageInstancesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AzureBareMetalStorageInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientListBySubscriptionResponse, error) { + result := AzureBareMetalStorageInstancesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstancesListResult); err != nil { + return AzureBareMetalStorageInstancesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Patches the Tags field of a Azure 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-04-06 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureBareMetalStorageInstanceName - Name of the AzureBareMetalStorage on Azure instance. +// - tagsParameter - Request body that only contains the new Tags field +// - options - AzureBareMetalStorageInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Update +// method. +func (client *AzureBareMetalStorageInstancesClient) Update(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter Tags, options *AzureBareMetalStorageInstancesClientUpdateOptions) (AzureBareMetalStorageInstancesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureBareMetalStorageInstanceName, tagsParameter, options) + if err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AzureBareMetalStorageInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureBareMetalStorageInstanceName string, tagsParameter Tags, options *AzureBareMetalStorageInstancesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalStorageInstances/{azureBareMetalStorageInstanceName}" + 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 azureBareMetalStorageInstanceName == "" { + return nil, errors.New("parameter azureBareMetalStorageInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureBareMetalStorageInstanceName}", url.PathEscape(azureBareMetalStorageInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-04-06") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, tagsParameter) +} + +// updateHandleResponse handles the Update response. +func (client *AzureBareMetalStorageInstancesClient) updateHandleResponse(resp *http.Response) (AzureBareMetalStorageInstancesClientUpdateResponse, error) { + result := AzureBareMetalStorageInstancesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBareMetalStorageInstance); err != nil { + return AzureBareMetalStorageInstancesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go index 0d02dad2c9f4..64b5bfbf1541 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/client_factory.go @@ -47,3 +47,8 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } + +func (c *ClientFactory) NewAzureBareMetalStorageInstancesClient() *AzureBareMetalStorageInstancesClient { + subClient, _ := NewAzureBareMetalStorageInstancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go index fc86451e6130..d7e8ab836b86 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/constants.go @@ -11,7 +11,7 @@ package armbaremetalinfrastructure const ( moduleName = "armbaremetalinfrastructure" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) // AzureBareMetalHardwareTypeNamesEnum - Name of the hardware type (vendor and/or their product name) @@ -197,3 +197,31 @@ func PossibleCreatedByTypeValues() []CreatedByType { CreatedByTypeUser, } } + +// ProvisioningState - State of provisioning of the AzureBareMetalStorageInstance +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMigrating ProvisioningState = "Migrating" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMigrating, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod index 7ec243fdc76f..aebbe260a2de 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum index 8ba445a8c4da..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/go.sum @@ -1,31 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go index e6a16beaf868..7ea870938c31 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models.go @@ -14,58 +14,58 @@ import "time" // AzureBareMetalInstance - AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties) type AzureBareMetalInstance struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // AzureBareMetal instance properties - Properties *AzureBareMetalInstanceProperties `json:"properties,omitempty"` + Properties *AzureBareMetalInstanceProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // AzureBareMetalInstanceProperties - Describes the properties of an AzureBareMetal instance. type AzureBareMetalInstanceProperties struct { // Specifies the hardware settings for the AzureBareMetal instance. - HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + HardwareProfile *HardwareProfile // Specifies the network settings for the AzureBareMetal instance. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + NetworkProfile *NetworkProfile // Specifies the operating system settings for the AzureBareMetal instance. - OSProfile *OSProfile `json:"osProfile,omitempty"` + OSProfile *OSProfile // ARM ID of another AzureBareMetalInstance that will share a network with this AzureBareMetalInstance - PartnerNodeID *string `json:"partnerNodeId,omitempty"` + PartnerNodeID *string // Specifies the storage settings for the AzureBareMetal instance disks. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + StorageProfile *StorageProfile // READ-ONLY; Specifies the AzureBareMetal instance unique ID. - AzureBareMetalInstanceID *string `json:"azureBareMetalInstanceId,omitempty" azure:"ro"` + AzureBareMetalInstanceID *string // READ-ONLY; Hardware revision of an AzureBareMetal instance - HwRevision *string `json:"hwRevision,omitempty" azure:"ro"` + HwRevision *string // READ-ONLY; Resource power state - PowerState *AzureBareMetalInstancePowerStateEnum `json:"powerState,omitempty" azure:"ro"` + PowerState *AzureBareMetalInstancePowerStateEnum // READ-ONLY; State of provisioning of the AzureBareMetalInstance - ProvisioningState *AzureBareMetalProvisioningStatesEnum `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *AzureBareMetalProvisioningStatesEnum // READ-ONLY; Resource proximity placement group - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty" azure:"ro"` + ProximityPlacementGroup *string } // AzureBareMetalInstancesClientGetOptions contains the optional parameters for the AzureBareMetalInstancesClient.Get method. @@ -94,114 +94,208 @@ type AzureBareMetalInstancesClientUpdateOptions struct { // AzureBareMetalInstancesListResult - The response from the List AzureBareMetal Instances operation. type AzureBareMetalInstancesListResult struct { // The URL to get the next set of AzureBareMetal instances. - NextLink *string `json:"nextLink,omitempty"` + NextLink *string // The list of Azure BareMetal instances. - Value []*AzureBareMetalInstance `json:"value,omitempty"` + Value []*AzureBareMetalInstance +} + +// AzureBareMetalStorageInstance info on Azure (ARM properties and AzureBareMetalStorage properties) +type AzureBareMetalStorageInstance struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // AzureBareMetalStorageInstance properties + Properties *AzureBareMetalStorageInstanceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AzureBareMetalStorageInstanceProperties - Describes the properties of an AzureBareMetalStorageInstance. +type AzureBareMetalStorageInstanceProperties struct { + // Specifies the AzureBareMetaStorageInstance unique ID. + AzureBareMetalStorageInstanceUniqueIdentifier *string + + // Specifies the storage properties for the AzureBareMetalStorage instance. + StorageProperties *StorageProperties +} + +// AzureBareMetalStorageInstancesClientCreateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Create +// method. +type AzureBareMetalStorageInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientDeleteOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Delete +// method. +type AzureBareMetalStorageInstancesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientGetOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Get +// method. +type AzureBareMetalStorageInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager +// method. +type AzureBareMetalStorageInstancesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager +// method. +type AzureBareMetalStorageInstancesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AzureBareMetalStorageInstancesClientUpdateOptions contains the optional parameters for the AzureBareMetalStorageInstancesClient.Update +// method. +type AzureBareMetalStorageInstancesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// 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 AzureBareMetal instance type Disk struct { // Specifies the size of an empty data disk in gigabytes. - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + DiskSizeGB *int32 // The disk name. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM // and therefore must be unique for each data disk attached to a VM. - Lun *int32 `json:"lun,omitempty" azure:"ro"` + Lun *int32 } // Display - Detailed BareMetal operation information type Display struct { // READ-ONLY; The localized friendly description for the operation as shown to the user. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The localized friendly name for the operation as shown to the user. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty" azure:"ro"` + Resource *string +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string } -// ErrorDefinition - Error definition. -type ErrorDefinition struct { - // READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty" azure:"ro"` +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail - // READ-ONLY; Internal error details. - Details []*ErrorDefinition `json:"details,omitempty" azure:"ro"` + // READ-ONLY; The error message. + Message *string - // READ-ONLY; Description of the error. - Message *string `json:"message,omitempty" azure:"ro"` + // READ-ONLY; The error target. + Target *string } -// ErrorResponse - Error response. +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). type ErrorResponse struct { - // The error details. - Error *ErrorDefinition `json:"error,omitempty"` + // The error object. + Error *ErrorDetail } // HardwareProfile - Specifies the hardware settings for the AzureBareMetal instance. type HardwareProfile struct { // READ-ONLY; Specifies the AzureBareMetal instance SKU. - AzureBareMetalInstanceSize *AzureBareMetalInstanceSizeNamesEnum `json:"azureBareMetalInstanceSize,omitempty" azure:"ro"` + AzureBareMetalInstanceSize *AzureBareMetalInstanceSizeNamesEnum // READ-ONLY; Name of the hardware type (vendor and/or their product name) - HardwareType *AzureBareMetalHardwareTypeNamesEnum `json:"hardwareType,omitempty" azure:"ro"` + HardwareType *AzureBareMetalHardwareTypeNamesEnum } // IPAddress - Specifies the IP address of the network interface. type IPAddress struct { // Specifies the IP address of the network interface. - IPAddress *string `json:"ipAddress,omitempty"` + IPAddress *string } // NetworkProfile - Specifies the network settings for the AzureBareMetal instance disks. type NetworkProfile struct { // Specifies the network interfaces for the AzureBareMetal instance. - NetworkInterfaces []*IPAddress `json:"networkInterfaces,omitempty"` + NetworkInterfaces []*IPAddress // READ-ONLY; Specifies the circuit id for connecting to express route. - CircuitID *string `json:"circuitId,omitempty" azure:"ro"` + CircuitID *string } // OSProfile - Specifies the operating system settings for the AzureBareMetal instance. type OSProfile struct { // Specifies the host OS name of the AzureBareMetal instance. - ComputerName *string `json:"computerName,omitempty"` + ComputerName *string // Specifies the SSH public key used to access the operating system. - SSHPublicKey *string `json:"sshPublicKey,omitempty"` + SSHPublicKey *string // READ-ONLY; This property allows you to specify the type of the OS. - OSType *string `json:"osType,omitempty" azure:"ro"` + OSType *string // READ-ONLY; Specifies version of operating system. - Version *string `json:"version,omitempty" azure:"ro"` + Version *string } // Operation - AzureBareMetal operation information type Operation struct { // Displayed AzureBareMetal operation information - Display *Display `json:"display,omitempty"` + Display *Display // READ-ONLY; indicates whether an operation is a data action or not. - IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"` + IsDataAction *bool // READ-ONLY; The name of the operation being performed on this particular object. This name should match the action name // that appears in RBAC / the event service. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } // OperationList - List of AzureBareMetal operations type OperationList struct { // List of AzureBareMetal operations - Value []*Operation `json:"value,omitempty"` + Value []*Operation } // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -212,72 +306,105 @@ type OperationsClientListOptions struct { // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Result - Sample result definition type Result struct { // Sample property of type string - SampleProperty *string `json:"sampleProperty,omitempty"` + SampleProperty *string +} + +// StorageBillingProperties - Describes the billing related details of the AzureBareMetalStorageInstance. +type StorageBillingProperties struct { + // the SKU type that is provisioned + AzureBareMetalStorageInstanceSize *string + + // the billing mode for the storage instance + BillingMode *string } // StorageProfile - Specifies the storage settings for the AzureBareMetal instance disks. type StorageProfile struct { // Specifies information about the operating system disk used by baremetal instance. - OSDisks []*Disk `json:"osDisks,omitempty"` + OSDisks []*Disk // READ-ONLY; IP Address to connect to storage. - NfsIPAddress *string `json:"nfsIpAddress,omitempty" azure:"ro"` + NfsIPAddress *string +} + +// StorageProperties - described the storage properties of the azure baremetalstorage instance +type StorageProperties struct { + // the kind of storage instance + Generation *string + + // the hardware type of the storage instance + HardwareType *string + + // the offering type for which the resource is getting provisioned + OfferingType *string + + // State of provisioning of the AzureBareMetalStorageInstance + ProvisioningState *ProvisioningState + + // the billing related information for the resource + StorageBillingProperties *StorageBillingProperties + + // the storage protocol for which the resource is getting provisioned + StorageType *string + + // the workload for which the resource is getting provisioned + WorkloadType *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *CreatedByType } -// Tags field of the AzureBareMetal instance. +// Tags field of the AzureBareMetal/AzureBareMetaStorage instance. type Tags struct { - // Tags field of the AzureBareMetal instance. - Tags map[string]*string `json:"tags,omitempty"` + // Tags field of the AzureBareMetal/AzureBareMetaStorage instance. + Tags map[string]*string } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go index ca0429d4a405..c330fd1e7c9c 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/models_serde.go @@ -161,6 +161,119 @@ func (a *AzureBareMetalInstancesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstance. +func (a AzureBareMetalStorageInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstance. +func (a *AzureBareMetalStorageInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstanceProperties. +func (a AzureBareMetalStorageInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureBareMetalStorageInstanceUniqueIdentifier", a.AzureBareMetalStorageInstanceUniqueIdentifier) + populate(objectMap, "storageProperties", a.StorageProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstanceProperties. +func (a *AzureBareMetalStorageInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureBareMetalStorageInstanceUniqueIdentifier": + err = unpopulate(val, "AzureBareMetalStorageInstanceUniqueIdentifier", &a.AzureBareMetalStorageInstanceUniqueIdentifier) + delete(rawMsg, key) + case "storageProperties": + err = unpopulate(val, "StorageProperties", &a.StorageProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBareMetalStorageInstancesListResult. +func (a AzureBareMetalStorageInstancesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBareMetalStorageInstancesListResult. +func (a *AzureBareMetalStorageInstancesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Disk. func (d Disk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -235,17 +348,50 @@ func (d *Display) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. -func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -253,6 +399,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) @@ -262,6 +411,9 @@ func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { case "message": err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -549,6 +701,37 @@ func (r *Result) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StorageBillingProperties. +func (s StorageBillingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureBareMetalStorageInstanceSize", s.AzureBareMetalStorageInstanceSize) + populate(objectMap, "billingMode", s.BillingMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBillingProperties. +func (s *StorageBillingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureBareMetalStorageInstanceSize": + err = unpopulate(val, "AzureBareMetalStorageInstanceSize", &s.AzureBareMetalStorageInstanceSize) + delete(rawMsg, key) + case "billingMode": + err = unpopulate(val, "BillingMode", &s.BillingMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type StorageProfile. func (s StorageProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -580,6 +763,57 @@ func (s *StorageProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StorageProperties. +func (s StorageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "generation", s.Generation) + populate(objectMap, "hardwareType", s.HardwareType) + populate(objectMap, "offeringType", s.OfferingType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "storageBillingProperties", s.StorageBillingProperties) + populate(objectMap, "storageType", s.StorageType) + populate(objectMap, "workloadType", s.WorkloadType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProperties. +func (s *StorageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "generation": + err = unpopulate(val, "Generation", &s.Generation) + delete(rawMsg, key) + case "hardwareType": + err = unpopulate(val, "HardwareType", &s.HardwareType) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &s.OfferingType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "storageBillingProperties": + err = unpopulate(val, "StorageBillingProperties", &s.StorageBillingProperties) + delete(rawMsg, key) + case "storageType": + err = unpopulate(val, "StorageType", &s.StorageType) + delete(rawMsg, key) + case "workloadType": + err = unpopulate(val, "WorkloadType", &s.WorkloadType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -707,6 +941,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go index 9ac499ed1751..1aacd51e1803 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of AzureBareMetal management operations. // -// Generated from API version 2021-08-09 +// Generated from API version 2023-04-06 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-09") + reqQP.Set("api-version", "2023-04-06") 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 283bb6ef12fd..000000000000 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/operations_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armbaremetalinfrastructure_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/baremetalinfrastructure/resource-manager/Microsoft.BareMetalInfrastructure/stable/2021-08-09/examples/AzureBareMetalOperations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbaremetalinfrastructure.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationList = armbaremetalinfrastructure.OperationList{ - // Value: []*armbaremetalinfrastructure.Operation{ - // { - // Name: to.Ptr("AzureBareMetalOp1"), - // Display: &armbaremetalinfrastructure.Display{ - // Description: to.Ptr("AzureBareMetalOp1Description"), - // Operation: to.Ptr("AzureBareMetalOp1OperationName"), - // Provider: to.Ptr("AzureBareMetalOp1ProviderName"), - // Resource: to.Ptr("AzureBareMetalOp1ResourceName"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("AzureBareMetalOp2"), - // Display: &armbaremetalinfrastructure.Display{ - // Description: to.Ptr("AzureBareMetalOp2Description"), - // Operation: to.Ptr("AzureBareMetalOp2OperationName"), - // Provider: to.Ptr("AzureBareMetalOp2ProviderName"), - // Resource: to.Ptr("AzureBareMetalOp2ResourceName"), - // }, - // IsDataAction: to.Ptr(true), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go index acbc61ba3632..055d99a1d7bf 100644 --- a/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go +++ b/sdk/resourcemanager/baremetalinfrastructure/armbaremetalinfrastructure/response_types.go @@ -29,6 +29,36 @@ type AzureBareMetalInstancesClientUpdateResponse struct { AzureBareMetalInstance } +// AzureBareMetalStorageInstancesClientCreateResponse contains the response from method AzureBareMetalStorageInstancesClient.Create. +type AzureBareMetalStorageInstancesClientCreateResponse struct { + AzureBareMetalStorageInstance +} + +// AzureBareMetalStorageInstancesClientDeleteResponse contains the response from method AzureBareMetalStorageInstancesClient.Delete. +type AzureBareMetalStorageInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureBareMetalStorageInstancesClientGetResponse contains the response from method AzureBareMetalStorageInstancesClient.Get. +type AzureBareMetalStorageInstancesClientGetResponse struct { + AzureBareMetalStorageInstance +} + +// AzureBareMetalStorageInstancesClientListByResourceGroupResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListByResourceGroupPager. +type AzureBareMetalStorageInstancesClientListByResourceGroupResponse struct { + AzureBareMetalStorageInstancesListResult +} + +// AzureBareMetalStorageInstancesClientListBySubscriptionResponse contains the response from method AzureBareMetalStorageInstancesClient.NewListBySubscriptionPager. +type AzureBareMetalStorageInstancesClientListBySubscriptionResponse struct { + AzureBareMetalStorageInstancesListResult +} + +// AzureBareMetalStorageInstancesClientUpdateResponse contains the response from method AzureBareMetalStorageInstancesClient.Update. +type AzureBareMetalStorageInstancesClientUpdateResponse struct { + AzureBareMetalStorageInstance +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationList