diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/CHANGELOG.md b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/_meta.json b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/_meta.json new file mode 100644 index 000000000000..464587a93643 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1e42e81660d1bc0be000477a4659b29a7ce7d67b", + "readme": "/_/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md", + "tag": "package-2021-08-09", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/azurebaremetalinstances.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/azurebaremetalinstances.go new file mode 100644 index 000000000000..c8df6f29d3b2 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/azurebaremetalinstances.go @@ -0,0 +1,453 @@ +package baremetalinfrastructure + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AzureBareMetalInstancesClient is the the BareMetalInfrastructure Management client +type AzureBareMetalInstancesClient struct { + BaseClient +} + +// NewAzureBareMetalInstancesClient creates an instance of the AzureBareMetalInstancesClient client. +func NewAzureBareMetalInstancesClient(subscriptionID string) AzureBareMetalInstancesClient { + return NewAzureBareMetalInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAzureBareMetalInstancesClientWithBaseURI creates an instance of the AzureBareMetalInstancesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewAzureBareMetalInstancesClientWithBaseURI(baseURI string, subscriptionID string) AzureBareMetalInstancesClient { + return AzureBareMetalInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// azureBareMetalInstanceName - name of the Azure BareMetal on Azure instance. +func (client AzureBareMetalInstancesClient) Get(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string) (result AzureBareMetalInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, azureBareMetalInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AzureBareMetalInstancesClient) GetPreparer(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureBareMetalInstanceName": autorest.Encode("path", azureBareMetalInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-09" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AzureBareMetalInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AzureBareMetalInstancesClient) GetResponder(resp *http.Response) (result AzureBareMetalInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets a list of AzureBareMetal instances in the specified subscription and resource group. The +// operations returns various properties of each Azure BareMetal instance. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client AzureBareMetalInstancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureBareMetalInstancesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.abmilr.Response.Response != nil { + sc = result.abmilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.abmilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.abmilr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.abmilr.hasNextLink() && result.abmilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AzureBareMetalInstancesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-09" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AzureBareMetalInstancesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AzureBareMetalInstancesClient) ListByResourceGroupResponder(resp *http.Response) (result AzureBareMetalInstancesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AzureBareMetalInstancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureBareMetalInstancesListResult) (result AzureBareMetalInstancesListResult, err error) { + req, err := lastResults.azureBareMetalInstancesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AzureBareMetalInstancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AzureBareMetalInstancesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription gets a list of AzureBareMetal instances in the specified subscription. The operations returns +// various properties of each Azure BareMetal instance. +func (client AzureBareMetalInstancesClient) ListBySubscription(ctx context.Context) (result AzureBareMetalInstancesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.ListBySubscription") + defer func() { + sc := -1 + if result.abmilr.Response.Response != nil { + sc = result.abmilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.abmilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.abmilr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.abmilr.hasNextLink() && result.abmilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AzureBareMetalInstancesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-09" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client AzureBareMetalInstancesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client AzureBareMetalInstancesClient) ListBySubscriptionResponder(resp *http.Response) (result AzureBareMetalInstancesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client AzureBareMetalInstancesClient) listBySubscriptionNextResults(ctx context.Context, lastResults AzureBareMetalInstancesListResult) (result AzureBareMetalInstancesListResult, err error) { + req, err := lastResults.azureBareMetalInstancesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AzureBareMetalInstancesClient) ListBySubscriptionComplete(ctx context.Context) (result AzureBareMetalInstancesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and +// instance name. +// Parameters: +// 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 +func (client AzureBareMetalInstancesClient) Update(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags) (result AzureBareMetalInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, azureBareMetalInstanceName, tagsParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AzureBareMetalInstancesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter Tags) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureBareMetalInstanceName": autorest.Encode("path", azureBareMetalInstanceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-09" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}", pathParameters), + autorest.WithJSON(tagsParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AzureBareMetalInstancesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AzureBareMetalInstancesClient) UpdateResponder(resp *http.Response) (result AzureBareMetalInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/baremetalinfrastructureapi/interfaces.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/baremetalinfrastructureapi/interfaces.go new file mode 100644 index 000000000000..34d43201bef5 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/baremetalinfrastructureapi/interfaces.go @@ -0,0 +1,31 @@ +package baremetalinfrastructureapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure" +) + +// AzureBareMetalInstancesClientAPI contains the set of methods on the AzureBareMetalInstancesClient type. +type AzureBareMetalInstancesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string) (result baremetalinfrastructure.AzureBareMetalInstance, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result baremetalinfrastructure.AzureBareMetalInstancesListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result baremetalinfrastructure.AzureBareMetalInstancesListResultIterator, err error) + ListBySubscription(ctx context.Context) (result baremetalinfrastructure.AzureBareMetalInstancesListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result baremetalinfrastructure.AzureBareMetalInstancesListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, azureBareMetalInstanceName string, tagsParameter baremetalinfrastructure.Tags) (result baremetalinfrastructure.AzureBareMetalInstance, err error) +} + +var _ AzureBareMetalInstancesClientAPI = (*baremetalinfrastructure.AzureBareMetalInstancesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result baremetalinfrastructure.OperationList, err error) +} + +var _ OperationsClientAPI = (*baremetalinfrastructure.OperationsClient)(nil) diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/client.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/client.go new file mode 100644 index 000000000000..531879908352 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/client.go @@ -0,0 +1,41 @@ +// Package baremetalinfrastructure implements the Azure ARM Baremetalinfrastructure service API version 2021-08-09. +// +// The BareMetalInfrastructure Management client +package baremetalinfrastructure + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Baremetalinfrastructure + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Baremetalinfrastructure. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/enums.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/enums.go new file mode 100644 index 000000000000..c22636688052 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/enums.go @@ -0,0 +1,186 @@ +package baremetalinfrastructure + +// 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. + +// AzureBareMetalHardwareTypeNamesEnum enumerates the values for azure bare metal hardware type names enum. +type AzureBareMetalHardwareTypeNamesEnum string + +const ( + // CiscoUCS ... + CiscoUCS AzureBareMetalHardwareTypeNamesEnum = "Cisco_UCS" + // HPE ... + HPE AzureBareMetalHardwareTypeNamesEnum = "HPE" +) + +// PossibleAzureBareMetalHardwareTypeNamesEnumValues returns an array of possible values for the AzureBareMetalHardwareTypeNamesEnum const type. +func PossibleAzureBareMetalHardwareTypeNamesEnumValues() []AzureBareMetalHardwareTypeNamesEnum { + return []AzureBareMetalHardwareTypeNamesEnum{CiscoUCS, HPE} +} + +// AzureBareMetalInstancePowerStateEnum enumerates the values for azure bare metal instance power state enum. +type AzureBareMetalInstancePowerStateEnum string + +const ( + // Restarting ... + Restarting AzureBareMetalInstancePowerStateEnum = "restarting" + // Started ... + Started AzureBareMetalInstancePowerStateEnum = "started" + // Starting ... + Starting AzureBareMetalInstancePowerStateEnum = "starting" + // Stopped ... + Stopped AzureBareMetalInstancePowerStateEnum = "stopped" + // Stopping ... + Stopping AzureBareMetalInstancePowerStateEnum = "stopping" + // Unknown ... + Unknown AzureBareMetalInstancePowerStateEnum = "unknown" +) + +// PossibleAzureBareMetalInstancePowerStateEnumValues returns an array of possible values for the AzureBareMetalInstancePowerStateEnum const type. +func PossibleAzureBareMetalInstancePowerStateEnumValues() []AzureBareMetalInstancePowerStateEnum { + return []AzureBareMetalInstancePowerStateEnum{Restarting, Started, Starting, Stopped, Stopping, Unknown} +} + +// AzureBareMetalInstanceSizeNamesEnum enumerates the values for azure bare metal instance size names enum. +type AzureBareMetalInstanceSizeNamesEnum string + +const ( + // S112 ... + S112 AzureBareMetalInstanceSizeNamesEnum = "S112" + // S144 ... + S144 AzureBareMetalInstanceSizeNamesEnum = "S144" + // S144m ... + S144m AzureBareMetalInstanceSizeNamesEnum = "S144m" + // S192 ... + S192 AzureBareMetalInstanceSizeNamesEnum = "S192" + // S192m ... + S192m AzureBareMetalInstanceSizeNamesEnum = "S192m" + // S192xm ... + S192xm AzureBareMetalInstanceSizeNamesEnum = "S192xm" + // S224 ... + S224 AzureBareMetalInstanceSizeNamesEnum = "S224" + // S224m ... + S224m AzureBareMetalInstanceSizeNamesEnum = "S224m" + // S224om ... + S224om AzureBareMetalInstanceSizeNamesEnum = "S224om" + // S224oo ... + S224oo AzureBareMetalInstanceSizeNamesEnum = "S224oo" + // S224oom ... + S224oom AzureBareMetalInstanceSizeNamesEnum = "S224oom" + // S224ooo ... + S224ooo AzureBareMetalInstanceSizeNamesEnum = "S224ooo" + // S384 ... + S384 AzureBareMetalInstanceSizeNamesEnum = "S384" + // S384m ... + S384m AzureBareMetalInstanceSizeNamesEnum = "S384m" + // S384xm ... + S384xm AzureBareMetalInstanceSizeNamesEnum = "S384xm" + // S384xxm ... + S384xxm AzureBareMetalInstanceSizeNamesEnum = "S384xxm" + // S448 ... + S448 AzureBareMetalInstanceSizeNamesEnum = "S448" + // S448m ... + S448m AzureBareMetalInstanceSizeNamesEnum = "S448m" + // S448om ... + S448om AzureBareMetalInstanceSizeNamesEnum = "S448om" + // S448oo ... + S448oo AzureBareMetalInstanceSizeNamesEnum = "S448oo" + // S448oom ... + S448oom AzureBareMetalInstanceSizeNamesEnum = "S448oom" + // S448ooo ... + S448ooo AzureBareMetalInstanceSizeNamesEnum = "S448ooo" + // S576m ... + S576m AzureBareMetalInstanceSizeNamesEnum = "S576m" + // S576xm ... + S576xm AzureBareMetalInstanceSizeNamesEnum = "S576xm" + // S672 ... + S672 AzureBareMetalInstanceSizeNamesEnum = "S672" + // S672m ... + S672m AzureBareMetalInstanceSizeNamesEnum = "S672m" + // S672om ... + S672om AzureBareMetalInstanceSizeNamesEnum = "S672om" + // S672oo ... + S672oo AzureBareMetalInstanceSizeNamesEnum = "S672oo" + // S672oom ... + S672oom AzureBareMetalInstanceSizeNamesEnum = "S672oom" + // S672ooo ... + S672ooo AzureBareMetalInstanceSizeNamesEnum = "S672ooo" + // S72 ... + S72 AzureBareMetalInstanceSizeNamesEnum = "S72" + // S72m ... + S72m AzureBareMetalInstanceSizeNamesEnum = "S72m" + // S768 ... + S768 AzureBareMetalInstanceSizeNamesEnum = "S768" + // S768m ... + S768m AzureBareMetalInstanceSizeNamesEnum = "S768m" + // S768xm ... + S768xm AzureBareMetalInstanceSizeNamesEnum = "S768xm" + // S896 ... + S896 AzureBareMetalInstanceSizeNamesEnum = "S896" + // S896m ... + S896m AzureBareMetalInstanceSizeNamesEnum = "S896m" + // S896om ... + S896om AzureBareMetalInstanceSizeNamesEnum = "S896om" + // S896oo ... + S896oo AzureBareMetalInstanceSizeNamesEnum = "S896oo" + // S896oom ... + S896oom AzureBareMetalInstanceSizeNamesEnum = "S896oom" + // S896ooo ... + S896ooo AzureBareMetalInstanceSizeNamesEnum = "S896ooo" + // S96 ... + S96 AzureBareMetalInstanceSizeNamesEnum = "S96" + // S960m ... + S960m AzureBareMetalInstanceSizeNamesEnum = "S960m" +) + +// PossibleAzureBareMetalInstanceSizeNamesEnumValues returns an array of possible values for the AzureBareMetalInstanceSizeNamesEnum const type. +func PossibleAzureBareMetalInstanceSizeNamesEnumValues() []AzureBareMetalInstanceSizeNamesEnum { + return []AzureBareMetalInstanceSizeNamesEnum{S112, S144, S144m, S192, S192m, S192xm, S224, S224m, S224om, S224oo, S224oom, S224ooo, S384, S384m, S384xm, S384xxm, S448, S448m, S448om, S448oo, S448oom, S448ooo, S576m, S576xm, S672, S672m, S672om, S672oo, S672oom, S672ooo, S72, S72m, S768, S768m, S768xm, S896, S896m, S896om, S896oo, S896oom, S896ooo, S96, S960m} +} + +// AzureBareMetalProvisioningStatesEnum enumerates the values for azure bare metal provisioning states enum. +type AzureBareMetalProvisioningStatesEnum string + +const ( + // Accepted ... + Accepted AzureBareMetalProvisioningStatesEnum = "Accepted" + // Creating ... + Creating AzureBareMetalProvisioningStatesEnum = "Creating" + // Deleting ... + Deleting AzureBareMetalProvisioningStatesEnum = "Deleting" + // Failed ... + Failed AzureBareMetalProvisioningStatesEnum = "Failed" + // Migrating ... + Migrating AzureBareMetalProvisioningStatesEnum = "Migrating" + // Succeeded ... + Succeeded AzureBareMetalProvisioningStatesEnum = "Succeeded" + // Updating ... + Updating AzureBareMetalProvisioningStatesEnum = "Updating" +) + +// PossibleAzureBareMetalProvisioningStatesEnumValues returns an array of possible values for the AzureBareMetalProvisioningStatesEnum const type. +func PossibleAzureBareMetalProvisioningStatesEnumValues() []AzureBareMetalProvisioningStatesEnum { + return []AzureBareMetalProvisioningStatesEnum{Accepted, Creating, Deleting, Failed, Migrating, Succeeded, Updating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/models.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/models.go new file mode 100644 index 000000000000..189f25591151 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/models.go @@ -0,0 +1,619 @@ +package baremetalinfrastructure + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure" + +// AzureBareMetalInstance azureBareMetal instance info on Azure (ARM properties and AzureBareMetal +// properties) +type AzureBareMetalInstance struct { + autorest.Response `json:"-"` + // AzureBareMetalInstanceProperties - AzureBareMetal instance properties + *AzureBareMetalInstanceProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureBareMetalInstance. +func (abmi AzureBareMetalInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if abmi.AzureBareMetalInstanceProperties != nil { + objectMap["properties"] = abmi.AzureBareMetalInstanceProperties + } + if abmi.Tags != nil { + objectMap["tags"] = abmi.Tags + } + if abmi.Location != nil { + objectMap["location"] = abmi.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureBareMetalInstance struct. +func (abmi *AzureBareMetalInstance) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureBareMetalInstanceProperties AzureBareMetalInstanceProperties + err = json.Unmarshal(*v, &azureBareMetalInstanceProperties) + if err != nil { + return err + } + abmi.AzureBareMetalInstanceProperties = &azureBareMetalInstanceProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + abmi.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + abmi.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + abmi.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + abmi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + abmi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + abmi.Type = &typeVar + } + } + } + + return nil +} + +// AzureBareMetalInstanceProperties describes the properties of an AzureBareMetal instance. +type AzureBareMetalInstanceProperties struct { + // HardwareProfile - Specifies the hardware settings for the AzureBareMetal instance. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the AzureBareMetal instance disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // OsProfile - Specifies the operating system settings for the AzureBareMetal instance. + OsProfile *OSProfile `json:"osProfile,omitempty"` + // NetworkProfile - Specifies the network settings for the AzureBareMetal instance. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // AzureBareMetalInstanceID - READ-ONLY; Specifies the AzureBareMetal instance unique ID. + AzureBareMetalInstanceID *string `json:"azureBareMetalInstanceId,omitempty"` + // PowerState - READ-ONLY; Resource power state. Possible values include: 'Starting', 'Started', 'Stopping', 'Stopped', 'Restarting', 'Unknown' + PowerState AzureBareMetalInstancePowerStateEnum `json:"powerState,omitempty"` + // ProximityPlacementGroup - READ-ONLY; Resource proximity placement group + ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` + // HwRevision - READ-ONLY; Hardware revision of an AzureBareMetal instance + HwRevision *string `json:"hwRevision,omitempty"` + // PartnerNodeID - ARM ID of another AzureBareMetalInstance that will share a network with this AzureBareMetalInstance + PartnerNodeID *string `json:"partnerNodeId,omitempty"` + // ProvisioningState - READ-ONLY; State of provisioning of the AzureBareMetalInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' + ProvisioningState AzureBareMetalProvisioningStatesEnum `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureBareMetalInstanceProperties. +func (abmip AzureBareMetalInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if abmip.HardwareProfile != nil { + objectMap["hardwareProfile"] = abmip.HardwareProfile + } + if abmip.StorageProfile != nil { + objectMap["storageProfile"] = abmip.StorageProfile + } + if abmip.OsProfile != nil { + objectMap["osProfile"] = abmip.OsProfile + } + if abmip.NetworkProfile != nil { + objectMap["networkProfile"] = abmip.NetworkProfile + } + if abmip.PartnerNodeID != nil { + objectMap["partnerNodeId"] = abmip.PartnerNodeID + } + return json.Marshal(objectMap) +} + +// AzureBareMetalInstancesListResult the response from the List AzureBareMetal Instances operation. +type AzureBareMetalInstancesListResult struct { + autorest.Response `json:"-"` + // Value - The list of Azure BareMetal instances. + Value *[]AzureBareMetalInstance `json:"value,omitempty"` + // NextLink - The URL to get the next set of AzureBareMetal instances. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureBareMetalInstancesListResultIterator provides access to a complete listing of +// AzureBareMetalInstance values. +type AzureBareMetalInstancesListResultIterator struct { + i int + page AzureBareMetalInstancesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureBareMetalInstancesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureBareMetalInstancesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureBareMetalInstancesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureBareMetalInstancesListResultIterator) Response() AzureBareMetalInstancesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureBareMetalInstancesListResultIterator) Value() AzureBareMetalInstance { + if !iter.page.NotDone() { + return AzureBareMetalInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureBareMetalInstancesListResultIterator type. +func NewAzureBareMetalInstancesListResultIterator(page AzureBareMetalInstancesListResultPage) AzureBareMetalInstancesListResultIterator { + return AzureBareMetalInstancesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (abmilr AzureBareMetalInstancesListResult) IsEmpty() bool { + return abmilr.Value == nil || len(*abmilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (abmilr AzureBareMetalInstancesListResult) hasNextLink() bool { + return abmilr.NextLink != nil && len(*abmilr.NextLink) != 0 +} + +// azureBareMetalInstancesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (abmilr AzureBareMetalInstancesListResult) azureBareMetalInstancesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !abmilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(abmilr.NextLink))) +} + +// AzureBareMetalInstancesListResultPage contains a page of AzureBareMetalInstance values. +type AzureBareMetalInstancesListResultPage struct { + fn func(context.Context, AzureBareMetalInstancesListResult) (AzureBareMetalInstancesListResult, error) + abmilr AzureBareMetalInstancesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureBareMetalInstancesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureBareMetalInstancesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.abmilr) + if err != nil { + return err + } + page.abmilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureBareMetalInstancesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureBareMetalInstancesListResultPage) NotDone() bool { + return !page.abmilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureBareMetalInstancesListResultPage) Response() AzureBareMetalInstancesListResult { + return page.abmilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureBareMetalInstancesListResultPage) Values() []AzureBareMetalInstance { + if page.abmilr.IsEmpty() { + return nil + } + return *page.abmilr.Value +} + +// Creates a new instance of the AzureBareMetalInstancesListResultPage type. +func NewAzureBareMetalInstancesListResultPage(cur AzureBareMetalInstancesListResult, getNextPage func(context.Context, AzureBareMetalInstancesListResult) (AzureBareMetalInstancesListResult, error)) AzureBareMetalInstancesListResultPage { + return AzureBareMetalInstancesListResultPage{ + fn: getNextPage, + abmilr: cur, + } +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Disk specifies the disk information fo the AzureBareMetal instance +type Disk struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // Lun - 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"` +} + +// MarshalJSON is the custom marshaler for Disk. +func (d Disk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.DiskSizeGB != nil { + objectMap["diskSizeGB"] = d.DiskSizeGB + } + return json.Marshal(objectMap) +} + +// Display detailed BareMetal operation information +type Display struct { + // Provider - READ-ONLY; The localized friendly form of the resource provider name. + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The localized friendly name for the operation as shown to the user. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The localized friendly description for the operation as shown to the user. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for Display. +func (d Display) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // Details - READ-ONLY; Internal error details. + Details *[]ErrorDefinition `json:"details,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDefinition. +func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response. +type ErrorResponse struct { + // Error - The error details. + Error *ErrorDefinition `json:"error,omitempty"` +} + +// HardwareProfile specifies the hardware settings for the AzureBareMetal instance. +type HardwareProfile struct { + // HardwareType - READ-ONLY; Name of the hardware type (vendor and/or their product name). Possible values include: 'CiscoUCS', 'HPE' + HardwareType AzureBareMetalHardwareTypeNamesEnum `json:"hardwareType,omitempty"` + // AzureBareMetalInstanceSize - READ-ONLY; Specifies the AzureBareMetal instance SKU. Possible values include: 'S72m', 'S144m', 'S72', 'S144', 'S192', 'S192m', 'S192xm', 'S96', 'S112', 'S224', 'S224m', 'S224om', 'S224oo', 'S224oom', 'S224ooo', 'S384', 'S384m', 'S384xm', 'S384xxm', 'S448', 'S448m', 'S448om', 'S448oo', 'S448oom', 'S448ooo', 'S576m', 'S576xm', 'S672', 'S672m', 'S672om', 'S672oo', 'S672oom', 'S672ooo', 'S768', 'S768m', 'S768xm', 'S896', 'S896m', 'S896om', 'S896oo', 'S896oom', 'S896ooo', 'S960m' + AzureBareMetalInstanceSize AzureBareMetalInstanceSizeNamesEnum `json:"azureBareMetalInstanceSize,omitempty"` +} + +// MarshalJSON is the custom marshaler for HardwareProfile. +func (hp HardwareProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IPAddress specifies the IP address of the network interface. +type IPAddress struct { + // IPAddress - Specifies the IP address of the network interface. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// NetworkProfile specifies the network settings for the AzureBareMetal instance disks. +type NetworkProfile struct { + // NetworkInterfaces - Specifies the network interfaces for the AzureBareMetal instance. + NetworkInterfaces *[]IPAddress `json:"networkInterfaces,omitempty"` + // CircuitID - READ-ONLY; Specifies the circuit id for connecting to express route. + CircuitID *string `json:"circuitId,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfile. +func (np NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if np.NetworkInterfaces != nil { + objectMap["networkInterfaces"] = np.NetworkInterfaces + } + return json.Marshal(objectMap) +} + +// Operation azureBareMetal operation information +type Operation struct { + // Name - 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"` + // Display - Displayed AzureBareMetal operation information + Display *Display `json:"display,omitempty"` + // IsDataAction - READ-ONLY; indicates whether an operation is a data action or not. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationList list of AzureBareMetal operations +type OperationList struct { + autorest.Response `json:"-"` + // Value - List of AzureBareMetal operations + Value *[]Operation `json:"value,omitempty"` +} + +// OSProfile specifies the operating system settings for the AzureBareMetal instance. +type OSProfile struct { + // ComputerName - Specifies the host OS name of the AzureBareMetal instance. + ComputerName *string `json:"computerName,omitempty"` + // OsType - READ-ONLY; This property allows you to specify the type of the OS. + OsType *string `json:"osType,omitempty"` + // Version - READ-ONLY; Specifies version of operating system. + Version *string `json:"version,omitempty"` + // SSHPublicKey - Specifies the SSH public key used to access the operating system. + SSHPublicKey *string `json:"sshPublicKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for OSProfile. +func (op OSProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.ComputerName != nil { + objectMap["computerName"] = op.ComputerName + } + if op.SSHPublicKey != nil { + objectMap["sshPublicKey"] = op.SSHPublicKey + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Result sample result definition +type Result struct { + // SampleProperty - Sample property of type string + SampleProperty *string `json:"sampleProperty,omitempty"` +} + +// StorageProfile specifies the storage settings for the AzureBareMetal instance disks. +type StorageProfile struct { + // NfsIPAddress - READ-ONLY; IP Address to connect to storage. + NfsIPAddress *string `json:"nfsIpAddress,omitempty"` + // OsDisks - Specifies information about the operating system disk used by baremetal instance. + OsDisks *[]Disk `json:"osDisks,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageProfile. +func (sp StorageProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.OsDisks != nil { + objectMap["osDisks"] = sp.OsDisks + } + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Tags tags field of the AzureBareMetal instance. +type Tags struct { + // Tags - Tags field of the AzureBareMetal instance. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/operations.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/operations.go new file mode 100644 index 000000000000..f6c2376a1fb8 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/operations.go @@ -0,0 +1,98 @@ +package baremetalinfrastructure + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the BareMetalInfrastructure Management client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of AzureBareMetal management operations. +func (client OperationsClient) List(ctx context.Context) (result OperationList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-08-09" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.BareMetalInfrastructure/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/version.go b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/version.go new file mode 100644 index 000000000000..41a2d746e448 --- /dev/null +++ b/services/baremetalinfrastructure/mgmt/2021-08-09/baremetalinfrastructure/version.go @@ -0,0 +1,19 @@ +package baremetalinfrastructure + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " baremetalinfrastructure/2021-08-09" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/CHANGELOG.md b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/CHANGELOG.md index f66af821ec3d..a1ecf841edb0 100644 --- a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/CHANGELOG.md +++ b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/CHANGELOG.md @@ -1,12 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AzureEntityResource.MarshalJSON() ([]byte, error) -1. Display.MarshalJSON() ([]byte, error) -1. ErrorDefinition.MarshalJSON() ([]byte, error) -1. HardwareProfile.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. Resource.MarshalJSON() ([]byte, error) diff --git a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/_meta.json b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/_meta.json index 56bd46701020..149d6da17d2a 100644 --- a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/_meta.json +++ b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/_meta.json @@ -1,10 +1,10 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1e42e81660d1bc0be000477a4659b29a7ce7d67b", "readme": "/_/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md", "tag": "package-2020-08-06-preview", - "use": "@microsoft.azure/autorest.go@2.1.183", + "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-08-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-08-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/baremetalinfrastructure/resource-manager/readme.md", "additional_properties": { "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" } diff --git a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/azurebaremetalinstances.go b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/azurebaremetalinstances.go index 9a40abb9fb24..e50ffca81040 100644 --- a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/azurebaremetalinstances.go +++ b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/azurebaremetalinstances.go @@ -52,8 +52,7 @@ func (client AzureBareMetalInstancesClient) Delete(ctx context.Context, resource Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Delete", err.Error()) } @@ -65,7 +64,7 @@ func (client AzureBareMetalInstancesClient) Delete(ctx context.Context, resource result, err = client.DeleteSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Delete", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Delete", result.Response(), "Failure sending request") return } @@ -97,6 +96,7 @@ func (client AzureBareMetalInstancesClient) DeletePreparer(ctx context.Context, // http.Response Body if it receives an error. func (client AzureBareMetalInstancesClient) DeleteSender(req *http.Request) (future AzureBareMetalInstancesDeleteFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -139,8 +139,7 @@ func (client AzureBareMetalInstancesClient) Get(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Get", err.Error()) } @@ -224,8 +223,7 @@ func (client AzureBareMetalInstancesClient) List(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "List", err.Error()) } @@ -471,8 +469,7 @@ func (client AzureBareMetalInstancesClient) Restart(ctx context.Context, resourc Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Restart", err.Error()) } @@ -484,7 +481,7 @@ func (client AzureBareMetalInstancesClient) Restart(ctx context.Context, resourc result, err = client.RestartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Restart", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Restart", result.Response(), "Failure sending request") return } @@ -516,6 +513,7 @@ func (client AzureBareMetalInstancesClient) RestartPreparer(ctx context.Context, // http.Response Body if it receives an error. func (client AzureBareMetalInstancesClient) RestartSender(req *http.Request) (future AzureBareMetalInstancesRestartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -558,8 +556,7 @@ func (client AzureBareMetalInstancesClient) Shutdown(ctx context.Context, resour Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Shutdown", err.Error()) } @@ -571,7 +568,7 @@ func (client AzureBareMetalInstancesClient) Shutdown(ctx context.Context, resour result, err = client.ShutdownSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Shutdown", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Shutdown", result.Response(), "Failure sending request") return } @@ -603,6 +600,7 @@ func (client AzureBareMetalInstancesClient) ShutdownPreparer(ctx context.Context // http.Response Body if it receives an error. func (client AzureBareMetalInstancesClient) ShutdownSender(req *http.Request) (future AzureBareMetalInstancesShutdownFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -645,8 +643,7 @@ func (client AzureBareMetalInstancesClient) Start(ctx context.Context, resourceG Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Start", err.Error()) } @@ -658,7 +655,7 @@ func (client AzureBareMetalInstancesClient) Start(ctx context.Context, resourceG result, err = client.StartSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Start", nil, "Failure sending request") + err = autorest.NewErrorWithError(err, "baremetalinfrastructure.AzureBareMetalInstancesClient", "Start", result.Response(), "Failure sending request") return } @@ -690,6 +687,7 @@ func (client AzureBareMetalInstancesClient) StartPreparer(ctx context.Context, r // http.Response Body if it receives an error. func (client AzureBareMetalInstancesClient) StartSender(req *http.Request) (future AzureBareMetalInstancesStartFuture, err error) { var resp *http.Response + future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return @@ -734,8 +732,7 @@ func (client AzureBareMetalInstancesClient) Update(ctx context.Context, resource Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("baremetalinfrastructure.AzureBareMetalInstancesClient", "Update", err.Error()) } diff --git a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/models.go b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/models.go index a3badb17b23a..b1ff1dcf990c 100644 --- a/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/models.go +++ b/services/preview/baremetalinfrastructure/mgmt/2020-08-06-preview/baremetalinfrastructure/models.go @@ -599,7 +599,7 @@ type Operation struct { Name *string `json:"name,omitempty"` // Display - Displayed AzureBareMetal operation information Display *Display `json:"display,omitempty"` - // IsDataAction - indicates whether an operation is a data action or not. + // IsDataAction - READ-ONLY; indicates whether an operation is a data action or not. IsDataAction *bool `json:"isDataAction,omitempty"` } @@ -609,9 +609,6 @@ func (o Operation) MarshalJSON() ([]byte, error) { if o.Display != nil { objectMap["display"] = o.Display } - if o.IsDataAction != nil { - objectMap["isDataAction"] = o.IsDataAction - } return json.Marshal(objectMap) }