diff --git a/profiles/2020-09-01/compute/mgmt/compute/availabilitysets.go b/profiles/2020-09-01/compute/mgmt/compute/availabilitysets.go new file mode 100644 index 000000000000..eaa116d10629 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/availabilitysets.go @@ -0,0 +1,654 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// AvailabilitySetsClient is the compute Client +type AvailabilitySetsClient struct { + BaseClient +} +// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient client. +func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient { + return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailabilitySetsClientWithBaseURI creates an instance of the AvailabilitySetsClient 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 NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient { + return AvailabilitySetsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate create or update an availability set. + // Parameters: + // resourceGroupName - the name of the resource group. + // availabilitySetName - the name of the availability set. + // parameters - parameters supplied to the Create Availability Set operation. +func (client AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client AvailabilitySetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (*http.Request, error) { + pathParameters := map[string]interface{} { + "availabilitySetName": autorest.Encode("path",availabilitySetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete delete an availability set. + // Parameters: + // resourceGroupName - the name of the resource group. + // availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil , "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client AvailabilitySetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "availabilitySetName": autorest.Encode("path",availabilitySetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get retrieves information about an availability set. + // Parameters: + // resourceGroupName - the name of the resource group. + // availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client AvailabilitySetsClient) GetPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "availabilitySetName": autorest.Encode("path",availabilitySetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}",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 AvailabilitySetsClient) 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 AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List lists all availability sets in a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.List") + defer func() { + sc := -1 + if result.aslr.Response.Response != nil { + sc = result.aslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request") + return + } + + result.aslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request") + } + if result.aslr.hasNextLink() && result.aslr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client AvailabilitySetsClient) ListPreparer(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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets",pathParameters), +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 AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client AvailabilitySetsClient) listNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) { + req, err := lastResults.availabilitySetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client AvailabilitySetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.List") + 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.List(ctx, resourceGroupName) + return + } + +// ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an +// existing availability set. + // Parameters: + // resourceGroupName - the name of the resource group. + // availabilitySetName - the name of the availability set. +func (client AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.ListAvailableSizes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil , "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + + // ListAvailableSizesPreparer prepares the ListAvailableSizes request. + func (client AvailabilitySetsClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "availabilitySetName": autorest.Encode("path",availabilitySetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the + // http.Response Body if it receives an error. + func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always + // closes the http.Response Body. + func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListBySubscription lists all availability sets in a subscription. + // Parameters: + // expand - the expand expression to apply to the operation. Allowed values are 'instanceView'. +func (client AvailabilitySetsClient) ListBySubscription(ctx context.Context, expand string) (result AvailabilitySetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.ListBySubscription") + defer func() { + sc := -1 + if result.aslr.Response.Response != nil { + sc = result.aslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", nil , "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.aslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.aslr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListBySubscription", resp, "Failure responding to request") + } + if result.aslr.hasNextLink() && result.aslr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListBySubscriptionPreparer prepares the ListBySubscription request. + func (client AvailabilitySetsClient) ListBySubscriptionPreparer(ctx context.Context, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets",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 AvailabilitySetsClient) 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 AvailabilitySetsClient) ListBySubscriptionResponder(resp *http.Response) (result AvailabilitySetListResult, 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 AvailabilitySetsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) { + req, err := lastResults.availabilitySetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "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, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. + func (client AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context, expand string) (result AvailabilitySetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.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, expand) + return + } + +// Update update an availability set. + // Parameters: + // resourceGroupName - the name of the resource group. + // availabilitySetName - the name of the availability set. + // parameters - parameters supplied to the Update Availability Set operation. +func (client AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (result AvailabilitySet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", nil , "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure responding to request") + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client AvailabilitySetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "availabilitySetName": autorest.Encode("path",availabilitySetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/availabilitySets/{availabilitySetName}",pathParameters), +autorest.WithJSON(parameters), +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 AvailabilitySetsClient) 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 AvailabilitySetsClient) UpdateResponder(resp *http.Response) (result AvailabilitySet, 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/profiles/2020-09-01/compute/mgmt/compute/client.go b/profiles/2020-09-01/compute/mgmt/compute/client.go new file mode 100644 index 000000000000..a203ba2ff332 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/client.go @@ -0,0 +1,52 @@ +// Package compute implements the Azure ARM Compute service API version . +// +// Compute Client +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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 Compute +DefaultBaseURI = "https://management.azure.com") + +// BaseClient is the base client for Compute. +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/profiles/2020-09-01/compute/mgmt/compute/computeapi/interfaces.go b/profiles/2020-09-01/compute/mgmt/compute/computeapi/interfaces.go new file mode 100644 index 000000000000..9be7cac6c672 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/computeapi/interfaces.go @@ -0,0 +1,313 @@ +package computeapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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/profiles/2020-09-01/compute/mgmt/compute" + "github.com/Azure/go-autorest/autorest" +) + + // OperationsClientAPI contains the set of methods on the OperationsClient type. + type OperationsClientAPI interface { + List(ctx context.Context) (result compute.OperationListResult, err error) + } + + var _ OperationsClientAPI = (*compute.OperationsClient)(nil) + // AvailabilitySetsClientAPI contains the set of methods on the AvailabilitySetsClient type. + type AvailabilitySetsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters compute.AvailabilitySet) (result compute.AvailabilitySet, err error) + Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result compute.AvailabilitySet, err error) + List(ctx context.Context, resourceGroupName string) (result compute.AvailabilitySetListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result compute.AvailabilitySetListResultIterator, err error) + ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result compute.VirtualMachineSizeListResult, err error) + ListBySubscription(ctx context.Context, expand string) (result compute.AvailabilitySetListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, expand string) (result compute.AvailabilitySetListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters compute.AvailabilitySetUpdate) (result compute.AvailabilitySet, err error) + } + + var _ AvailabilitySetsClientAPI = (*compute.AvailabilitySetsClient)(nil) + // ProximityPlacementGroupsClientAPI contains the set of methods on the ProximityPlacementGroupsClient type. + type ProximityPlacementGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters compute.ProximityPlacementGroup) (result compute.ProximityPlacementGroup, err error) + Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, includeColocationStatus string) (result compute.ProximityPlacementGroup, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.ProximityPlacementGroupListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.ProximityPlacementGroupListResultIterator, err error) + ListBySubscription(ctx context.Context) (result compute.ProximityPlacementGroupListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result compute.ProximityPlacementGroupListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters compute.ProximityPlacementGroupUpdate) (result compute.ProximityPlacementGroup, err error) + } + + var _ ProximityPlacementGroupsClientAPI = (*compute.ProximityPlacementGroupsClient)(nil) + // DedicatedHostGroupsClientAPI contains the set of methods on the DedicatedHostGroupsClient type. + type DedicatedHostGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, parameters compute.DedicatedHostGroup) (result compute.DedicatedHostGroup, err error) + Delete(ctx context.Context, resourceGroupName string, hostGroupName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, hostGroupName string, expand compute.InstanceViewTypes) (result compute.DedicatedHostGroup, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.DedicatedHostGroupListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.DedicatedHostGroupListResultIterator, err error) + ListBySubscription(ctx context.Context) (result compute.DedicatedHostGroupListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result compute.DedicatedHostGroupListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, hostGroupName string, parameters compute.DedicatedHostGroupUpdate) (result compute.DedicatedHostGroup, err error) + } + + var _ DedicatedHostGroupsClientAPI = (*compute.DedicatedHostGroupsClient)(nil) + // DedicatedHostsClientAPI contains the set of methods on the DedicatedHostsClient type. + type DedicatedHostsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters compute.DedicatedHost) (result compute.DedicatedHostsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string) (result compute.DedicatedHostsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, expand compute.InstanceViewTypes) (result compute.DedicatedHost, err error) + ListByHostGroup(ctx context.Context, resourceGroupName string, hostGroupName string) (result compute.DedicatedHostListResultPage, err error) + ListByHostGroupComplete(ctx context.Context, resourceGroupName string, hostGroupName string) (result compute.DedicatedHostListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters compute.DedicatedHostUpdate) (result compute.DedicatedHostsUpdateFuture, err error) + } + + var _ DedicatedHostsClientAPI = (*compute.DedicatedHostsClient)(nil) + // SSHPublicKeysClientAPI contains the set of methods on the SSHPublicKeysClient type. + type SSHPublicKeysClientAPI interface { + Create(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters compute.SSHPublicKeyResource) (result compute.SSHPublicKeyResource, err error) + Delete(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result autorest.Response, err error) + GenerateKeyPair(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result compute.SSHPublicKeyGenerateKeyPairResult, err error) + Get(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result compute.SSHPublicKeyResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.SSHPublicKeysGroupListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.SSHPublicKeysGroupListResultIterator, err error) + ListBySubscription(ctx context.Context) (result compute.SSHPublicKeysGroupListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result compute.SSHPublicKeysGroupListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters compute.SSHPublicKeyUpdateResource) (result compute.SSHPublicKeyResource, err error) + } + + var _ SSHPublicKeysClientAPI = (*compute.SSHPublicKeysClient)(nil) + // VirtualMachineExtensionImagesClientAPI contains the set of methods on the VirtualMachineExtensionImagesClient type. + type VirtualMachineExtensionImagesClientAPI interface { + Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result compute.VirtualMachineExtensionImage, err error) + ListTypes(ctx context.Context, location string, publisherName string) (result compute.ListVirtualMachineExtensionImage, err error) + ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result compute.ListVirtualMachineExtensionImage, err error) + } + + var _ VirtualMachineExtensionImagesClientAPI = (*compute.VirtualMachineExtensionImagesClient)(nil) + // VirtualMachineExtensionsClientAPI contains the set of methods on the VirtualMachineExtensionsClient type. + type VirtualMachineExtensionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters compute.VirtualMachineExtension) (result compute.VirtualMachineExtensionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result compute.VirtualMachineExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result compute.VirtualMachineExtension, err error) + List(ctx context.Context, resourceGroupName string, VMName string, expand string) (result compute.VirtualMachineExtensionsListResult, err error) + Update(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters compute.VirtualMachineExtensionUpdate) (result compute.VirtualMachineExtensionsUpdateFuture, err error) + } + + var _ VirtualMachineExtensionsClientAPI = (*compute.VirtualMachineExtensionsClient)(nil) + // VirtualMachineImagesClientAPI contains the set of methods on the VirtualMachineImagesClient type. + type VirtualMachineImagesClientAPI interface { + Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result compute.VirtualMachineImage, err error) + List(ctx context.Context, location string, publisherName string, offer string, skus string, expand string, top *int32, orderby string) (result compute.ListVirtualMachineImageResource, err error) + ListOffers(ctx context.Context, location string, publisherName string) (result compute.ListVirtualMachineImageResource, err error) + ListPublishers(ctx context.Context, location string) (result compute.ListVirtualMachineImageResource, err error) + ListSkus(ctx context.Context, location string, publisherName string, offer string) (result compute.ListVirtualMachineImageResource, err error) + } + + var _ VirtualMachineImagesClientAPI = (*compute.VirtualMachineImagesClient)(nil) + // UsageClientAPI contains the set of methods on the UsageClient type. + type UsageClientAPI interface { + List(ctx context.Context, location string) (result compute.ListUsagesResultPage, err error) + ListComplete(ctx context.Context, location string) (result compute.ListUsagesResultIterator, err error) + } + + var _ UsageClientAPI = (*compute.UsageClient)(nil) + // VirtualMachinesClientAPI contains the set of methods on the VirtualMachinesClient type. + type VirtualMachinesClientAPI interface { + AssessPatches(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesAssessPatchesFuture, err error) + Capture(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachineCaptureParameters) (result compute.VirtualMachinesCaptureFuture, err error) + ConvertToManagedDisks(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesConvertToManagedDisksFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachine) (result compute.VirtualMachinesCreateOrUpdateFuture, err error) + Deallocate(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesDeallocateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMName string, forceDeletion *bool) (result compute.VirtualMachinesDeleteFuture, err error) + Generalize(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, VMName string, expand compute.InstanceViewTypes) (result compute.VirtualMachine, err error) + InstanceView(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachineInstanceView, err error) + List(ctx context.Context, resourceGroupName string) (result compute.VirtualMachineListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result compute.VirtualMachineListResultIterator, err error) + ListAll(ctx context.Context, statusOnly string) (result compute.VirtualMachineListResultPage, err error) + ListAllComplete(ctx context.Context, statusOnly string) (result compute.VirtualMachineListResultIterator, err error) + ListAvailableSizes(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachineSizeListResult, err error) + ListByLocation(ctx context.Context, location string) (result compute.VirtualMachineListResultPage, err error) + ListByLocationComplete(ctx context.Context, location string) (result compute.VirtualMachineListResultIterator, err error) + PerformMaintenance(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesPerformMaintenanceFuture, err error) + PowerOff(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (result compute.VirtualMachinesPowerOffFuture, err error) + Reapply(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesReapplyFuture, err error) + Redeploy(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesRedeployFuture, err error) + Reimage(ctx context.Context, resourceGroupName string, VMName string, parameters *compute.VirtualMachineReimageParameters) (result compute.VirtualMachinesReimageFuture, err error) + Restart(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesRestartFuture, err error) + RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, VMName string, sasURIExpirationTimeInMinutes *int32) (result compute.RetrieveBootDiagnosticsDataResult, err error) + SimulateEviction(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) + Start(ctx context.Context, resourceGroupName string, VMName string) (result compute.VirtualMachinesStartFuture, err error) + Update(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachineUpdate) (result compute.VirtualMachinesUpdateFuture, err error) + } + + var _ VirtualMachinesClientAPI = (*compute.VirtualMachinesClient)(nil) + // VirtualMachineSizesClientAPI contains the set of methods on the VirtualMachineSizesClient type. + type VirtualMachineSizesClientAPI interface { + List(ctx context.Context, location string) (result compute.VirtualMachineSizeListResult, err error) + } + + var _ VirtualMachineSizesClientAPI = (*compute.VirtualMachineSizesClient)(nil) + // ImagesClientAPI contains the set of methods on the ImagesClient type. + type ImagesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters compute.Image) (result compute.ImagesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, imageName string) (result compute.ImagesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result compute.Image, err error) + List(ctx context.Context) (result compute.ImageListResultPage, err error) + ListComplete(ctx context.Context) (result compute.ImageListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.ImageListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.ImageListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, imageName string, parameters compute.ImageUpdate) (result compute.ImagesUpdateFuture, err error) + } + + var _ ImagesClientAPI = (*compute.ImagesClient)(nil) + // VirtualMachineScaleSetsClientAPI contains the set of methods on the VirtualMachineScaleSetsClient type. + type VirtualMachineScaleSetsClientAPI interface { + ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.VMScaleSetConvertToSinglePlacementGroupInput) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSet) (result compute.VirtualMachineScaleSetsCreateOrUpdateFuture, err error) + Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsDeallocateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetsDeleteFuture, err error) + DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) (result compute.VirtualMachineScaleSetsDeleteInstancesFuture, err error) + ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, VMScaleSetName string, platformUpdateDomain int32) (result compute.RecoveryWalkResponse, err error) + Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSet, err error) + GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetInstanceView, err error) + GetOSUpgradeHistory(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetListOSUpgradeHistoryPage, err error) + GetOSUpgradeHistoryComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetListOSUpgradeHistoryIterator, err error) + List(ctx context.Context, resourceGroupName string) (result compute.VirtualMachineScaleSetListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result compute.VirtualMachineScaleSetListResultIterator, err error) + ListAll(ctx context.Context) (result compute.VirtualMachineScaleSetListWithLinkResultPage, err error) + ListAllComplete(ctx context.Context) (result compute.VirtualMachineScaleSetListWithLinkResultIterator, err error) + ListSkus(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetListSkusResultPage, err error) + ListSkusComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetListSkusResultIterator, err error) + PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsPerformMaintenanceFuture, err error) + PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs, skipShutdown *bool) (result compute.VirtualMachineScaleSetsPowerOffFuture, err error) + Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsRedeployFuture, err error) + Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMScaleSetReimageInput *compute.VirtualMachineScaleSetReimageParameters) (result compute.VirtualMachineScaleSetsReimageFuture, err error) + ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsReimageAllFuture, err error) + Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsRestartFuture, err error) + SetOrchestrationServiceState(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.OrchestrationServiceStateInput) (result compute.VirtualMachineScaleSetsSetOrchestrationServiceStateFuture, err error) + Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *compute.VirtualMachineScaleSetVMInstanceIDs) (result compute.VirtualMachineScaleSetsStartFuture, err error) + Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSetUpdate) (result compute.VirtualMachineScaleSetsUpdateFuture, err error) + UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs compute.VirtualMachineScaleSetVMInstanceRequiredIDs) (result compute.VirtualMachineScaleSetsUpdateInstancesFuture, err error) + } + + var _ VirtualMachineScaleSetsClientAPI = (*compute.VirtualMachineScaleSetsClient)(nil) + // VirtualMachineScaleSetExtensionsClientAPI contains the set of methods on the VirtualMachineScaleSetExtensionsClient type. + type VirtualMachineScaleSetExtensionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters compute.VirtualMachineScaleSetExtension) (result compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (result compute.VirtualMachineScaleSetExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result compute.VirtualMachineScaleSetExtension, err error) + List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetExtensionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetExtensionListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters compute.VirtualMachineScaleSetExtensionUpdate) (result compute.VirtualMachineScaleSetExtensionsUpdateFuture, err error) + } + + var _ VirtualMachineScaleSetExtensionsClientAPI = (*compute.VirtualMachineScaleSetExtensionsClient)(nil) + // VirtualMachineScaleSetRollingUpgradesClientAPI contains the set of methods on the VirtualMachineScaleSetRollingUpgradesClient type. + type VirtualMachineScaleSetRollingUpgradesClientAPI interface { + Cancel(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) + GetLatest(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.RollingUpgradeStatusInfo, err error) + StartExtensionUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) + StartOSUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) + } + + var _ VirtualMachineScaleSetRollingUpgradesClientAPI = (*compute.VirtualMachineScaleSetRollingUpgradesClient)(nil) + // VirtualMachineScaleSetVMExtensionsClientAPI contains the set of methods on the VirtualMachineScaleSetVMExtensionsClient type. + type VirtualMachineScaleSetVMExtensionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters compute.VirtualMachineScaleSetVMExtension) (result compute.VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string) (result compute.VirtualMachineScaleSetVMExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, expand string) (result compute.VirtualMachineScaleSetVMExtension, err error) + List(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand string) (result compute.VirtualMachineScaleSetVMExtensionsListResult, err error) + Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters compute.VirtualMachineScaleSetVMExtensionUpdate) (result compute.VirtualMachineScaleSetVMExtensionsUpdateFuture, err error) + } + + var _ VirtualMachineScaleSetVMExtensionsClientAPI = (*compute.VirtualMachineScaleSetVMExtensionsClient)(nil) + // VirtualMachineScaleSetVMsClientAPI contains the set of methods on the VirtualMachineScaleSetVMsClient type. + type VirtualMachineScaleSetVMsClientAPI interface { + Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsDeallocateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand compute.InstanceViewTypes) (result compute.VirtualMachineScaleSetVM, err error) + GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMInstanceView, err error) + List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result compute.VirtualMachineScaleSetVMListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result compute.VirtualMachineScaleSetVMListResultIterator, err error) + PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture, err error) + PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, skipShutdown *bool) (result compute.VirtualMachineScaleSetVMsPowerOffFuture, err error) + Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsRedeployFuture, err error) + Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMScaleSetVMReimageInput *compute.VirtualMachineScaleSetVMReimageParameters) (result compute.VirtualMachineScaleSetVMsReimageFuture, err error) + ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsReimageAllFuture, err error) + Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsRestartFuture, err error) + RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, sasURIExpirationTimeInMinutes *int32) (result compute.RetrieveBootDiagnosticsDataResult, err error) + SimulateEviction(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result autorest.Response, err error) + Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMsStartFuture, err error) + Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters compute.VirtualMachineScaleSetVM) (result compute.VirtualMachineScaleSetVMsUpdateFuture, err error) + } + + var _ VirtualMachineScaleSetVMsClientAPI = (*compute.VirtualMachineScaleSetVMsClient)(nil) + // LogAnalyticsClientAPI contains the set of methods on the LogAnalyticsClient type. + type LogAnalyticsClientAPI interface { + ExportRequestRateByInterval(ctx context.Context, parameters compute.RequestRateByIntervalInput, location string) (result compute.LogAnalyticsExportRequestRateByIntervalFuture, err error) + ExportThrottledRequests(ctx context.Context, parameters compute.ThrottledRequestsInput, location string) (result compute.LogAnalyticsExportThrottledRequestsFuture, err error) + } + + var _ LogAnalyticsClientAPI = (*compute.LogAnalyticsClient)(nil) + // DisksClientAPI contains the set of methods on the DisksClient type. + type DisksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk compute.Disk) (result compute.DisksCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, diskName string) (result compute.DisksDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, diskName string) (result compute.Disk, err error) + GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData compute.GrantAccessData) (result compute.DisksGrantAccessFuture, err error) + List(ctx context.Context) (result compute.DiskListPage, err error) + ListComplete(ctx context.Context) (result compute.DiskListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.DiskListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.DiskListIterator, err error) + RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result compute.DisksRevokeAccessFuture, err error) + Update(ctx context.Context, resourceGroupName string, diskName string, disk compute.DiskUpdate) (result compute.DisksUpdateFuture, err error) + } + + var _ DisksClientAPI = (*compute.DisksClient)(nil) + // SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. + type SnapshotsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot compute.Snapshot) (result compute.SnapshotsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result compute.SnapshotsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, snapshotName string) (result compute.Snapshot, err error) + GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData compute.GrantAccessData) (result compute.SnapshotsGrantAccessFuture, err error) + List(ctx context.Context) (result compute.SnapshotListPage, err error) + ListComplete(ctx context.Context) (result compute.SnapshotListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.SnapshotListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.SnapshotListIterator, err error) + RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result compute.SnapshotsRevokeAccessFuture, err error) + Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot compute.SnapshotUpdate) (result compute.SnapshotsUpdateFuture, err error) + } + + var _ SnapshotsClientAPI = (*compute.SnapshotsClient)(nil) + // DiskEncryptionSetsClientAPI contains the set of methods on the DiskEncryptionSetsClient type. + type DiskEncryptionSetsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet compute.DiskEncryptionSet) (result compute.DiskEncryptionSetsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (result compute.DiskEncryptionSetsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (result compute.DiskEncryptionSet, err error) + List(ctx context.Context) (result compute.DiskEncryptionSetListPage, err error) + ListComplete(ctx context.Context) (result compute.DiskEncryptionSetListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result compute.DiskEncryptionSetListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result compute.DiskEncryptionSetListIterator, err error) + Update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet compute.DiskEncryptionSetUpdate) (result compute.DiskEncryptionSetsUpdateFuture, err error) + } + + var _ DiskEncryptionSetsClientAPI = (*compute.DiskEncryptionSetsClient)(nil) diff --git a/profiles/2020-09-01/compute/mgmt/compute/dedicatedhostgroups.go b/profiles/2020-09-01/compute/mgmt/compute/dedicatedhostgroups.go new file mode 100644 index 000000000000..ac41f4d6f8f4 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/dedicatedhostgroups.go @@ -0,0 +1,592 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// DedicatedHostGroupsClient is the compute Client +type DedicatedHostGroupsClient struct { + BaseClient +} +// NewDedicatedHostGroupsClient creates an instance of the DedicatedHostGroupsClient client. +func NewDedicatedHostGroupsClient(subscriptionID string) DedicatedHostGroupsClient { + return NewDedicatedHostGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDedicatedHostGroupsClientWithBaseURI creates an instance of the DedicatedHostGroupsClient 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 NewDedicatedHostGroupsClientWithBaseURI(baseURI string, subscriptionID string) DedicatedHostGroupsClient { + return DedicatedHostGroupsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups +// please see [Dedicated Host Documentation] (https://go.microsoft.com/fwlink/?linkid=2082596) + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // parameters - parameters supplied to the Create Dedicated Host Group. +func (client DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup) (result DedicatedHostGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.CreateOrUpdate") + 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: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.DedicatedHostGroupProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.DedicatedHostGroupProperties.PlatformFaultDomainCount", Name: validation.Null, Rule: true , + Chain: []validation.Constraint{ {Target: "parameters.DedicatedHostGroupProperties.PlatformFaultDomainCount", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil }, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.DedicatedHostGroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client DedicatedHostGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client DedicatedHostGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client DedicatedHostGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedHostGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete delete a dedicated host group. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. +func (client DedicatedHostGroupsClient) Delete(ctx context.Context, resourceGroupName string, hostGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, hostGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Delete", nil , "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client DedicatedHostGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client DedicatedHostGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client DedicatedHostGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get retrieves information about a dedicated host group. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // expand - the expand expression to apply on the operation. The response shows the list of instance view of + // the dedicated hosts under the dedicated host group. +func (client DedicatedHostGroupsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, expand InstanceViewTypes) (result DedicatedHostGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, hostGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client DedicatedHostGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostGroupName string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}",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 DedicatedHostGroupsClient) 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 DedicatedHostGroupsClient) GetResponder(resp *http.Response) (result DedicatedHostGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListByResourceGroup lists all of the dedicated host groups in the specified resource group. Use the nextLink +// property in the response to get the next page of dedicated host groups. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client DedicatedHostGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DedicatedHostGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dhglr.Response.Response != nil { + sc = result.dhglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dhglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dhglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.dhglr.hasNextLink() && result.dhglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client DedicatedHostGroupsClient) 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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups",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 DedicatedHostGroupsClient) 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 DedicatedHostGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result DedicatedHostGroupListResult, 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 DedicatedHostGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedHostGroupListResult) (result DedicatedHostGroupListResult, err error) { + req, err := lastResults.dedicatedHostGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "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, "compute.DedicatedHostGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client DedicatedHostGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DedicatedHostGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.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 lists all of the dedicated host groups in the subscription. Use the nextLink property in the +// response to get the next page of dedicated host groups. +func (client DedicatedHostGroupsClient) ListBySubscription(ctx context.Context) (result DedicatedHostGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.ListBySubscription") + defer func() { + sc := -1 + if result.dhglr.Response.Response != nil { + sc = result.dhglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListBySubscription", nil , "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dhglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dhglr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "ListBySubscription", resp, "Failure responding to request") + } + if result.dhglr.hasNextLink() && result.dhglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListBySubscriptionPreparer prepares the ListBySubscription request. + func (client DedicatedHostGroupsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups",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 DedicatedHostGroupsClient) 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 DedicatedHostGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result DedicatedHostGroupListResult, 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 DedicatedHostGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedHostGroupListResult) (result DedicatedHostGroupListResult, err error) { + req, err := lastResults.dedicatedHostGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "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, "compute.DedicatedHostGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. + func (client DedicatedHostGroupsClient) ListBySubscriptionComplete(ctx context.Context) (result DedicatedHostGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.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 update an dedicated host group. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // parameters - parameters supplied to the Update Dedicated Host Group operation. +func (client DedicatedHostGroupsClient) Update(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate) (result DedicatedHostGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, hostGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Update", nil , "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostGroupsClient", "Update", resp, "Failure responding to request") + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client DedicatedHostGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/hostGroups/{hostGroupName}",pathParameters), +autorest.WithJSON(parameters), +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 DedicatedHostGroupsClient) 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 DedicatedHostGroupsClient) UpdateResponder(resp *http.Response) (result DedicatedHostGroup, 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/profiles/2020-09-01/compute/mgmt/compute/dedicatedhosts.go b/profiles/2020-09-01/compute/mgmt/compute/dedicatedhosts.go new file mode 100644 index 000000000000..aeafc9b20486 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/dedicatedhosts.go @@ -0,0 +1,488 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// DedicatedHostsClient is the compute Client +type DedicatedHostsClient struct { + BaseClient +} +// NewDedicatedHostsClient creates an instance of the DedicatedHostsClient client. +func NewDedicatedHostsClient(subscriptionID string) DedicatedHostsClient { + return NewDedicatedHostsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDedicatedHostsClientWithBaseURI creates an instance of the DedicatedHostsClient 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 NewDedicatedHostsClientWithBaseURI(baseURI string, subscriptionID string) DedicatedHostsClient { + return DedicatedHostsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate create or update a dedicated host . + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // hostName - the name of the dedicated host . + // parameters - parameters supplied to the Create Dedicated Host. +func (client DedicatedHostsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost) (result DedicatedHostsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.DedicatedHostProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.DedicatedHostProperties.PlatformFaultDomain", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.DedicatedHostProperties.PlatformFaultDomain", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil }, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.DedicatedHostsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostGroupName, hostName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client DedicatedHostsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "hostName": autorest.Encode("path",hostName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client DedicatedHostsClient) CreateOrUpdateSender(req *http.Request) (future DedicatedHostsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client DedicatedHostsClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedHost, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete delete a dedicated host. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // hostName - the name of the dedicated host. +func (client DedicatedHostsClient) Delete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string) (result DedicatedHostsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, hostGroupName, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client DedicatedHostsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "hostName": autorest.Encode("path",hostName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client DedicatedHostsClient) DeleteSender(req *http.Request) (future DedicatedHostsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client DedicatedHostsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get retrieves information about a dedicated host. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // hostName - the name of the dedicated host. + // expand - the expand expression to apply on the operation. +func (client DedicatedHostsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, expand InstanceViewTypes) (result DedicatedHost, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, hostGroupName, hostName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client DedicatedHostsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "hostName": autorest.Encode("path",hostName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}",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 DedicatedHostsClient) 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 DedicatedHostsClient) GetResponder(resp *http.Response) (result DedicatedHost, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListByHostGroup lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property in +// the response to get the next page of dedicated hosts. + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. +func (client DedicatedHostsClient) ListByHostGroup(ctx context.Context, resourceGroupName string, hostGroupName string) (result DedicatedHostListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.ListByHostGroup") + defer func() { + sc := -1 + if result.dhlr.Response.Response != nil { + sc = result.dhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByHostGroupNextResults + req, err := client.ListByHostGroupPreparer(ctx, resourceGroupName, hostGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "ListByHostGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByHostGroupSender(req) + if err != nil { + result.dhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "ListByHostGroup", resp, "Failure sending request") + return + } + + result.dhlr, err = client.ListByHostGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "ListByHostGroup", resp, "Failure responding to request") + } + if result.dhlr.hasNextLink() && result.dhlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByHostGroupPreparer prepares the ListByHostGroup request. + func (client DedicatedHostsClient) ListByHostGroupPreparer(ctx context.Context, resourceGroupName string, hostGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListByHostGroupSender sends the ListByHostGroup request. The method will close the + // http.Response Body if it receives an error. + func (client DedicatedHostsClient) ListByHostGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListByHostGroupResponder handles the response to the ListByHostGroup request. The method always + // closes the http.Response Body. + func (client DedicatedHostsClient) ListByHostGroupResponder(resp *http.Response) (result DedicatedHostListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listByHostGroupNextResults retrieves the next set of results, if any. + func (client DedicatedHostsClient) listByHostGroupNextResults(ctx context.Context, lastResults DedicatedHostListResult) (result DedicatedHostListResult, err error) { + req, err := lastResults.dedicatedHostListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "listByHostGroupNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByHostGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "listByHostGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByHostGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "listByHostGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByHostGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client DedicatedHostsClient) ListByHostGroupComplete(ctx context.Context, resourceGroupName string, hostGroupName string) (result DedicatedHostListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.ListByHostGroup") + 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.ListByHostGroup(ctx, resourceGroupName, hostGroupName) + return + } + +// Update update an dedicated host . + // Parameters: + // resourceGroupName - the name of the resource group. + // hostGroupName - the name of the dedicated host group. + // hostName - the name of the dedicated host . + // parameters - parameters supplied to the Update Dedicated Host operation. +func (client DedicatedHostsClient) Update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate) (result DedicatedHostsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, hostGroupName, hostName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client DedicatedHostsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "hostGroupName": autorest.Encode("path",hostGroupName), + "hostName": autorest.Encode("path",hostName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/hostGroups/{hostGroupName}/hosts/{hostName}",pathParameters), +autorest.WithJSON(parameters), +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 DedicatedHostsClient) UpdateSender(req *http.Request) (future DedicatedHostsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client DedicatedHostsClient) UpdateResponder(resp *http.Response) (result DedicatedHost, 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/profiles/2020-09-01/compute/mgmt/compute/diskencryptionsets.go b/profiles/2020-09-01/compute/mgmt/compute/diskencryptionsets.go new file mode 100644 index 000000000000..8edf507b9f22 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/diskencryptionsets.go @@ -0,0 +1,595 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// DiskEncryptionSetsClient is the compute Client +type DiskEncryptionSetsClient struct { + BaseClient +} +// NewDiskEncryptionSetsClient creates an instance of the DiskEncryptionSetsClient client. +func NewDiskEncryptionSetsClient(subscriptionID string) DiskEncryptionSetsClient { + return NewDiskEncryptionSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiskEncryptionSetsClientWithBaseURI creates an instance of the DiskEncryptionSetsClient 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 NewDiskEncryptionSetsClientWithBaseURI(baseURI string, subscriptionID string) DiskEncryptionSetsClient { + return DiskEncryptionSetsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate creates or updates a disk encryption set + // Parameters: + // resourceGroupName - the name of the resource group. + // diskEncryptionSetName - the name of the disk encryption set that is being created. The name can't be changed + // after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The + // maximum name length is 80 characters. + // diskEncryptionSet - disk encryption set object supplied in the body of the Put disk encryption set + // operation. +func (client DiskEncryptionSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet) (result DiskEncryptionSetsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: diskEncryptionSet, + Constraints: []validation.Constraint{ {Target: "diskEncryptionSet.EncryptionSetProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "diskEncryptionSet.EncryptionSetProperties.ActiveKey", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "diskEncryptionSet.EncryptionSetProperties.ActiveKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "diskEncryptionSet.EncryptionSetProperties.ActiveKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.DiskEncryptionSetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client DiskEncryptionSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskEncryptionSetName": autorest.Encode("path",diskEncryptionSetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",pathParameters), +autorest.WithJSON(diskEncryptionSet), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client DiskEncryptionSetsClient) CreateOrUpdateSender(req *http.Request) (future DiskEncryptionSetsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client DiskEncryptionSetsClient) CreateOrUpdateResponder(resp *http.Response) (result DiskEncryptionSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete deletes a disk encryption set. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskEncryptionSetName - the name of the disk encryption set that is being created. The name can't be changed + // after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The + // maximum name length is 80 characters. +func (client DiskEncryptionSetsClient) Delete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (result DiskEncryptionSetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, diskEncryptionSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client DiskEncryptionSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskEncryptionSetName": autorest.Encode("path",diskEncryptionSetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client DiskEncryptionSetsClient) DeleteSender(req *http.Request) (future DiskEncryptionSetsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client DiskEncryptionSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get gets information about a disk encryption set. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskEncryptionSetName - the name of the disk encryption set that is being created. The name can't be changed + // after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The + // maximum name length is 80 characters. +func (client DiskEncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (result DiskEncryptionSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, diskEncryptionSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client DiskEncryptionSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, diskEncryptionSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskEncryptionSetName": autorest.Encode("path",diskEncryptionSetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",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 DiskEncryptionSetsClient) 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 DiskEncryptionSetsClient) GetResponder(resp *http.Response) (result DiskEncryptionSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List lists all the disk encryption sets under a subscription. +func (client DiskEncryptionSetsClient) List(ctx context.Context) (result DiskEncryptionSetListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.List") + defer func() { + sc := -1 + if result.desl.Response.Response != nil { + sc = result.desl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.desl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "List", resp, "Failure sending request") + return + } + + result.desl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "List", resp, "Failure responding to request") + } + if result.desl.hasNextLink() && result.desl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client DiskEncryptionSetsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets",pathParameters), +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 DiskEncryptionSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client DiskEncryptionSetsClient) ListResponder(resp *http.Response) (result DiskEncryptionSetList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client DiskEncryptionSetsClient) listNextResults(ctx context.Context, lastResults DiskEncryptionSetList) (result DiskEncryptionSetList, err error) { + req, err := lastResults.diskEncryptionSetListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client DiskEncryptionSetsClient) ListComplete(ctx context.Context) (result DiskEncryptionSetListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.List") + 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.List(ctx) + return + } + +// ListByResourceGroup lists all the disk encryption sets under a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client DiskEncryptionSetsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskEncryptionSetListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.desl.Response.Response != nil { + sc = result.desl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.desl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.desl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.desl.hasNextLink() && result.desl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client DiskEncryptionSetsClient) 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 = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets",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 DiskEncryptionSetsClient) 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 DiskEncryptionSetsClient) ListByResourceGroupResponder(resp *http.Response) (result DiskEncryptionSetList, 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 DiskEncryptionSetsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DiskEncryptionSetList) (result DiskEncryptionSetList, err error) { + req, err := lastResults.diskEncryptionSetListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "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, "compute.DiskEncryptionSetsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client DiskEncryptionSetsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskEncryptionSetListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.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 + } + +// Update updates (patches) a disk encryption set. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskEncryptionSetName - the name of the disk encryption set that is being created. The name can't be changed + // after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The + // maximum name length is 80 characters. + // diskEncryptionSet - disk encryption set object supplied in the body of the Patch disk encryption set + // operation. +func (client DiskEncryptionSetsClient) Update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate) (result DiskEncryptionSetsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client DiskEncryptionSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskEncryptionSetName": autorest.Encode("path",diskEncryptionSetName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + 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.Compute/diskEncryptionSets/{diskEncryptionSetName}",pathParameters), +autorest.WithJSON(diskEncryptionSet), +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 DiskEncryptionSetsClient) UpdateSender(req *http.Request) (future DiskEncryptionSetsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client DiskEncryptionSetsClient) UpdateResponder(resp *http.Response) (result DiskEncryptionSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/disks.go b/profiles/2020-09-01/compute/mgmt/compute/disks.go new file mode 100644 index 000000000000..dbfd292bc25f --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/disks.go @@ -0,0 +1,759 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// DisksClient is the compute Client +type DisksClient struct { + BaseClient +} +// NewDisksClient creates an instance of the DisksClient client. +func NewDisksClient(subscriptionID string) DisksClient { + return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisksClientWithBaseURI creates an instance of the DisksClient 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 NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { + return DisksClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate creates or updates a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. + // disk - disk object supplied in the body of the Put disk operation. +func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: disk, + Constraints: []validation.Constraint{ {Target: "disk.DiskProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "disk.DiskProperties.CreationData", Name: validation.Null, Rule: true , + Chain: []validation.Constraint{ {Target: "disk.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "disk.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}, + {Target: "disk.DiskProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "disk.DiskProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + disk.ManagedBy = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}",pathParameters), +autorest.WithJSON(disk), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete deletes a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. +func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get gets information about a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. +func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}",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 DisksClient) 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 DisksClient) GetResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// GrantAccess grants access to a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. + // grantAccessData - access data object supplied in the body of the get disk access operation. +func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.GrantAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: grantAccessData, + Constraints: []validation.Constraint{ {Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error()) + } + + req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", nil , "Failure preparing request") + return + } + + result, err = client.GrantAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", result.Response(), "Failure sending request") + return + } + + return +} + + // GrantAccessPreparer prepares the GrantAccess request. + func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess",pathParameters), +autorest.WithJSON(grantAccessData), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GrantAccessSender sends the GrantAccess request. The method will close the + // http.Response Body if it receives an error. + func (client DisksClient) GrantAccessSender(req *http.Request) (future DisksGrantAccessFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // GrantAccessResponder handles the response to the GrantAccess request. The method always + // closes the http.Response Body. + func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List lists all the disks under a subscription. +func (client DisksClient) List(ctx context.Context) (result DiskListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.List") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure sending request") + return + } + + result.dl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure responding to request") + } + if result.dl.hasNextLink() && result.dl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks",pathParameters), +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 DisksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client DisksClient) ListResponder(resp *http.Response) (result DiskList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client DisksClient) listNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) { + req, err := lastResults.diskListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.List") + 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.List(ctx) + return + } + +// ListByResourceGroup lists all the disks under a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.dl.hasNextLink() && result.dl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client DisksClient) 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 = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks",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 DisksClient) 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 DisksClient) ListByResourceGroupResponder(resp *http.Response) (result DiskList, 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 DisksClient) listByResourceGroupNextResults(ctx context.Context, lastResults DiskList) (result DiskList, err error) { + req, err := lastResults.diskListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.DisksClient", "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, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.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 + } + +// RevokeAccess revokes access to a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. +func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.RevokeAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", nil , "Failure preparing request") + return + } + + result, err = client.RevokeAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", result.Response(), "Failure sending request") + return + } + + return +} + + // RevokeAccessPreparer prepares the RevokeAccess request. + func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RevokeAccessSender sends the RevokeAccess request. The method will close the + // http.Response Body if it receives an error. + func (client DisksClient) RevokeAccessSender(req *http.Request) (future DisksRevokeAccessFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RevokeAccessResponder handles the response to the RevokeAccess request. The method always + // closes the http.Response Body. + func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Update updates (patches) a disk. + // Parameters: + // resourceGroupName - the name of the resource group. + // diskName - the name of the managed disk that is being created. The name can't be changed after the disk is + // created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + // characters. + // disk - disk object supplied in the body of the Patch disk operation. +func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DisksClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "diskName": autorest.Encode("path",diskName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + 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.Compute/disks/{diskName}",pathParameters), +autorest.WithJSON(disk), +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 DisksClient) UpdateSender(req *http.Request) (future DisksUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/enums.go b/profiles/2020-09-01/compute/mgmt/compute/enums.go new file mode 100644 index 000000000000..883219e552bf --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/enums.go @@ -0,0 +1,1120 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + + // AccessLevel enumerates the values for access level. + type AccessLevel string + + const ( + // None ... + None AccessLevel = "None" + // Read ... + Read AccessLevel = "Read" + // Write ... + Write AccessLevel = "Write" + ) + // PossibleAccessLevelValues returns an array of possible values for the AccessLevel const type. + func PossibleAccessLevelValues() []AccessLevel { + return []AccessLevel{None,Read,Write} + } + + // AvailabilitySetSkuTypes enumerates the values for availability set sku types. + type AvailabilitySetSkuTypes string + + const ( + // Aligned ... + Aligned AvailabilitySetSkuTypes = "Aligned" + // Classic ... + Classic AvailabilitySetSkuTypes = "Classic" + ) + // PossibleAvailabilitySetSkuTypesValues returns an array of possible values for the AvailabilitySetSkuTypes const type. + func PossibleAvailabilitySetSkuTypesValues() []AvailabilitySetSkuTypes { + return []AvailabilitySetSkuTypes{Aligned,Classic} + } + + // CachingTypes enumerates the values for caching types. + type CachingTypes string + + const ( + // CachingTypesNone ... + CachingTypesNone CachingTypes = "None" + // CachingTypesReadOnly ... + CachingTypesReadOnly CachingTypes = "ReadOnly" + // CachingTypesReadWrite ... + CachingTypesReadWrite CachingTypes = "ReadWrite" + ) + // PossibleCachingTypesValues returns an array of possible values for the CachingTypes const type. + func PossibleCachingTypesValues() []CachingTypes { + return []CachingTypes{CachingTypesNone,CachingTypesReadOnly,CachingTypesReadWrite} + } + + // ComponentNames enumerates the values for component names. + type ComponentNames string + + const ( + // MicrosoftWindowsShellSetup ... + MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup" + ) + // PossibleComponentNamesValues returns an array of possible values for the ComponentNames const type. + func PossibleComponentNamesValues() []ComponentNames { + return []ComponentNames{MicrosoftWindowsShellSetup} + } + + // DedicatedHostLicenseTypes enumerates the values for dedicated host license types. + type DedicatedHostLicenseTypes string + + const ( + // DedicatedHostLicenseTypesNone ... + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + // DedicatedHostLicenseTypesWindowsServerHybrid ... + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + // DedicatedHostLicenseTypesWindowsServerPerpetual ... + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" + ) + // PossibleDedicatedHostLicenseTypesValues returns an array of possible values for the DedicatedHostLicenseTypes const type. + func PossibleDedicatedHostLicenseTypesValues() []DedicatedHostLicenseTypes { + return []DedicatedHostLicenseTypes{DedicatedHostLicenseTypesNone,DedicatedHostLicenseTypesWindowsServerHybrid,DedicatedHostLicenseTypesWindowsServerPerpetual} + } + + // DiffDiskOptions enumerates the values for diff disk options. + type DiffDiskOptions string + + const ( + // Local ... + Local DiffDiskOptions = "Local" + ) + // PossibleDiffDiskOptionsValues returns an array of possible values for the DiffDiskOptions const type. + func PossibleDiffDiskOptionsValues() []DiffDiskOptions { + return []DiffDiskOptions{Local} + } + + // DiffDiskPlacement enumerates the values for diff disk placement. + type DiffDiskPlacement string + + const ( + // CacheDisk ... + CacheDisk DiffDiskPlacement = "CacheDisk" + // ResourceDisk ... + ResourceDisk DiffDiskPlacement = "ResourceDisk" + ) + // PossibleDiffDiskPlacementValues returns an array of possible values for the DiffDiskPlacement const type. + func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { + return []DiffDiskPlacement{CacheDisk,ResourceDisk} + } + + // DiskCreateOption enumerates the values for disk create option. + type DiskCreateOption string + + const ( + // Attach Disk will be attached to a VM. + Attach DiskCreateOption = "Attach" + // Copy Create a new disk or snapshot by copying from a disk or snapshot specified by the given + // sourceResourceId. + Copy DiskCreateOption = "Copy" + // Empty Create an empty data disk of a size given by diskSizeGB. + Empty DiskCreateOption = "Empty" + // FromImage Create a new disk from a platform image specified by the given imageReference. + FromImage DiskCreateOption = "FromImage" + // Import Create a disk by importing from a blob specified by a sourceUri in a storage account specified by + // storageAccountId. + Import DiskCreateOption = "Import" + // Restore Create a new disk by copying from a backup recovery point. + Restore DiskCreateOption = "Restore" + // Upload Create a new disk by obtaining a write token and using it to directly upload the contents of the + // disk. + Upload DiskCreateOption = "Upload" + ) + // PossibleDiskCreateOptionValues returns an array of possible values for the DiskCreateOption const type. + func PossibleDiskCreateOptionValues() []DiskCreateOption { + return []DiskCreateOption{Attach,Copy,Empty,FromImage,Import,Restore,Upload} + } + + // DiskCreateOptionTypes enumerates the values for disk create option types. + type DiskCreateOptionTypes string + + const ( + // DiskCreateOptionTypesAttach ... + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + // DiskCreateOptionTypesEmpty ... + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + // DiskCreateOptionTypesFromImage ... + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + ) + // PossibleDiskCreateOptionTypesValues returns an array of possible values for the DiskCreateOptionTypes const type. + func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { + return []DiskCreateOptionTypes{DiskCreateOptionTypesAttach,DiskCreateOptionTypesEmpty,DiskCreateOptionTypesFromImage} + } + + // DiskEncryptionSetIdentityType enumerates the values for disk encryption set identity type. + type DiskEncryptionSetIdentityType string + + const ( + // SystemAssigned ... + SystemAssigned DiskEncryptionSetIdentityType = "SystemAssigned" + ) + // PossibleDiskEncryptionSetIdentityTypeValues returns an array of possible values for the DiskEncryptionSetIdentityType const type. + func PossibleDiskEncryptionSetIdentityTypeValues() []DiskEncryptionSetIdentityType { + return []DiskEncryptionSetIdentityType{SystemAssigned} + } + + // DiskState enumerates the values for disk state. + type DiskState string + + const ( + // ActiveSAS The disk currently has an Active SAS Uri associated with it. + ActiveSAS DiskState = "ActiveSAS" + // ActiveUpload A disk is created for upload and a write token has been issued for uploading to it. + ActiveUpload DiskState = "ActiveUpload" + // Attached The disk is currently mounted to a running VM. + Attached DiskState = "Attached" + // ReadyToUpload A disk is ready to be created by upload by requesting a write token. + ReadyToUpload DiskState = "ReadyToUpload" + // Reserved The disk is mounted to a stopped-deallocated VM + Reserved DiskState = "Reserved" + // Unattached The disk is not being used and can be attached to a VM. + Unattached DiskState = "Unattached" + ) + // PossibleDiskStateValues returns an array of possible values for the DiskState const type. + func PossibleDiskStateValues() []DiskState { + return []DiskState{ActiveSAS,ActiveUpload,Attached,ReadyToUpload,Reserved,Unattached} + } + + // DiskStorageAccountTypes enumerates the values for disk storage account types. + type DiskStorageAccountTypes string + + const ( + // PremiumLRS Premium SSD locally redundant storage. Best for production and performance sensitive + // workloads. + PremiumLRS DiskStorageAccountTypes = "Premium_LRS" + // StandardLRS Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent + // access. + StandardLRS DiskStorageAccountTypes = "Standard_LRS" + // StandardSSDLRS Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + // applications and dev/test. + StandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS" + // UltraSSDLRS Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top + // tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. + UltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS" + ) + // PossibleDiskStorageAccountTypesValues returns an array of possible values for the DiskStorageAccountTypes const type. + func PossibleDiskStorageAccountTypesValues() []DiskStorageAccountTypes { + return []DiskStorageAccountTypes{PremiumLRS,StandardLRS,StandardSSDLRS,UltraSSDLRS} + } + + // EncryptionType enumerates the values for encryption type. + type EncryptionType string + + const ( + // EncryptionAtRestWithCustomerKey Disk is encrypted with Customer managed key at rest. + EncryptionAtRestWithCustomerKey EncryptionType = "EncryptionAtRestWithCustomerKey" + // EncryptionAtRestWithPlatformKey Disk is encrypted with XStore managed key at rest. It is the default + // encryption type. + EncryptionAtRestWithPlatformKey EncryptionType = "EncryptionAtRestWithPlatformKey" + ) + // PossibleEncryptionTypeValues returns an array of possible values for the EncryptionType const type. + func PossibleEncryptionTypeValues() []EncryptionType { + return []EncryptionType{EncryptionAtRestWithCustomerKey,EncryptionAtRestWithPlatformKey} + } + + // HyperVGeneration enumerates the values for hyper v generation. + type HyperVGeneration string + + const ( + // V1 ... + V1 HyperVGeneration = "V1" + // V2 ... + V2 HyperVGeneration = "V2" + ) + // PossibleHyperVGenerationValues returns an array of possible values for the HyperVGeneration const type. + func PossibleHyperVGenerationValues() []HyperVGeneration { + return []HyperVGeneration{V1,V2} + } + + // HyperVGenerationType enumerates the values for hyper v generation type. + type HyperVGenerationType string + + const ( + // HyperVGenerationTypeV1 ... + HyperVGenerationTypeV1 HyperVGenerationType = "V1" + // HyperVGenerationTypeV2 ... + HyperVGenerationTypeV2 HyperVGenerationType = "V2" + ) + // PossibleHyperVGenerationTypeValues returns an array of possible values for the HyperVGenerationType const type. + func PossibleHyperVGenerationTypeValues() []HyperVGenerationType { + return []HyperVGenerationType{HyperVGenerationTypeV1,HyperVGenerationTypeV2} + } + + // HyperVGenerationTypes enumerates the values for hyper v generation types. + type HyperVGenerationTypes string + + const ( + // HyperVGenerationTypesV1 ... + HyperVGenerationTypesV1 HyperVGenerationTypes = "V1" + // HyperVGenerationTypesV2 ... + HyperVGenerationTypesV2 HyperVGenerationTypes = "V2" + ) + // PossibleHyperVGenerationTypesValues returns an array of possible values for the HyperVGenerationTypes const type. + func PossibleHyperVGenerationTypesValues() []HyperVGenerationTypes { + return []HyperVGenerationTypes{HyperVGenerationTypesV1,HyperVGenerationTypesV2} + } + + // InGuestPatchMode enumerates the values for in guest patch mode. + type InGuestPatchMode string + + const ( + // AutomaticByOS ... + AutomaticByOS InGuestPatchMode = "AutomaticByOS" + // AutomaticByPlatform ... + AutomaticByPlatform InGuestPatchMode = "AutomaticByPlatform" + // Manual ... + Manual InGuestPatchMode = "Manual" + ) + // PossibleInGuestPatchModeValues returns an array of possible values for the InGuestPatchMode const type. + func PossibleInGuestPatchModeValues() []InGuestPatchMode { + return []InGuestPatchMode{AutomaticByOS,AutomaticByPlatform,Manual} + } + + // InstanceViewTypes enumerates the values for instance view types. + type InstanceViewTypes string + + const ( + // InstanceView ... + InstanceView InstanceViewTypes = "instanceView" + ) + // PossibleInstanceViewTypesValues returns an array of possible values for the InstanceViewTypes const type. + func PossibleInstanceViewTypesValues() []InstanceViewTypes { + return []InstanceViewTypes{InstanceView} + } + + // IntervalInMins enumerates the values for interval in mins. + type IntervalInMins string + + const ( + // FiveMins ... + FiveMins IntervalInMins = "FiveMins" + // SixtyMins ... + SixtyMins IntervalInMins = "SixtyMins" + // ThirtyMins ... + ThirtyMins IntervalInMins = "ThirtyMins" + // ThreeMins ... + ThreeMins IntervalInMins = "ThreeMins" + ) + // PossibleIntervalInMinsValues returns an array of possible values for the IntervalInMins const type. + func PossibleIntervalInMinsValues() []IntervalInMins { + return []IntervalInMins{FiveMins,SixtyMins,ThirtyMins,ThreeMins} + } + + // IPVersion enumerates the values for ip version. + type IPVersion string + + const ( + // IPv4 ... + IPv4 IPVersion = "IPv4" + // IPv6 ... + IPv6 IPVersion = "IPv6" + ) + // PossibleIPVersionValues returns an array of possible values for the IPVersion const type. + func PossibleIPVersionValues() []IPVersion { + return []IPVersion{IPv4,IPv6} + } + + // MaintenanceOperationResultCodeTypes enumerates the values for maintenance operation result code types. + type MaintenanceOperationResultCodeTypes string + + const ( + // MaintenanceOperationResultCodeTypesMaintenanceAborted ... + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + // MaintenanceOperationResultCodeTypesMaintenanceCompleted ... + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + // MaintenanceOperationResultCodeTypesNone ... + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + // MaintenanceOperationResultCodeTypesRetryLater ... + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" + ) + // PossibleMaintenanceOperationResultCodeTypesValues returns an array of possible values for the MaintenanceOperationResultCodeTypes const type. + func PossibleMaintenanceOperationResultCodeTypesValues() []MaintenanceOperationResultCodeTypes { + return []MaintenanceOperationResultCodeTypes{MaintenanceOperationResultCodeTypesMaintenanceAborted,MaintenanceOperationResultCodeTypesMaintenanceCompleted,MaintenanceOperationResultCodeTypesNone,MaintenanceOperationResultCodeTypesRetryLater} + } + + // OperatingSystemStateTypes enumerates the values for operating system state types. + type OperatingSystemStateTypes string + + const ( + // Generalized Generalized image. Needs to be provisioned during deployment time. + Generalized OperatingSystemStateTypes = "Generalized" + // Specialized Specialized image. Contains already provisioned OS Disk. + Specialized OperatingSystemStateTypes = "Specialized" + ) + // PossibleOperatingSystemStateTypesValues returns an array of possible values for the OperatingSystemStateTypes const type. + func PossibleOperatingSystemStateTypesValues() []OperatingSystemStateTypes { + return []OperatingSystemStateTypes{Generalized,Specialized} + } + + // OperatingSystemTypes enumerates the values for operating system types. + type OperatingSystemTypes string + + const ( + // Linux ... + Linux OperatingSystemTypes = "Linux" + // Windows ... + Windows OperatingSystemTypes = "Windows" + ) + // PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. + func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { + return []OperatingSystemTypes{Linux,Windows} + } + + // OrchestrationServiceNames enumerates the values for orchestration service names. + type OrchestrationServiceNames string + + const ( + // AutomaticRepairs ... + AutomaticRepairs OrchestrationServiceNames = "AutomaticRepairs" + + ) + // PossibleOrchestrationServiceNamesValues returns an array of possible values for the OrchestrationServiceNames const type. + func PossibleOrchestrationServiceNamesValues() []OrchestrationServiceNames { + return []OrchestrationServiceNames{AutomaticRepairs} + } + + // OrchestrationServiceState enumerates the values for orchestration service state. + type OrchestrationServiceState string + + const ( + // NotRunning ... + NotRunning OrchestrationServiceState = "NotRunning" + // Running ... + Running OrchestrationServiceState = "Running" + // Suspended ... + Suspended OrchestrationServiceState = "Suspended" + ) + // PossibleOrchestrationServiceStateValues returns an array of possible values for the OrchestrationServiceState const type. + func PossibleOrchestrationServiceStateValues() []OrchestrationServiceState { + return []OrchestrationServiceState{NotRunning,Running,Suspended} + } + + // OrchestrationServiceStateAction enumerates the values for orchestration service state action. + type OrchestrationServiceStateAction string + + const ( + // Resume ... + Resume OrchestrationServiceStateAction = "Resume" + // Suspend ... + Suspend OrchestrationServiceStateAction = "Suspend" + ) + // PossibleOrchestrationServiceStateActionValues returns an array of possible values for the OrchestrationServiceStateAction const type. + func PossibleOrchestrationServiceStateActionValues() []OrchestrationServiceStateAction { + return []OrchestrationServiceStateAction{Resume,Suspend} + } + + // PassNames enumerates the values for pass names. + type PassNames string + + const ( + // OobeSystem ... + OobeSystem PassNames = "OobeSystem" + ) + // PossiblePassNamesValues returns an array of possible values for the PassNames const type. + func PossiblePassNamesValues() []PassNames { + return []PassNames{OobeSystem} + } + + // PatchAssessmentState enumerates the values for patch assessment state. + type PatchAssessmentState string + + const ( + // Available ... + Available PatchAssessmentState = "Available" + // Excluded ... + Excluded PatchAssessmentState = "Excluded" + // Failed ... + Failed PatchAssessmentState = "Failed" + // Installed ... + Installed PatchAssessmentState = "Installed" + // NotSelected ... + NotSelected PatchAssessmentState = "NotSelected" + // Pending ... + Pending PatchAssessmentState = "Pending" + ) + // PossiblePatchAssessmentStateValues returns an array of possible values for the PatchAssessmentState const type. + func PossiblePatchAssessmentStateValues() []PatchAssessmentState { + return []PatchAssessmentState{Available,Excluded,Failed,Installed,NotSelected,Pending} + } + + // PatchOperationStatus enumerates the values for patch operation status. + type PatchOperationStatus string + + const ( + // PatchOperationStatusCompletedWithWarnings ... + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + // PatchOperationStatusFailed ... + PatchOperationStatusFailed PatchOperationStatus = "Failed" + // PatchOperationStatusInProgress ... + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + // PatchOperationStatusSucceeded ... + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + ) + // PossiblePatchOperationStatusValues returns an array of possible values for the PatchOperationStatus const type. + func PossiblePatchOperationStatusValues() []PatchOperationStatus { + return []PatchOperationStatus{PatchOperationStatusCompletedWithWarnings,PatchOperationStatusFailed,PatchOperationStatusInProgress,PatchOperationStatusSucceeded} + } + + // ProtocolTypes enumerates the values for protocol types. + type ProtocolTypes string + + const ( + // HTTP ... + HTTP ProtocolTypes = "Http" + // HTTPS ... + HTTPS ProtocolTypes = "Https" + ) + // PossibleProtocolTypesValues returns an array of possible values for the ProtocolTypes const type. + func PossibleProtocolTypesValues() []ProtocolTypes { + return []ProtocolTypes{HTTP,HTTPS} + } + + // ProximityPlacementGroupType enumerates the values for proximity placement group type. + type ProximityPlacementGroupType string + + const ( + // Standard ... + Standard ProximityPlacementGroupType = "Standard" + // Ultra ... + Ultra ProximityPlacementGroupType = "Ultra" + ) + // PossibleProximityPlacementGroupTypeValues returns an array of possible values for the ProximityPlacementGroupType const type. + func PossibleProximityPlacementGroupTypeValues() []ProximityPlacementGroupType { + return []ProximityPlacementGroupType{Standard,Ultra} + } + + // RebootStatus enumerates the values for reboot status. + type RebootStatus string + + const ( + // RebootStatusCompleted ... + RebootStatusCompleted RebootStatus = "Completed" + // RebootStatusFailed ... + RebootStatusFailed RebootStatus = "Failed" + // RebootStatusNotNeeded ... + RebootStatusNotNeeded RebootStatus = "NotNeeded" + // RebootStatusRequired ... + RebootStatusRequired RebootStatus = "Required" + // RebootStatusStarted ... + RebootStatusStarted RebootStatus = "Started" + ) + // PossibleRebootStatusValues returns an array of possible values for the RebootStatus const type. + func PossibleRebootStatusValues() []RebootStatus { + return []RebootStatus{RebootStatusCompleted,RebootStatusFailed,RebootStatusNotNeeded,RebootStatusRequired,RebootStatusStarted} + } + + // ResourceIdentityType enumerates the values for resource identity type. + type ResourceIdentityType string + + const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" + ) + // PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. + func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone,ResourceIdentityTypeSystemAssigned,ResourceIdentityTypeSystemAssignedUserAssigned,ResourceIdentityTypeUserAssigned} + } + + // RollingUpgradeActionType enumerates the values for rolling upgrade action type. + type RollingUpgradeActionType string + + const ( + // Cancel ... + Cancel RollingUpgradeActionType = "Cancel" + // Start ... + Start RollingUpgradeActionType = "Start" + ) + // PossibleRollingUpgradeActionTypeValues returns an array of possible values for the RollingUpgradeActionType const type. + func PossibleRollingUpgradeActionTypeValues() []RollingUpgradeActionType { + return []RollingUpgradeActionType{Cancel,Start} + } + + // RollingUpgradeStatusCode enumerates the values for rolling upgrade status code. + type RollingUpgradeStatusCode string + + const ( + // Cancelled ... + Cancelled RollingUpgradeStatusCode = "Cancelled" + // Completed ... + Completed RollingUpgradeStatusCode = "Completed" + // Faulted ... + Faulted RollingUpgradeStatusCode = "Faulted" + // RollingForward ... + RollingForward RollingUpgradeStatusCode = "RollingForward" + ) + // PossibleRollingUpgradeStatusCodeValues returns an array of possible values for the RollingUpgradeStatusCode const type. + func PossibleRollingUpgradeStatusCodeValues() []RollingUpgradeStatusCode { + return []RollingUpgradeStatusCode{Cancelled,Completed,Faulted,RollingForward} + } + + // SettingNames enumerates the values for setting names. + type SettingNames string + + const ( + // AutoLogon ... + AutoLogon SettingNames = "AutoLogon" + // FirstLogonCommands ... + FirstLogonCommands SettingNames = "FirstLogonCommands" + ) + // PossibleSettingNamesValues returns an array of possible values for the SettingNames const type. + func PossibleSettingNamesValues() []SettingNames { + return []SettingNames{AutoLogon,FirstLogonCommands} + } + + // SnapshotStorageAccountTypes enumerates the values for snapshot storage account types. + type SnapshotStorageAccountTypes string + + const ( + // SnapshotStorageAccountTypesPremiumLRS Premium SSD locally redundant storage + SnapshotStorageAccountTypesPremiumLRS SnapshotStorageAccountTypes = "Premium_LRS" + // SnapshotStorageAccountTypesStandardLRS Standard HDD locally redundant storage + SnapshotStorageAccountTypesStandardLRS SnapshotStorageAccountTypes = "Standard_LRS" + // SnapshotStorageAccountTypesStandardZRS Standard zone redundant storage + SnapshotStorageAccountTypesStandardZRS SnapshotStorageAccountTypes = "Standard_ZRS" + ) + // PossibleSnapshotStorageAccountTypesValues returns an array of possible values for the SnapshotStorageAccountTypes const type. + func PossibleSnapshotStorageAccountTypesValues() []SnapshotStorageAccountTypes { + return []SnapshotStorageAccountTypes{SnapshotStorageAccountTypesPremiumLRS,SnapshotStorageAccountTypesStandardLRS,SnapshotStorageAccountTypesStandardZRS} + } + + // SoftwareUpdateRebootBehavior enumerates the values for software update reboot behavior. + type SoftwareUpdateRebootBehavior string + + const ( + // AlwaysRequiresReboot ... + AlwaysRequiresReboot SoftwareUpdateRebootBehavior = "AlwaysRequiresReboot" + // CanRequestReboot ... + CanRequestReboot SoftwareUpdateRebootBehavior = "CanRequestReboot" + // NeverReboots ... + NeverReboots SoftwareUpdateRebootBehavior = "NeverReboots" + ) + // PossibleSoftwareUpdateRebootBehaviorValues returns an array of possible values for the SoftwareUpdateRebootBehavior const type. + func PossibleSoftwareUpdateRebootBehaviorValues() []SoftwareUpdateRebootBehavior { + return []SoftwareUpdateRebootBehavior{AlwaysRequiresReboot,CanRequestReboot,NeverReboots} + } + + // StatusLevelTypes enumerates the values for status level types. + type StatusLevelTypes string + + const ( + // Error ... + Error StatusLevelTypes = "Error" + // Info ... + Info StatusLevelTypes = "Info" + // Warning ... + Warning StatusLevelTypes = "Warning" + ) + // PossibleStatusLevelTypesValues returns an array of possible values for the StatusLevelTypes const type. + func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{Error,Info,Warning} + } + + // StorageAccountTypes enumerates the values for storage account types. + type StorageAccountTypes string + + const ( + // StorageAccountTypesPremiumLRS ... + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + // StorageAccountTypesStandardLRS ... + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + // StorageAccountTypesStandardSSDLRS ... + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + // StorageAccountTypesUltraSSDLRS ... + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" + ) + // PossibleStorageAccountTypesValues returns an array of possible values for the StorageAccountTypes const type. + func PossibleStorageAccountTypesValues() []StorageAccountTypes { + return []StorageAccountTypes{StorageAccountTypesPremiumLRS,StorageAccountTypesStandardLRS,StorageAccountTypesStandardSSDLRS,StorageAccountTypesUltraSSDLRS} + } + + // UpgradeMode enumerates the values for upgrade mode. + type UpgradeMode string + + const ( + // UpgradeModeAutomatic ... + UpgradeModeAutomatic UpgradeMode = "Automatic" + // UpgradeModeManual ... + UpgradeModeManual UpgradeMode = "Manual" + // UpgradeModeRolling ... + UpgradeModeRolling UpgradeMode = "Rolling" + ) + // PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type. + func PossibleUpgradeModeValues() []UpgradeMode { + return []UpgradeMode{UpgradeModeAutomatic,UpgradeModeManual,UpgradeModeRolling} + } + + // UpgradeOperationInvoker enumerates the values for upgrade operation invoker. + type UpgradeOperationInvoker string + + const ( + // Platform ... + Platform UpgradeOperationInvoker = "Platform" + // Unknown ... + Unknown UpgradeOperationInvoker = "Unknown" + // User ... + User UpgradeOperationInvoker = "User" + ) + // PossibleUpgradeOperationInvokerValues returns an array of possible values for the UpgradeOperationInvoker const type. + func PossibleUpgradeOperationInvokerValues() []UpgradeOperationInvoker { + return []UpgradeOperationInvoker{Platform,Unknown,User} + } + + // UpgradeState enumerates the values for upgrade state. + type UpgradeState string + + const ( + // UpgradeStateCancelled ... + UpgradeStateCancelled UpgradeState = "Cancelled" + // UpgradeStateCompleted ... + UpgradeStateCompleted UpgradeState = "Completed" + // UpgradeStateFaulted ... + UpgradeStateFaulted UpgradeState = "Faulted" + // UpgradeStateRollingForward ... + UpgradeStateRollingForward UpgradeState = "RollingForward" + ) + // PossibleUpgradeStateValues returns an array of possible values for the UpgradeState const type. + func PossibleUpgradeStateValues() []UpgradeState { + return []UpgradeState{UpgradeStateCancelled,UpgradeStateCompleted,UpgradeStateFaulted,UpgradeStateRollingForward} + } + + // VirtualMachineEvictionPolicyTypes enumerates the values for virtual machine eviction policy types. + type VirtualMachineEvictionPolicyTypes string + + const ( + // Deallocate ... + Deallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + // Delete ... + Delete VirtualMachineEvictionPolicyTypes = "Delete" + ) + // PossibleVirtualMachineEvictionPolicyTypesValues returns an array of possible values for the VirtualMachineEvictionPolicyTypes const type. + func PossibleVirtualMachineEvictionPolicyTypesValues() []VirtualMachineEvictionPolicyTypes { + return []VirtualMachineEvictionPolicyTypes{Deallocate,Delete} + } + + // VirtualMachinePriorityTypes enumerates the values for virtual machine priority types. + type VirtualMachinePriorityTypes string + + const ( + // Low ... + Low VirtualMachinePriorityTypes = "Low" + // Regular ... + Regular VirtualMachinePriorityTypes = "Regular" + // Spot ... + Spot VirtualMachinePriorityTypes = "Spot" + ) + // PossibleVirtualMachinePriorityTypesValues returns an array of possible values for the VirtualMachinePriorityTypes const type. + func PossibleVirtualMachinePriorityTypesValues() []VirtualMachinePriorityTypes { + return []VirtualMachinePriorityTypes{Low,Regular,Spot} + } + + // VirtualMachineScaleSetScaleInRules enumerates the values for virtual machine scale set scale in rules. + type VirtualMachineScaleSetScaleInRules string + + const ( + // Default ... + Default VirtualMachineScaleSetScaleInRules = "Default" + // NewestVM ... + NewestVM VirtualMachineScaleSetScaleInRules = "NewestVM" + // OldestVM ... + OldestVM VirtualMachineScaleSetScaleInRules = "OldestVM" + ) + // PossibleVirtualMachineScaleSetScaleInRulesValues returns an array of possible values for the VirtualMachineScaleSetScaleInRules const type. + func PossibleVirtualMachineScaleSetScaleInRulesValues() []VirtualMachineScaleSetScaleInRules { + return []VirtualMachineScaleSetScaleInRules{Default,NewestVM,OldestVM} + } + + // VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine scale set sku scale type. + type VirtualMachineScaleSetSkuScaleType string + + const ( + // VirtualMachineScaleSetSkuScaleTypeAutomatic ... + VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" + // VirtualMachineScaleSetSkuScaleTypeNone ... + VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" + ) + // PossibleVirtualMachineScaleSetSkuScaleTypeValues returns an array of possible values for the VirtualMachineScaleSetSkuScaleType const type. + func PossibleVirtualMachineScaleSetSkuScaleTypeValues() []VirtualMachineScaleSetSkuScaleType { + return []VirtualMachineScaleSetSkuScaleType{VirtualMachineScaleSetSkuScaleTypeAutomatic,VirtualMachineScaleSetSkuScaleTypeNone} + } + + // VirtualMachineSizeTypes enumerates the values for virtual machine size types. + type VirtualMachineSizeTypes string + + const ( + // BasicA0 ... + BasicA0 VirtualMachineSizeTypes = "Basic_A0" + // BasicA1 ... + BasicA1 VirtualMachineSizeTypes = "Basic_A1" + // BasicA2 ... + BasicA2 VirtualMachineSizeTypes = "Basic_A2" + // BasicA3 ... + BasicA3 VirtualMachineSizeTypes = "Basic_A3" + // BasicA4 ... + BasicA4 VirtualMachineSizeTypes = "Basic_A4" + // StandardA0 ... + StandardA0 VirtualMachineSizeTypes = "Standard_A0" + // StandardA1 ... + StandardA1 VirtualMachineSizeTypes = "Standard_A1" + // StandardA10 ... + StandardA10 VirtualMachineSizeTypes = "Standard_A10" + // StandardA11 ... + StandardA11 VirtualMachineSizeTypes = "Standard_A11" + // StandardA1V2 ... + StandardA1V2 VirtualMachineSizeTypes = "Standard_A1_v2" + // StandardA2 ... + StandardA2 VirtualMachineSizeTypes = "Standard_A2" + // StandardA2mV2 ... + StandardA2mV2 VirtualMachineSizeTypes = "Standard_A2m_v2" + // StandardA2V2 ... + StandardA2V2 VirtualMachineSizeTypes = "Standard_A2_v2" + // StandardA3 ... + StandardA3 VirtualMachineSizeTypes = "Standard_A3" + // StandardA4 ... + StandardA4 VirtualMachineSizeTypes = "Standard_A4" + // StandardA4mV2 ... + StandardA4mV2 VirtualMachineSizeTypes = "Standard_A4m_v2" + // StandardA4V2 ... + StandardA4V2 VirtualMachineSizeTypes = "Standard_A4_v2" + // StandardA5 ... + StandardA5 VirtualMachineSizeTypes = "Standard_A5" + // StandardA6 ... + StandardA6 VirtualMachineSizeTypes = "Standard_A6" + // StandardA7 ... + StandardA7 VirtualMachineSizeTypes = "Standard_A7" + // StandardA8 ... + StandardA8 VirtualMachineSizeTypes = "Standard_A8" + // StandardA8mV2 ... + StandardA8mV2 VirtualMachineSizeTypes = "Standard_A8m_v2" + // StandardA8V2 ... + StandardA8V2 VirtualMachineSizeTypes = "Standard_A8_v2" + // StandardA9 ... + StandardA9 VirtualMachineSizeTypes = "Standard_A9" + // StandardB1ms ... + StandardB1ms VirtualMachineSizeTypes = "Standard_B1ms" + // StandardB1s ... + StandardB1s VirtualMachineSizeTypes = "Standard_B1s" + // StandardB2ms ... + StandardB2ms VirtualMachineSizeTypes = "Standard_B2ms" + // StandardB2s ... + StandardB2s VirtualMachineSizeTypes = "Standard_B2s" + // StandardB4ms ... + StandardB4ms VirtualMachineSizeTypes = "Standard_B4ms" + // StandardB8ms ... + StandardB8ms VirtualMachineSizeTypes = "Standard_B8ms" + // StandardD1 ... + StandardD1 VirtualMachineSizeTypes = "Standard_D1" + // StandardD11 ... + StandardD11 VirtualMachineSizeTypes = "Standard_D11" + // StandardD11V2 ... + StandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" + // StandardD12 ... + StandardD12 VirtualMachineSizeTypes = "Standard_D12" + // StandardD12V2 ... + StandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" + // StandardD13 ... + StandardD13 VirtualMachineSizeTypes = "Standard_D13" + // StandardD13V2 ... + StandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" + // StandardD14 ... + StandardD14 VirtualMachineSizeTypes = "Standard_D14" + // StandardD14V2 ... + StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" + // StandardD15V2 ... + StandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2" + // StandardD16sV3 ... + StandardD16sV3 VirtualMachineSizeTypes = "Standard_D16s_v3" + // StandardD16V3 ... + StandardD16V3 VirtualMachineSizeTypes = "Standard_D16_v3" + // StandardD1V2 ... + StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" + // StandardD2 ... + StandardD2 VirtualMachineSizeTypes = "Standard_D2" + // StandardD2sV3 ... + StandardD2sV3 VirtualMachineSizeTypes = "Standard_D2s_v3" + // StandardD2V2 ... + StandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" + // StandardD2V3 ... + StandardD2V3 VirtualMachineSizeTypes = "Standard_D2_v3" + // StandardD3 ... + StandardD3 VirtualMachineSizeTypes = "Standard_D3" + // StandardD32sV3 ... + StandardD32sV3 VirtualMachineSizeTypes = "Standard_D32s_v3" + // StandardD32V3 ... + StandardD32V3 VirtualMachineSizeTypes = "Standard_D32_v3" + // StandardD3V2 ... + StandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" + // StandardD4 ... + StandardD4 VirtualMachineSizeTypes = "Standard_D4" + // StandardD4sV3 ... + StandardD4sV3 VirtualMachineSizeTypes = "Standard_D4s_v3" + // StandardD4V2 ... + StandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" + // StandardD4V3 ... + StandardD4V3 VirtualMachineSizeTypes = "Standard_D4_v3" + // StandardD5V2 ... + StandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" + // StandardD64sV3 ... + StandardD64sV3 VirtualMachineSizeTypes = "Standard_D64s_v3" + // StandardD64V3 ... + StandardD64V3 VirtualMachineSizeTypes = "Standard_D64_v3" + // StandardD8sV3 ... + StandardD8sV3 VirtualMachineSizeTypes = "Standard_D8s_v3" + // StandardD8V3 ... + StandardD8V3 VirtualMachineSizeTypes = "Standard_D8_v3" + // StandardDS1 ... + StandardDS1 VirtualMachineSizeTypes = "Standard_DS1" + // StandardDS11 ... + StandardDS11 VirtualMachineSizeTypes = "Standard_DS11" + // StandardDS11V2 ... + StandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" + // StandardDS12 ... + StandardDS12 VirtualMachineSizeTypes = "Standard_DS12" + // StandardDS12V2 ... + StandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" + // StandardDS13 ... + StandardDS13 VirtualMachineSizeTypes = "Standard_DS13" + // StandardDS132V2 ... + StandardDS132V2 VirtualMachineSizeTypes = "Standard_DS13-2_v2" + // StandardDS134V2 ... + StandardDS134V2 VirtualMachineSizeTypes = "Standard_DS13-4_v2" + // StandardDS13V2 ... + StandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" + // StandardDS14 ... + StandardDS14 VirtualMachineSizeTypes = "Standard_DS14" + // StandardDS144V2 ... + StandardDS144V2 VirtualMachineSizeTypes = "Standard_DS14-4_v2" + // StandardDS148V2 ... + StandardDS148V2 VirtualMachineSizeTypes = "Standard_DS14-8_v2" + // StandardDS14V2 ... + StandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2" + // StandardDS15V2 ... + StandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2" + // StandardDS1V2 ... + StandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" + // StandardDS2 ... + StandardDS2 VirtualMachineSizeTypes = "Standard_DS2" + // StandardDS2V2 ... + StandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" + // StandardDS3 ... + StandardDS3 VirtualMachineSizeTypes = "Standard_DS3" + // StandardDS3V2 ... + StandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" + // StandardDS4 ... + StandardDS4 VirtualMachineSizeTypes = "Standard_DS4" + // StandardDS4V2 ... + StandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" + // StandardDS5V2 ... + StandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" + // StandardE16sV3 ... + StandardE16sV3 VirtualMachineSizeTypes = "Standard_E16s_v3" + // StandardE16V3 ... + StandardE16V3 VirtualMachineSizeTypes = "Standard_E16_v3" + // StandardE2sV3 ... + StandardE2sV3 VirtualMachineSizeTypes = "Standard_E2s_v3" + // StandardE2V3 ... + StandardE2V3 VirtualMachineSizeTypes = "Standard_E2_v3" + // StandardE3216V3 ... + StandardE3216V3 VirtualMachineSizeTypes = "Standard_E32-16_v3" + // StandardE328sV3 ... + StandardE328sV3 VirtualMachineSizeTypes = "Standard_E32-8s_v3" + // StandardE32sV3 ... + StandardE32sV3 VirtualMachineSizeTypes = "Standard_E32s_v3" + // StandardE32V3 ... + StandardE32V3 VirtualMachineSizeTypes = "Standard_E32_v3" + // StandardE4sV3 ... + StandardE4sV3 VirtualMachineSizeTypes = "Standard_E4s_v3" + // StandardE4V3 ... + StandardE4V3 VirtualMachineSizeTypes = "Standard_E4_v3" + // StandardE6416sV3 ... + StandardE6416sV3 VirtualMachineSizeTypes = "Standard_E64-16s_v3" + // StandardE6432sV3 ... + StandardE6432sV3 VirtualMachineSizeTypes = "Standard_E64-32s_v3" + // StandardE64sV3 ... + StandardE64sV3 VirtualMachineSizeTypes = "Standard_E64s_v3" + // StandardE64V3 ... + StandardE64V3 VirtualMachineSizeTypes = "Standard_E64_v3" + // StandardE8sV3 ... + StandardE8sV3 VirtualMachineSizeTypes = "Standard_E8s_v3" + // StandardE8V3 ... + StandardE8V3 VirtualMachineSizeTypes = "Standard_E8_v3" + // StandardF1 ... + StandardF1 VirtualMachineSizeTypes = "Standard_F1" + // StandardF16 ... + StandardF16 VirtualMachineSizeTypes = "Standard_F16" + // StandardF16s ... + StandardF16s VirtualMachineSizeTypes = "Standard_F16s" + // StandardF16sV2 ... + StandardF16sV2 VirtualMachineSizeTypes = "Standard_F16s_v2" + // StandardF1s ... + StandardF1s VirtualMachineSizeTypes = "Standard_F1s" + // StandardF2 ... + StandardF2 VirtualMachineSizeTypes = "Standard_F2" + // StandardF2s ... + StandardF2s VirtualMachineSizeTypes = "Standard_F2s" + // StandardF2sV2 ... + StandardF2sV2 VirtualMachineSizeTypes = "Standard_F2s_v2" + // StandardF32sV2 ... + StandardF32sV2 VirtualMachineSizeTypes = "Standard_F32s_v2" + // StandardF4 ... + StandardF4 VirtualMachineSizeTypes = "Standard_F4" + // StandardF4s ... + StandardF4s VirtualMachineSizeTypes = "Standard_F4s" + // StandardF4sV2 ... + StandardF4sV2 VirtualMachineSizeTypes = "Standard_F4s_v2" + // StandardF64sV2 ... + StandardF64sV2 VirtualMachineSizeTypes = "Standard_F64s_v2" + // StandardF72sV2 ... + StandardF72sV2 VirtualMachineSizeTypes = "Standard_F72s_v2" + // StandardF8 ... + StandardF8 VirtualMachineSizeTypes = "Standard_F8" + // StandardF8s ... + StandardF8s VirtualMachineSizeTypes = "Standard_F8s" + // StandardF8sV2 ... + StandardF8sV2 VirtualMachineSizeTypes = "Standard_F8s_v2" + // StandardG1 ... + StandardG1 VirtualMachineSizeTypes = "Standard_G1" + // StandardG2 ... + StandardG2 VirtualMachineSizeTypes = "Standard_G2" + // StandardG3 ... + StandardG3 VirtualMachineSizeTypes = "Standard_G3" + // StandardG4 ... + StandardG4 VirtualMachineSizeTypes = "Standard_G4" + // StandardG5 ... + StandardG5 VirtualMachineSizeTypes = "Standard_G5" + // StandardGS1 ... + StandardGS1 VirtualMachineSizeTypes = "Standard_GS1" + // StandardGS2 ... + StandardGS2 VirtualMachineSizeTypes = "Standard_GS2" + // StandardGS3 ... + StandardGS3 VirtualMachineSizeTypes = "Standard_GS3" + // StandardGS4 ... + StandardGS4 VirtualMachineSizeTypes = "Standard_GS4" + // StandardGS44 ... + StandardGS44 VirtualMachineSizeTypes = "Standard_GS4-4" + // StandardGS48 ... + StandardGS48 VirtualMachineSizeTypes = "Standard_GS4-8" + // StandardGS5 ... + StandardGS5 VirtualMachineSizeTypes = "Standard_GS5" + // StandardGS516 ... + StandardGS516 VirtualMachineSizeTypes = "Standard_GS5-16" + // StandardGS58 ... + StandardGS58 VirtualMachineSizeTypes = "Standard_GS5-8" + // StandardH16 ... + StandardH16 VirtualMachineSizeTypes = "Standard_H16" + // StandardH16m ... + StandardH16m VirtualMachineSizeTypes = "Standard_H16m" + // StandardH16mr ... + StandardH16mr VirtualMachineSizeTypes = "Standard_H16mr" + // StandardH16r ... + StandardH16r VirtualMachineSizeTypes = "Standard_H16r" + // StandardH8 ... + StandardH8 VirtualMachineSizeTypes = "Standard_H8" + // StandardH8m ... + StandardH8m VirtualMachineSizeTypes = "Standard_H8m" + // StandardL16s ... + StandardL16s VirtualMachineSizeTypes = "Standard_L16s" + // StandardL32s ... + StandardL32s VirtualMachineSizeTypes = "Standard_L32s" + // StandardL4s ... + StandardL4s VirtualMachineSizeTypes = "Standard_L4s" + // StandardL8s ... + StandardL8s VirtualMachineSizeTypes = "Standard_L8s" + // StandardM12832ms ... + StandardM12832ms VirtualMachineSizeTypes = "Standard_M128-32ms" + // StandardM12864ms ... + StandardM12864ms VirtualMachineSizeTypes = "Standard_M128-64ms" + // StandardM128ms ... + StandardM128ms VirtualMachineSizeTypes = "Standard_M128ms" + // StandardM128s ... + StandardM128s VirtualMachineSizeTypes = "Standard_M128s" + // StandardM6416ms ... + StandardM6416ms VirtualMachineSizeTypes = "Standard_M64-16ms" + // StandardM6432ms ... + StandardM6432ms VirtualMachineSizeTypes = "Standard_M64-32ms" + // StandardM64ms ... + StandardM64ms VirtualMachineSizeTypes = "Standard_M64ms" + // StandardM64s ... + StandardM64s VirtualMachineSizeTypes = "Standard_M64s" + // StandardNC12 ... + StandardNC12 VirtualMachineSizeTypes = "Standard_NC12" + // StandardNC12sV2 ... + StandardNC12sV2 VirtualMachineSizeTypes = "Standard_NC12s_v2" + // StandardNC12sV3 ... + StandardNC12sV3 VirtualMachineSizeTypes = "Standard_NC12s_v3" + // StandardNC24 ... + StandardNC24 VirtualMachineSizeTypes = "Standard_NC24" + // StandardNC24r ... + StandardNC24r VirtualMachineSizeTypes = "Standard_NC24r" + // StandardNC24rsV2 ... + StandardNC24rsV2 VirtualMachineSizeTypes = "Standard_NC24rs_v2" + // StandardNC24rsV3 ... + StandardNC24rsV3 VirtualMachineSizeTypes = "Standard_NC24rs_v3" + // StandardNC24sV2 ... + StandardNC24sV2 VirtualMachineSizeTypes = "Standard_NC24s_v2" + // StandardNC24sV3 ... + StandardNC24sV3 VirtualMachineSizeTypes = "Standard_NC24s_v3" + // StandardNC6 ... + StandardNC6 VirtualMachineSizeTypes = "Standard_NC6" + // StandardNC6sV2 ... + StandardNC6sV2 VirtualMachineSizeTypes = "Standard_NC6s_v2" + // StandardNC6sV3 ... + StandardNC6sV3 VirtualMachineSizeTypes = "Standard_NC6s_v3" + // StandardND12s ... + StandardND12s VirtualMachineSizeTypes = "Standard_ND12s" + // StandardND24rs ... + StandardND24rs VirtualMachineSizeTypes = "Standard_ND24rs" + // StandardND24s ... + StandardND24s VirtualMachineSizeTypes = "Standard_ND24s" + // StandardND6s ... + StandardND6s VirtualMachineSizeTypes = "Standard_ND6s" + // StandardNV12 ... + StandardNV12 VirtualMachineSizeTypes = "Standard_NV12" + // StandardNV24 ... + StandardNV24 VirtualMachineSizeTypes = "Standard_NV24" + // StandardNV6 ... + StandardNV6 VirtualMachineSizeTypes = "Standard_NV6" + ) + // PossibleVirtualMachineSizeTypesValues returns an array of possible values for the VirtualMachineSizeTypes const type. + func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { + return []VirtualMachineSizeTypes{BasicA0,BasicA1,BasicA2,BasicA3,BasicA4,StandardA0,StandardA1,StandardA10,StandardA11,StandardA1V2,StandardA2,StandardA2mV2,StandardA2V2,StandardA3,StandardA4,StandardA4mV2,StandardA4V2,StandardA5,StandardA6,StandardA7,StandardA8,StandardA8mV2,StandardA8V2,StandardA9,StandardB1ms,StandardB1s,StandardB2ms,StandardB2s,StandardB4ms,StandardB8ms,StandardD1,StandardD11,StandardD11V2,StandardD12,StandardD12V2,StandardD13,StandardD13V2,StandardD14,StandardD14V2,StandardD15V2,StandardD16sV3,StandardD16V3,StandardD1V2,StandardD2,StandardD2sV3,StandardD2V2,StandardD2V3,StandardD3,StandardD32sV3,StandardD32V3,StandardD3V2,StandardD4,StandardD4sV3,StandardD4V2,StandardD4V3,StandardD5V2,StandardD64sV3,StandardD64V3,StandardD8sV3,StandardD8V3,StandardDS1,StandardDS11,StandardDS11V2,StandardDS12,StandardDS12V2,StandardDS13,StandardDS132V2,StandardDS134V2,StandardDS13V2,StandardDS14,StandardDS144V2,StandardDS148V2,StandardDS14V2,StandardDS15V2,StandardDS1V2,StandardDS2,StandardDS2V2,StandardDS3,StandardDS3V2,StandardDS4,StandardDS4V2,StandardDS5V2,StandardE16sV3,StandardE16V3,StandardE2sV3,StandardE2V3,StandardE3216V3,StandardE328sV3,StandardE32sV3,StandardE32V3,StandardE4sV3,StandardE4V3,StandardE6416sV3,StandardE6432sV3,StandardE64sV3,StandardE64V3,StandardE8sV3,StandardE8V3,StandardF1,StandardF16,StandardF16s,StandardF16sV2,StandardF1s,StandardF2,StandardF2s,StandardF2sV2,StandardF32sV2,StandardF4,StandardF4s,StandardF4sV2,StandardF64sV2,StandardF72sV2,StandardF8,StandardF8s,StandardF8sV2,StandardG1,StandardG2,StandardG3,StandardG4,StandardG5,StandardGS1,StandardGS2,StandardGS3,StandardGS4,StandardGS44,StandardGS48,StandardGS5,StandardGS516,StandardGS58,StandardH16,StandardH16m,StandardH16mr,StandardH16r,StandardH8,StandardH8m,StandardL16s,StandardL32s,StandardL4s,StandardL8s,StandardM12832ms,StandardM12864ms,StandardM128ms,StandardM128s,StandardM6416ms,StandardM6432ms,StandardM64ms,StandardM64s,StandardNC12,StandardNC12sV2,StandardNC12sV3,StandardNC24,StandardNC24r,StandardNC24rsV2,StandardNC24rsV3,StandardNC24sV2,StandardNC24sV3,StandardNC6,StandardNC6sV2,StandardNC6sV3,StandardND12s,StandardND24rs,StandardND24s,StandardND6s,StandardNV12,StandardNV24,StandardNV6} + } + + // VMDiskTypes enumerates the values for vm disk types. + type VMDiskTypes string + + const ( + // VMDiskTypesNone ... + VMDiskTypesNone VMDiskTypes = "None" + // VMDiskTypesUnmanaged ... + VMDiskTypesUnmanaged VMDiskTypes = "Unmanaged" + ) + // PossibleVMDiskTypesValues returns an array of possible values for the VMDiskTypes const type. + func PossibleVMDiskTypesValues() []VMDiskTypes { + return []VMDiskTypes{VMDiskTypesNone,VMDiskTypesUnmanaged} + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/images.go b/profiles/2020-09-01/compute/mgmt/compute/images.go new file mode 100644 index 000000000000..8f788c6848a5 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/images.go @@ -0,0 +1,577 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// ImagesClient is the compute Client +type ImagesClient struct { + BaseClient +} +// NewImagesClient creates an instance of the ImagesClient client. +func NewImagesClient(subscriptionID string) ImagesClient { + return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImagesClientWithBaseURI creates an instance of the ImagesClient 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 NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { + return ImagesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate create or update an image. + // Parameters: + // resourceGroupName - the name of the resource group. + // imageName - the name of the image. + // parameters - parameters supplied to the Create Image operation. +func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (*http.Request, error) { + pathParameters := map[string]interface{} { + "imageName": autorest.Encode("path",imageName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (future ImagesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete deletes an Image. + // Parameters: + // resourceGroupName - the name of the resource group. + // imageName - the name of the image. +func (client ImagesClient) Delete(ctx context.Context, resourceGroupName string, imageName string) (result ImagesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, imageName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "imageName": autorest.Encode("path",imageName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client ImagesClient) DeleteSender(req *http.Request) (future ImagesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client ImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get gets an image. + // Parameters: + // resourceGroupName - the name of the resource group. + // imageName - the name of the image. + // expand - the expand expression to apply on the operation. +func (client ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result Image, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client ImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "imageName": autorest.Encode("path",imageName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}",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 ImagesClient) 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 ImagesClient) GetResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List gets the list of Images in the subscription. Use nextLink property in the response to get the next page of +// Images. Do this till nextLink is null to fetch all the Images. +func (client ImagesClient) List(ctx context.Context) (result ImageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.List") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request") + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client ImagesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images",pathParameters), +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 ImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client ImagesClient) listNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.imageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.List") + 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.List(ctx) + return + } + +// ListByResourceGroup gets the list of images under a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client ImagesClient) 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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images",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 ImagesClient) 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 ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, 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 ImagesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.imageListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "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, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.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 + } + +// Update update an image. + // Parameters: + // resourceGroupName - the name of the resource group. + // imageName - the name of the image. + // parameters - parameters supplied to the Update Image operation. +func (client ImagesClient) Update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (result ImagesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImagesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, imageName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client ImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "imageName": autorest.Encode("path",imageName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/images/{imageName}",pathParameters), +autorest.WithJSON(parameters), +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 ImagesClient) UpdateSender(req *http.Request) (future ImagesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client ImagesClient) UpdateResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/loganalytics.go b/profiles/2020-09-01/compute/mgmt/compute/loganalytics.go new file mode 100644 index 000000000000..a6a0e59b8ea9 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/loganalytics.go @@ -0,0 +1,209 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// LogAnalyticsClient is the compute Client +type LogAnalyticsClient struct { + BaseClient +} +// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client. +func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient { + return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient 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 NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient { + return LogAnalyticsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to +// show throttling activities. + // Parameters: + // parameters - parameters supplied to the LogAnalytics getRequestRateByInterval Api. + // location - the location upon which virtual-machine-sizes is queried. +func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/LogAnalyticsClient.ExportRequestRateByInterval") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: location, + Constraints: []validation.Constraint{ {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.LogAnalyticsClient", "ExportRequestRateByInterval", err.Error()) + } + + req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", nil , "Failure preparing request") + return + } + + result, err = client.ExportRequestRateByIntervalSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", result.Response(), "Failure sending request") + return + } + + return +} + + // ExportRequestRateByIntervalPreparer prepares the ExportRequestRateByInterval request. + func (client LogAnalyticsClient) ExportRequestRateByIntervalPreparer(ctx context.Context, parameters RequestRateByIntervalInput, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ExportRequestRateByIntervalSender sends the ExportRequestRateByInterval request. The method will close the + // http.Response Body if it receives an error. + func (client LogAnalyticsClient) ExportRequestRateByIntervalSender(req *http.Request) (future LogAnalyticsExportRequestRateByIntervalFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ExportRequestRateByIntervalResponder handles the response to the ExportRequestRateByInterval request. The method always + // closes the http.Response Body. + func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time +// window. + // Parameters: + // parameters - parameters supplied to the LogAnalytics getThrottledRequests Api. + // location - the location upon which virtual-machine-sizes is queried. +func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/LogAnalyticsClient.ExportThrottledRequests") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: location, + Constraints: []validation.Constraint{ {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.LogAnalyticsClient", "ExportThrottledRequests", err.Error()) + } + + req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", nil , "Failure preparing request") + return + } + + result, err = client.ExportThrottledRequestsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", result.Response(), "Failure sending request") + return + } + + return +} + + // ExportThrottledRequestsPreparer prepares the ExportThrottledRequests request. + func (client LogAnalyticsClient) ExportThrottledRequestsPreparer(ctx context.Context, parameters ThrottledRequestsInput, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ExportThrottledRequestsSender sends the ExportThrottledRequests request. The method will close the + // http.Response Body if it receives an error. + func (client LogAnalyticsClient) ExportThrottledRequestsSender(req *http.Request) (future LogAnalyticsExportThrottledRequestsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ExportThrottledRequestsResponder handles the response to the ExportThrottledRequests request. The method always + // closes the http.Response Body. + func (client LogAnalyticsClient) ExportThrottledRequestsResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/models.go b/profiles/2020-09-01/compute/mgmt/compute/models.go new file mode 100644 index 000000000000..0309d09a9483 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/models.go @@ -0,0 +1,10520 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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/azure" + "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/profiles/2020-09-01/compute/mgmt/compute" + + // AccessURI a disk access SAS uri. + type AccessURI struct { + autorest.Response `json:"-"` + // AccessSAS - READ-ONLY; A SAS uri for accessing a disk. + AccessSAS *string `json:"accessSAS,omitempty"` + } + + // AdditionalCapabilities enables or disables a capability on the virtual machine or virtual machine scale + // set. + type AdditionalCapabilities struct { + // UltraSSDEnabled - The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale set only if this property is enabled. + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` + } + + // AdditionalUnattendContent specifies additional XML formatted information that can be included in the + // Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, + // and the pass in which the content is applied. + type AdditionalUnattendContent struct { + // PassName - The pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem' + PassName PassNames `json:"passName,omitempty"` + // ComponentName - The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'MicrosoftWindowsShellSetup' + ComponentName ComponentNames `json:"componentName,omitempty"` + // SettingName - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands' + SettingName SettingNames `json:"settingName,omitempty"` + // Content - Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. + Content *string `json:"content,omitempty"` + } + + // APIEntityReference the API entity reference. + type APIEntityReference struct { + // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + ID *string `json:"id,omitempty"` + } + + // APIError api error. + type APIError struct { + // Details - The Api error details + Details *[]APIErrorBase `json:"details,omitempty"` + // Innererror - The Api inner error + Innererror *InnerError `json:"innererror,omitempty"` + // Code - The error code. + Code *string `json:"code,omitempty"` + // Target - The target of the particular error. + Target *string `json:"target,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + } + + // APIErrorBase api error base. + type APIErrorBase struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Target - The target of the particular error. + Target *string `json:"target,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + } + + // AutomaticOSUpgradePolicy the configuration parameters used for performing automatic OS upgrade. + type AutomaticOSUpgradePolicy struct { + // EnableAutomaticOSUpgrade - Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false.

If this is set to true for Windows based scale sets, [enableAutomaticUpdates](https://docs.microsoft.com/dotnet/api/microsoft.azure.management.compute.models.windowsconfiguration.enableautomaticupdates?view=azure-dotnet) is automatically set to false and cannot be set to true. + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + // DisableAutomaticRollback - Whether OS image rollback feature should be disabled. Default value is false. + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` + } + + // AutomaticOSUpgradeProperties describes automatic OS upgrade properties on the image. + type AutomaticOSUpgradeProperties struct { + // AutomaticOSUpgradeSupported - Specifies whether automatic OS upgrade is supported on the image. + AutomaticOSUpgradeSupported *bool `json:"automaticOSUpgradeSupported,omitempty"` + } + + // AutomaticRepairsPolicy specifies the configuration parameters for automatic repairs on the virtual + // machine scale set. + type AutomaticRepairsPolicy struct { + // Enabled - Specifies whether automatic repairs should be enabled on the virtual machine scale set. The default value is false. + Enabled *bool `json:"enabled,omitempty"` + // GracePeriod - The amount of time for which automatic repairs are suspended due to a state change on VM. The grace time starts after the state change has completed. This helps avoid premature or accidental repairs. The time duration should be specified in ISO 8601 format. The minimum allowed grace period is 30 minutes (PT30M), which is also the default value. The maximum allowed grace period is 90 minutes (PT90M). + GracePeriod *string `json:"gracePeriod,omitempty"` + } + + // AvailabilitySet specifies information about the availability set that the virtual machine should be + // assigned to. Virtual machines specified in the same availability set are allocated to different nodes to + // maximize availability. For more information about availability sets, see [Manage the availability of + // virtual + // machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + //

For more information on Azure planned maintenance, see [Planned maintenance for virtual + // machines in + // Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + //

Currently, a VM can only be added to availability set at creation time. An existing VM cannot + // be added to an availability set. + type AvailabilitySet struct { + autorest.Response `json:"-"` + *AvailabilitySetProperties `json:"properties,omitempty"` + // Sku - Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for AvailabilitySet. + func (as AvailabilitySet)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(as.AvailabilitySetProperties != nil) { + objectMap["properties"] = as.AvailabilitySetProperties + } + if(as.Sku != nil) { + objectMap["sku"] = as.Sku + } + if(as.Location != nil) { + objectMap["location"] = as.Location + } + if(as.Tags != nil) { + objectMap["tags"] = as.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for AvailabilitySet struct. + func (as *AvailabilitySet) 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 availabilitySetProperties AvailabilitySetProperties + err = json.Unmarshal(*v, &availabilitySetProperties) + if err != nil { + return err + } + as.AvailabilitySetProperties = &availabilitySetProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + as.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + as.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + as.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + as.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + as.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + as.Tags = tags + } + } + } + + return nil + } + + // AvailabilitySetListResult the List Availability Set operation response. + type AvailabilitySetListResult struct { + autorest.Response `json:"-"` + // Value - The list of availability sets + Value *[]AvailabilitySet `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. + NextLink *string `json:"nextLink,omitempty"` + } + + // AvailabilitySetListResultIterator provides access to a complete listing of AvailabilitySet values. + type AvailabilitySetListResultIterator struct { + i int + page AvailabilitySetListResultPage + } + // 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 * AvailabilitySetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetListResultIterator.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 * AvailabilitySetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter AvailabilitySetListResultIterator) 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 AvailabilitySetListResultIterator) Response() AvailabilitySetListResult { + 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 AvailabilitySetListResultIterator) Value() AvailabilitySet { + if !iter.page.NotDone() { + return AvailabilitySet{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the AvailabilitySetListResultIterator type. + func NewAvailabilitySetListResultIterator (page AvailabilitySetListResultPage) AvailabilitySetListResultIterator { + return AvailabilitySetListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (aslr AvailabilitySetListResult) IsEmpty() bool { + return aslr.Value == nil || len(*aslr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (aslr AvailabilitySetListResult) hasNextLink() bool { + return aslr.NextLink != nil && len(*aslr.NextLink) != 0 + } + // availabilitySetListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (aslr AvailabilitySetListResult) availabilitySetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( aslr.NextLink))); + } + + // AvailabilitySetListResultPage contains a page of AvailabilitySet values. + type AvailabilitySetListResultPage struct { + fn func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error) + aslr AvailabilitySetListResult + } + + // 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 * AvailabilitySetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/AvailabilitySetListResultPage.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.aslr) + if err != nil { + return err + } + page.aslr = 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 * AvailabilitySetListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page AvailabilitySetListResultPage) NotDone() bool { + return !page.aslr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page AvailabilitySetListResultPage) Response() AvailabilitySetListResult { + return page.aslr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page AvailabilitySetListResultPage) Values() []AvailabilitySet { + if page.aslr.IsEmpty() { + return nil + } + return *page.aslr.Value + } + // Creates a new instance of the AvailabilitySetListResultPage type. + func NewAvailabilitySetListResultPage (cur AvailabilitySetListResult, getNextPage func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error)) AvailabilitySetListResultPage { + return AvailabilitySetListResultPage{ + fn: getNextPage, + aslr: cur, + } + } + + // AvailabilitySetProperties the instance view of a resource. + type AvailabilitySetProperties struct { + // PlatformUpdateDomainCount - Update Domain count. + PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` + // PlatformFaultDomainCount - Fault Domain count. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + // VirtualMachines - A list of references to all virtual machines in the availability set. + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the availability set should be assigned to.

Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // Statuses - READ-ONLY; The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // MarshalJSON is the custom marshaler for AvailabilitySetProperties. + func (asp AvailabilitySetProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(asp.PlatformUpdateDomainCount != nil) { + objectMap["platformUpdateDomainCount"] = asp.PlatformUpdateDomainCount + } + if(asp.PlatformFaultDomainCount != nil) { + objectMap["platformFaultDomainCount"] = asp.PlatformFaultDomainCount + } + if(asp.VirtualMachines != nil) { + objectMap["virtualMachines"] = asp.VirtualMachines + } + if(asp.ProximityPlacementGroup != nil) { + objectMap["proximityPlacementGroup"] = asp.ProximityPlacementGroup + } + return json.Marshal(objectMap) + } + + // AvailabilitySetUpdate specifies information about the availability set that the virtual machine should + // be assigned to. Only tags may be updated. + type AvailabilitySetUpdate struct { + *AvailabilitySetProperties `json:"properties,omitempty"` + // Sku - Sku of the availability set + Sku *Sku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for AvailabilitySetUpdate. + func (asu AvailabilitySetUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(asu.AvailabilitySetProperties != nil) { + objectMap["properties"] = asu.AvailabilitySetProperties + } + if(asu.Sku != nil) { + objectMap["sku"] = asu.Sku + } + if(asu.Tags != nil) { + objectMap["tags"] = asu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for AvailabilitySetUpdate struct. + func (asu *AvailabilitySetUpdate) 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 availabilitySetProperties AvailabilitySetProperties + err = json.Unmarshal(*v, &availabilitySetProperties) + if err != nil { + return err + } + asu.AvailabilitySetProperties = &availabilitySetProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + asu.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asu.Tags = tags + } + } + } + + return nil + } + + // AvailablePatchSummary describes the properties of an virtual machine instance view for available patch + // summary. + type AvailablePatchSummary struct { + // Status - READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", or "CompletedWithWarnings.". Possible values include: 'PatchOperationStatusInProgress', 'PatchOperationStatusFailed', 'PatchOperationStatusSucceeded', 'PatchOperationStatusCompletedWithWarnings' + Status PatchOperationStatus `json:"status,omitempty"` + // AssessmentActivityID - READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. + AssessmentActivityID *string `json:"assessmentActivityId,omitempty"` + // RebootPending - READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. + RebootPending *bool `json:"rebootPending,omitempty"` + // CriticalAndSecurityPatchCount - READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 `json:"criticalAndSecurityPatchCount,omitempty"` + // OtherPatchCount - READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 `json:"otherPatchCount,omitempty"` + // StartTime - READ-ONLY; The UTC timestamp when the operation began. + StartTime *date.Time `json:"startTime,omitempty"` + // LastModifiedTime - READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // Error - READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty"` + } + + // BillingProfile specifies the billing related details of a Azure Spot VM or VMSS.

Minimum + // api-version: 2019-03-01. + type BillingProfile struct { + // MaxPrice - Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars.

This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Azure Spot price.

The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS.

Possible values are:

- Any decimal value greater than zero. Example: 0.01538

-1 – indicates default price to be up-to on-demand.

You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.

Minimum api-version: 2019-03-01. + MaxPrice *float64 `json:"maxPrice,omitempty"` + } + + // BootDiagnostics boot Diagnostics is a debugging feature which allows you to view Console Output and + // Screenshot to diagnose VM status.

You can easily view the output of your console log.

+ // Azure also enables you to see a screenshot of the VM from the hypervisor. + type BootDiagnostics struct { + // Enabled - Whether boot diagnostics should be enabled on the Virtual Machine. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - Uri of the storage account to use for placing the console output and screenshot.

If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + StorageURI *string `json:"storageUri,omitempty"` + } + + // BootDiagnosticsInstanceView the instance view of a virtual machine boot diagnostics. + type BootDiagnosticsInstanceView struct { + // ConsoleScreenshotBlobURI - READ-ONLY; The console screenshot blob URI.

NOTE: This will **not** be set if boot diagnostics is currently enabled with managed storage. + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` + // SerialConsoleLogBlobURI - READ-ONLY; The serial console log blob Uri.

NOTE: This will **not** be set if boot diagnostics is currently enabled with managed storage. + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` + // Status - READ-ONLY; The boot diagnostics status information for the VM.

NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + Status *InstanceViewStatus `json:"status,omitempty"` + } + + // CloudError an error response from the Compute service. + type CloudError struct { + Error *APIError `json:"error,omitempty"` + } + + // CreationData data used when creating a disk. + type CreationData struct { + // CreateOption - This enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', 'Restore', 'Upload' + CreateOption DiskCreateOption `json:"createOption,omitempty"` + // StorageAccountID - Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ImageReference - Disk source information. + ImageReference *ImageDiskReference `json:"imageReference,omitempty"` + // SourceURI - If createOption is Import, this is the URI of a blob to be imported into a managed disk. + SourceURI *string `json:"sourceUri,omitempty"` + // SourceResourceID - If createOption is Copy, this is the ARM id of the source snapshot or disk. + SourceResourceID *string `json:"sourceResourceId,omitempty"` + // SourceUniqueID - READ-ONLY; If this field is set, this is the unique id identifying the source of this resource. + SourceUniqueID *string `json:"sourceUniqueId,omitempty"` + // UploadSizeBytes - If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). + UploadSizeBytes *int64 `json:"uploadSizeBytes,omitempty"` + } + + // MarshalJSON is the custom marshaler for CreationData. + func (cd CreationData)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(cd.CreateOption != "") { + objectMap["createOption"] = cd.CreateOption + } + if(cd.StorageAccountID != nil) { + objectMap["storageAccountId"] = cd.StorageAccountID + } + if(cd.ImageReference != nil) { + objectMap["imageReference"] = cd.ImageReference + } + if(cd.SourceURI != nil) { + objectMap["sourceUri"] = cd.SourceURI + } + if(cd.SourceResourceID != nil) { + objectMap["sourceResourceId"] = cd.SourceResourceID + } + if(cd.UploadSizeBytes != nil) { + objectMap["uploadSizeBytes"] = cd.UploadSizeBytes + } + return json.Marshal(objectMap) + } + + // DataDisk describes a data disk. + type DataDisk struct { + // Lun - 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"` + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Vhd - The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - Specifies how the virtual machine should be created.

Possible values are:

**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.

**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + // ToBeDetached - Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachineScaleset + ToBeDetached *bool `json:"toBeDetached,omitempty"` + // DiskIOPSReadWrite - READ-ONLY; Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine Scale Set. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - READ-ONLY; Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be updated only via updates to the VirtualMachine Scale Set. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + } + + // MarshalJSON is the custom marshaler for DataDisk. + func (dd DataDisk)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dd.Lun != nil) { + objectMap["lun"] = dd.Lun + } + if(dd.Name != nil) { + objectMap["name"] = dd.Name + } + if(dd.Vhd != nil) { + objectMap["vhd"] = dd.Vhd + } + if(dd.Image != nil) { + objectMap["image"] = dd.Image + } + if(dd.Caching != "") { + objectMap["caching"] = dd.Caching + } + if(dd.WriteAcceleratorEnabled != nil) { + objectMap["writeAcceleratorEnabled"] = dd.WriteAcceleratorEnabled + } + if(dd.CreateOption != "") { + objectMap["createOption"] = dd.CreateOption + } + if(dd.DiskSizeGB != nil) { + objectMap["diskSizeGB"] = dd.DiskSizeGB + } + if(dd.ManagedDisk != nil) { + objectMap["managedDisk"] = dd.ManagedDisk + } + if(dd.ToBeDetached != nil) { + objectMap["toBeDetached"] = dd.ToBeDetached + } + return json.Marshal(objectMap) + } + + // DataDiskImage contains the data disk images information. + type DataDiskImage struct { + // 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"` + } + + // DedicatedHost specifies information about the Dedicated host. + type DedicatedHost struct { + autorest.Response `json:"-"` + *DedicatedHostProperties `json:"properties,omitempty"` + // Sku - SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DedicatedHost. + func (dh DedicatedHost)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dh.DedicatedHostProperties != nil) { + objectMap["properties"] = dh.DedicatedHostProperties + } + if(dh.Sku != nil) { + objectMap["sku"] = dh.Sku + } + if(dh.Location != nil) { + objectMap["location"] = dh.Location + } + if(dh.Tags != nil) { + objectMap["tags"] = dh.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DedicatedHost struct. + func (dh *DedicatedHost) 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 dedicatedHostProperties DedicatedHostProperties + err = json.Unmarshal(*v, &dedicatedHostProperties) + if err != nil { + return err + } + dh.DedicatedHostProperties = &dedicatedHostProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + dh.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dh.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dh.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dh.Tags = tags + } + } + } + + return nil + } + + // DedicatedHostAllocatableVM represents the dedicated host unutilized capacity in terms of a specific VM + // size. + type DedicatedHostAllocatableVM struct { + // VMSize - VM size in terms of which the unutilized capacity is represented. + VMSize *string `json:"vmSize,omitempty"` + // Count - Maximum number of VMs of size vmSize that can fit in the dedicated host's remaining capacity. + Count *float64 `json:"count,omitempty"` + } + + // DedicatedHostAvailableCapacity dedicated host unutilized capacity. + type DedicatedHostAvailableCapacity struct { + // AllocatableVMs - The unutilized capacity of the dedicated host represented in terms of each VM size that is allowed to be deployed to the dedicated host. + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` + } + + // DedicatedHostGroup specifies information about the dedicated host group that the dedicated hosts should + // be assigned to.

Currently, a dedicated host can only be added to a dedicated host group at + // creation time. An existing dedicated host cannot be added to another dedicated host group. + type DedicatedHostGroup struct { + autorest.Response `json:"-"` + *DedicatedHostGroupProperties `json:"properties,omitempty"` + // Zones - Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostGroup. + func (dhg DedicatedHostGroup)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhg.DedicatedHostGroupProperties != nil) { + objectMap["properties"] = dhg.DedicatedHostGroupProperties + } + if(dhg.Zones != nil) { + objectMap["zones"] = dhg.Zones + } + if(dhg.Location != nil) { + objectMap["location"] = dhg.Location + } + if(dhg.Tags != nil) { + objectMap["tags"] = dhg.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DedicatedHostGroup struct. + func (dhg *DedicatedHostGroup) 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 dedicatedHostGroupProperties DedicatedHostGroupProperties + err = json.Unmarshal(*v, &dedicatedHostGroupProperties) + if err != nil { + return err + } + dhg.DedicatedHostGroupProperties = &dedicatedHostGroupProperties + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + dhg.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dhg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dhg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dhg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dhg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dhg.Tags = tags + } + } + } + + return nil + } + + // DedicatedHostGroupInstanceView ... + type DedicatedHostGroupInstanceView struct { + // Hosts - List of instance view of the dedicated hosts under the dedicated host group. + Hosts *[]DedicatedHostInstanceViewWithName `json:"hosts,omitempty"` + } + + // DedicatedHostGroupListResult the List Dedicated Host Group with resource group response. + type DedicatedHostGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of dedicated host groups + Value *[]DedicatedHostGroup `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with this URI to fetch the next page of Dedicated Host Groups. + NextLink *string `json:"nextLink,omitempty"` + } + + // DedicatedHostGroupListResultIterator provides access to a complete listing of DedicatedHostGroup values. + type DedicatedHostGroupListResultIterator struct { + i int + page DedicatedHostGroupListResultPage + } + // 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 * DedicatedHostGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupListResultIterator.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 * DedicatedHostGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter DedicatedHostGroupListResultIterator) 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 DedicatedHostGroupListResultIterator) Response() DedicatedHostGroupListResult { + 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 DedicatedHostGroupListResultIterator) Value() DedicatedHostGroup { + if !iter.page.NotDone() { + return DedicatedHostGroup{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the DedicatedHostGroupListResultIterator type. + func NewDedicatedHostGroupListResultIterator (page DedicatedHostGroupListResultPage) DedicatedHostGroupListResultIterator { + return DedicatedHostGroupListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (dhglr DedicatedHostGroupListResult) IsEmpty() bool { + return dhglr.Value == nil || len(*dhglr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (dhglr DedicatedHostGroupListResult) hasNextLink() bool { + return dhglr.NextLink != nil && len(*dhglr.NextLink) != 0 + } + // dedicatedHostGroupListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (dhglr DedicatedHostGroupListResult) dedicatedHostGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dhglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( dhglr.NextLink))); + } + + // DedicatedHostGroupListResultPage contains a page of DedicatedHostGroup values. + type DedicatedHostGroupListResultPage struct { + fn func(context.Context, DedicatedHostGroupListResult) (DedicatedHostGroupListResult, error) + dhglr DedicatedHostGroupListResult + } + + // 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 * DedicatedHostGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostGroupListResultPage.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.dhglr) + if err != nil { + return err + } + page.dhglr = 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 * DedicatedHostGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page DedicatedHostGroupListResultPage) NotDone() bool { + return !page.dhglr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page DedicatedHostGroupListResultPage) Response() DedicatedHostGroupListResult { + return page.dhglr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page DedicatedHostGroupListResultPage) Values() []DedicatedHostGroup { + if page.dhglr.IsEmpty() { + return nil + } + return *page.dhglr.Value + } + // Creates a new instance of the DedicatedHostGroupListResultPage type. + func NewDedicatedHostGroupListResultPage (cur DedicatedHostGroupListResult, getNextPage func(context.Context, DedicatedHostGroupListResult) (DedicatedHostGroupListResult, error)) DedicatedHostGroupListResultPage { + return DedicatedHostGroupListResultPage{ + fn: getNextPage, + dhglr: cur, + } + } + + // DedicatedHostGroupProperties dedicated Host Group Properties. + type DedicatedHostGroupProperties struct { + // PlatformFaultDomainCount - Number of fault domains that the host group can span. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + // Hosts - READ-ONLY; A list of references to all dedicated hosts in the dedicated host group. + Hosts *[]SubResourceReadOnly `json:"hosts,omitempty"` + // InstanceView - READ-ONLY; The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. + InstanceView *DedicatedHostGroupInstanceView `json:"instanceView,omitempty"` + // SupportAutomaticPlacement - Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided.

Minimum api-version: 2020-06-01. + SupportAutomaticPlacement *bool `json:"supportAutomaticPlacement,omitempty"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostGroupProperties. + func (dhgp DedicatedHostGroupProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhgp.PlatformFaultDomainCount != nil) { + objectMap["platformFaultDomainCount"] = dhgp.PlatformFaultDomainCount + } + if(dhgp.SupportAutomaticPlacement != nil) { + objectMap["supportAutomaticPlacement"] = dhgp.SupportAutomaticPlacement + } + return json.Marshal(objectMap) + } + + // DedicatedHostGroupUpdate specifies information about the dedicated host group that the dedicated host + // should be assigned to. Only tags may be updated. + type DedicatedHostGroupUpdate struct { + *DedicatedHostGroupProperties `json:"properties,omitempty"` + // Zones - Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. + Zones *[]string `json:"zones,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostGroupUpdate. + func (dhgu DedicatedHostGroupUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhgu.DedicatedHostGroupProperties != nil) { + objectMap["properties"] = dhgu.DedicatedHostGroupProperties + } + if(dhgu.Zones != nil) { + objectMap["zones"] = dhgu.Zones + } + if(dhgu.Tags != nil) { + objectMap["tags"] = dhgu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DedicatedHostGroupUpdate struct. + func (dhgu *DedicatedHostGroupUpdate) 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 dedicatedHostGroupProperties DedicatedHostGroupProperties + err = json.Unmarshal(*v, &dedicatedHostGroupProperties) + if err != nil { + return err + } + dhgu.DedicatedHostGroupProperties = &dedicatedHostGroupProperties + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + dhgu.Zones = &zones + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dhgu.Tags = tags + } + } + } + + return nil + } + + // DedicatedHostInstanceView the instance view of a dedicated host. + type DedicatedHostInstanceView struct { + // AssetID - READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string `json:"assetId,omitempty"` + // AvailableCapacity - Unutilized capacity of the dedicated host. + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostInstanceView. + func (dhiv DedicatedHostInstanceView)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhiv.AvailableCapacity != nil) { + objectMap["availableCapacity"] = dhiv.AvailableCapacity + } + if(dhiv.Statuses != nil) { + objectMap["statuses"] = dhiv.Statuses + } + return json.Marshal(objectMap) + } + + // DedicatedHostInstanceViewWithName the instance view of a dedicated host that includes the name of the + // dedicated host. It is used for the response to the instance view of a dedicated host group. + type DedicatedHostInstanceViewWithName struct { + // Name - READ-ONLY; The name of the dedicated host. + Name *string `json:"name,omitempty"` + // AssetID - READ-ONLY; Specifies the unique id of the dedicated physical machine on which the dedicated host resides. + AssetID *string `json:"assetId,omitempty"` + // AvailableCapacity - Unutilized capacity of the dedicated host. + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostInstanceViewWithName. + func (dhivwn DedicatedHostInstanceViewWithName)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhivwn.AvailableCapacity != nil) { + objectMap["availableCapacity"] = dhivwn.AvailableCapacity + } + if(dhivwn.Statuses != nil) { + objectMap["statuses"] = dhivwn.Statuses + } + return json.Marshal(objectMap) + } + + // DedicatedHostListResult the list dedicated host operation response. + type DedicatedHostListResult struct { + autorest.Response `json:"-"` + // Value - The list of dedicated hosts + Value *[]DedicatedHost `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of dedicated hosts. Call ListNext() with this URI to fetch the next page of dedicated hosts. + NextLink *string `json:"nextLink,omitempty"` + } + + // DedicatedHostListResultIterator provides access to a complete listing of DedicatedHost values. + type DedicatedHostListResultIterator struct { + i int + page DedicatedHostListResultPage + } + // 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 * DedicatedHostListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostListResultIterator.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 * DedicatedHostListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter DedicatedHostListResultIterator) 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 DedicatedHostListResultIterator) Response() DedicatedHostListResult { + 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 DedicatedHostListResultIterator) Value() DedicatedHost { + if !iter.page.NotDone() { + return DedicatedHost{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the DedicatedHostListResultIterator type. + func NewDedicatedHostListResultIterator (page DedicatedHostListResultPage) DedicatedHostListResultIterator { + return DedicatedHostListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (dhlr DedicatedHostListResult) IsEmpty() bool { + return dhlr.Value == nil || len(*dhlr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (dhlr DedicatedHostListResult) hasNextLink() bool { + return dhlr.NextLink != nil && len(*dhlr.NextLink) != 0 + } + // dedicatedHostListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (dhlr DedicatedHostListResult) dedicatedHostListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( dhlr.NextLink))); + } + + // DedicatedHostListResultPage contains a page of DedicatedHost values. + type DedicatedHostListResultPage struct { + fn func(context.Context, DedicatedHostListResult) (DedicatedHostListResult, error) + dhlr DedicatedHostListResult + } + + // 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 * DedicatedHostListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DedicatedHostListResultPage.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.dhlr) + if err != nil { + return err + } + page.dhlr = 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 * DedicatedHostListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page DedicatedHostListResultPage) NotDone() bool { + return !page.dhlr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page DedicatedHostListResultPage) Response() DedicatedHostListResult { + return page.dhlr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page DedicatedHostListResultPage) Values() []DedicatedHost { + if page.dhlr.IsEmpty() { + return nil + } + return *page.dhlr.Value + } + // Creates a new instance of the DedicatedHostListResultPage type. + func NewDedicatedHostListResultPage (cur DedicatedHostListResult, getNextPage func(context.Context, DedicatedHostListResult) (DedicatedHostListResult, error)) DedicatedHostListResultPage { + return DedicatedHostListResultPage{ + fn: getNextPage, + dhlr: cur, + } + } + + // DedicatedHostProperties properties of the dedicated host. + type DedicatedHostProperties struct { + // PlatformFaultDomain - Fault domain of the dedicated host within a dedicated host group. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + // AutoReplaceOnFailure - Specifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' when not provided. + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + // HostID - READ-ONLY; A unique id generated and assigned to the dedicated host by the platform.

Does not change throughout the lifetime of the host. + HostID *string `json:"hostId,omitempty"` + // VirtualMachines - READ-ONLY; A list of references to all virtual machines in the Dedicated Host. + VirtualMachines *[]SubResourceReadOnly `json:"virtualMachines,omitempty"` + // LicenseType - Specifies the software license type that will be applied to the VMs deployed on the dedicated host.

Possible values are:

**None**

**Windows_Server_Hybrid**

**Windows_Server_Perpetual**

Default: **None**. Possible values include: 'DedicatedHostLicenseTypesNone', 'DedicatedHostLicenseTypesWindowsServerHybrid', 'DedicatedHostLicenseTypesWindowsServerPerpetual' + LicenseType DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + // ProvisioningTime - READ-ONLY; The date when the host was first provisioned. + ProvisioningTime *date.Time `json:"provisioningTime,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // InstanceView - READ-ONLY; The dedicated host instance view. + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostProperties. + func (dhp DedicatedHostProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhp.PlatformFaultDomain != nil) { + objectMap["platformFaultDomain"] = dhp.PlatformFaultDomain + } + if(dhp.AutoReplaceOnFailure != nil) { + objectMap["autoReplaceOnFailure"] = dhp.AutoReplaceOnFailure + } + if(dhp.LicenseType != "") { + objectMap["licenseType"] = dhp.LicenseType + } + return json.Marshal(objectMap) + } + + // DedicatedHostsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type DedicatedHostsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DedicatedHostsCreateOrUpdateFuture) Result(client DedicatedHostsClient) (dh DedicatedHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DedicatedHostsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { + dh, err = client.CreateOrUpdateResponder(dh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsCreateOrUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") + } + } + return + } + + // DedicatedHostsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type DedicatedHostsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DedicatedHostsDeleteFuture) Result(client DedicatedHostsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DedicatedHostsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // DedicatedHostsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type DedicatedHostsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DedicatedHostsUpdateFuture) Result(client DedicatedHostsClient) (dh DedicatedHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DedicatedHostsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { + dh, err = client.UpdateResponder(dh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DedicatedHostsUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") + } + } + return + } + + // DedicatedHostUpdate specifies information about the dedicated host. Only tags, autoReplaceOnFailure and + // licenseType may be updated. + type DedicatedHostUpdate struct { + *DedicatedHostProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DedicatedHostUpdate. + func (dhu DedicatedHostUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dhu.DedicatedHostProperties != nil) { + objectMap["properties"] = dhu.DedicatedHostProperties + } + if(dhu.Tags != nil) { + objectMap["tags"] = dhu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DedicatedHostUpdate struct. + func (dhu *DedicatedHostUpdate) 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 dedicatedHostProperties DedicatedHostProperties + err = json.Unmarshal(*v, &dedicatedHostProperties) + if err != nil { + return err + } + dhu.DedicatedHostProperties = &dedicatedHostProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dhu.Tags = tags + } + } + } + + return nil + } + + // DiagnosticsProfile specifies the boot diagnostic settings state.

Minimum api-version: + // 2015-06-15. + type DiagnosticsProfile struct { + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

You can easily view the output of your console log.

Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` + } + + // DiffDiskSettings describes the parameters of ephemeral disk settings that can be specified for operating + // system disk.

NOTE: The ephemeral disk settings can only be specified for managed disk. + type DiffDiskSettings struct { + // Option - Specifies the ephemeral disk settings for operating system disk. Possible values include: 'Local' + Option DiffDiskOptions `json:"option,omitempty"` + // Placement - Specifies the ephemeral disk placement for operating system disk.

Possible values are:

**CacheDisk**

**ResourceDisk**

Default: **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** is used.

Refer to VM size documentation for Windows VM at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible values include: 'CacheDisk', 'ResourceDisk' + Placement DiffDiskPlacement `json:"placement,omitempty"` + } + + // DisallowedConfiguration specifies the disallowed configuration for a virtual machine image. + type DisallowedConfiguration struct { + // VMDiskType - VM disk types which are disallowed. Possible values include: 'VMDiskTypesNone', 'VMDiskTypesUnmanaged' + VMDiskType VMDiskTypes `json:"vmDiskType,omitempty"` + } + + // Disk disk resource. + type Disk struct { + autorest.Response `json:"-"` + // ManagedBy - READ-ONLY; A relative URI containing the ID of the VM that has the disk attached. + ManagedBy *string `json:"managedBy,omitempty"` + Sku *DiskSku `json:"sku,omitempty"` + // Zones - The Logical zone list for Disk. + Zones *[]string `json:"zones,omitempty"` + *DiskProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for Disk. + func (d Disk)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(d.Sku != nil) { + objectMap["sku"] = d.Sku + } + if(d.Zones != nil) { + objectMap["zones"] = d.Zones + } + if(d.DiskProperties != nil) { + objectMap["properties"] = d.DiskProperties + } + if(d.Location != nil) { + objectMap["location"] = d.Location + } + if(d.Tags != nil) { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for Disk struct. + func (d *Disk) 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 "managedBy": + if v != nil { + var managedBy string + err = json.Unmarshal(*v, &managedBy) + if err != nil { + return err + } + d.ManagedBy = &managedBy + } + case "sku": + if v != nil { + var sku DiskSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + d.Sku = &sku + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + d.Zones = &zones + } + case "properties": + if v != nil { + var diskProperties DiskProperties + err = json.Unmarshal(*v, &diskProperties) + if err != nil { + return err + } + d.DiskProperties = &diskProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil + } + + // DiskEncryptionSet disk encryption set resource. + type DiskEncryptionSet struct { + autorest.Response `json:"-"` + Identity *EncryptionSetIdentity `json:"identity,omitempty"` + *EncryptionSetProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DiskEncryptionSet. + func (desVar DiskEncryptionSet)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(desVar.Identity != nil) { + objectMap["identity"] = desVar.Identity + } + if(desVar.EncryptionSetProperties != nil) { + objectMap["properties"] = desVar.EncryptionSetProperties + } + if(desVar.Location != nil) { + objectMap["location"] = desVar.Location + } + if(desVar.Tags != nil) { + objectMap["tags"] = desVar.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DiskEncryptionSet struct. + func (desVar *DiskEncryptionSet) 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 "identity": + if v != nil { + var identity EncryptionSetIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + desVar.Identity = &identity + } + case "properties": + if v != nil { + var encryptionSetProperties EncryptionSetProperties + err = json.Unmarshal(*v, &encryptionSetProperties) + if err != nil { + return err + } + desVar.EncryptionSetProperties = &encryptionSetProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + desVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + desVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + desVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + desVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + desVar.Tags = tags + } + } + } + + return nil + } + + // DiskEncryptionSetList the List disk encryption set operation response. + type DiskEncryptionSetList struct { + autorest.Response `json:"-"` + // Value - A list of disk encryption sets. + Value *[]DiskEncryptionSet `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of disk encryption sets. Call ListNext() with this to fetch the next page of disk encryption sets. + NextLink *string `json:"nextLink,omitempty"` + } + + // DiskEncryptionSetListIterator provides access to a complete listing of DiskEncryptionSet values. + type DiskEncryptionSetListIterator struct { + i int + page DiskEncryptionSetListPage + } + // 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 * DiskEncryptionSetListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetListIterator.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 * DiskEncryptionSetListIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter DiskEncryptionSetListIterator) 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 DiskEncryptionSetListIterator) Response() DiskEncryptionSetList { + 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 DiskEncryptionSetListIterator) Value() DiskEncryptionSet { + if !iter.page.NotDone() { + return DiskEncryptionSet{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the DiskEncryptionSetListIterator type. + func NewDiskEncryptionSetListIterator (page DiskEncryptionSetListPage) DiskEncryptionSetListIterator { + return DiskEncryptionSetListIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (desl DiskEncryptionSetList) IsEmpty() bool { + return desl.Value == nil || len(*desl.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (desl DiskEncryptionSetList) hasNextLink() bool { + return desl.NextLink != nil && len(*desl.NextLink) != 0 + } + // diskEncryptionSetListPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (desl DiskEncryptionSetList) diskEncryptionSetListPreparer(ctx context.Context) (*http.Request, error) { + if !desl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( desl.NextLink))); + } + + // DiskEncryptionSetListPage contains a page of DiskEncryptionSet values. + type DiskEncryptionSetListPage struct { + fn func(context.Context, DiskEncryptionSetList) (DiskEncryptionSetList, error) + desl DiskEncryptionSetList + } + + // 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 * DiskEncryptionSetListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskEncryptionSetListPage.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.desl) + if err != nil { + return err + } + page.desl = 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 * DiskEncryptionSetListPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page DiskEncryptionSetListPage) NotDone() bool { + return !page.desl.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page DiskEncryptionSetListPage) Response() DiskEncryptionSetList { + return page.desl + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page DiskEncryptionSetListPage) Values() []DiskEncryptionSet { + if page.desl.IsEmpty() { + return nil + } + return *page.desl.Value + } + // Creates a new instance of the DiskEncryptionSetListPage type. + func NewDiskEncryptionSetListPage (cur DiskEncryptionSetList, getNextPage func(context.Context, DiskEncryptionSetList) (DiskEncryptionSetList, error)) DiskEncryptionSetListPage { + return DiskEncryptionSetListPage{ + fn: getNextPage, + desl: cur, + } + } + + // DiskEncryptionSetParameters describes the parameter of customer managed disk encryption set resource id + // that can be specified for disk.

NOTE: The disk encryption set resource id can only be specified + // for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + type DiskEncryptionSetParameters struct { + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // DiskEncryptionSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type DiskEncryptionSetsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DiskEncryptionSetsCreateOrUpdateFuture) Result(client DiskEncryptionSetsClient) (desVar DiskEncryptionSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DiskEncryptionSetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if desVar.Response.Response, err = future.GetResult(sender); err == nil && desVar.Response.Response.StatusCode != http.StatusNoContent { + desVar, err = client.CreateOrUpdateResponder(desVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsCreateOrUpdateFuture", "Result", desVar.Response.Response, "Failure responding to request") + } + } + return + } + + // DiskEncryptionSetsDeleteFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type DiskEncryptionSetsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DiskEncryptionSetsDeleteFuture) Result(client DiskEncryptionSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DiskEncryptionSetsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // DiskEncryptionSetsUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type DiskEncryptionSetsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DiskEncryptionSetsUpdateFuture) Result(client DiskEncryptionSetsClient) (desVar DiskEncryptionSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DiskEncryptionSetsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if desVar.Response.Response, err = future.GetResult(sender); err == nil && desVar.Response.Response.StatusCode != http.StatusNoContent { + desVar, err = client.UpdateResponder(desVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DiskEncryptionSetsUpdateFuture", "Result", desVar.Response.Response, "Failure responding to request") + } + } + return + } + + // DiskEncryptionSettings describes a Encryption Settings for a Disk + type DiskEncryptionSettings struct { + // DiskEncryptionKey - Specifies the location of the disk encryption key, which is a Key Vault Secret. + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` + // Enabled - Specifies whether disk encryption should be enabled on the virtual machine. + Enabled *bool `json:"enabled,omitempty"` + } + + // DiskEncryptionSetUpdate disk encryption set update resource. + type DiskEncryptionSetUpdate struct { + *DiskEncryptionSetUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for DiskEncryptionSetUpdate. + func (desu DiskEncryptionSetUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(desu.DiskEncryptionSetUpdateProperties != nil) { + objectMap["properties"] = desu.DiskEncryptionSetUpdateProperties + } + if(desu.Tags != nil) { + objectMap["tags"] = desu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DiskEncryptionSetUpdate struct. + func (desu *DiskEncryptionSetUpdate) 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 diskEncryptionSetUpdateProperties DiskEncryptionSetUpdateProperties + err = json.Unmarshal(*v, &diskEncryptionSetUpdateProperties) + if err != nil { + return err + } + desu.DiskEncryptionSetUpdateProperties = &diskEncryptionSetUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + desu.Tags = tags + } + } + } + + return nil + } + + // DiskEncryptionSetUpdateProperties disk encryption set resource update properties. + type DiskEncryptionSetUpdateProperties struct { + ActiveKey *KeyVaultAndKeyReference `json:"activeKey,omitempty"` + } + + // DiskInstanceView the instance view of the disk. + type DiskInstanceView struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // EncryptionSettings - Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15 + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // DiskList the List Disks operation response. + type DiskList struct { + autorest.Response `json:"-"` + // Value - A list of disks. + Value *[]Disk `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. + NextLink *string `json:"nextLink,omitempty"` + } + + // DiskListIterator provides access to a complete listing of Disk values. + type DiskListIterator struct { + i int + page DiskListPage + } + // 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 * DiskListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskListIterator.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 * DiskListIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter DiskListIterator) 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 DiskListIterator) Response() DiskList { + 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 DiskListIterator) Value() Disk { + if !iter.page.NotDone() { + return Disk{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the DiskListIterator type. + func NewDiskListIterator (page DiskListPage) DiskListIterator { + return DiskListIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (dl DiskList) IsEmpty() bool { + return dl.Value == nil || len(*dl.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (dl DiskList) hasNextLink() bool { + return dl.NextLink != nil && len(*dl.NextLink) != 0 + } + // diskListPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (dl DiskList) diskListPreparer(ctx context.Context) (*http.Request, error) { + if !dl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( dl.NextLink))); + } + + // DiskListPage contains a page of Disk values. + type DiskListPage struct { + fn func(context.Context, DiskList) (DiskList, error) + dl DiskList + } + + // 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 * DiskListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/DiskListPage.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.dl) + if err != nil { + return err + } + page.dl = 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 * DiskListPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page DiskListPage) NotDone() bool { + return !page.dl.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page DiskListPage) Response() DiskList { + return page.dl + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page DiskListPage) Values() []Disk { + if page.dl.IsEmpty() { + return nil + } + return *page.dl.Value + } + // Creates a new instance of the DiskListPage type. + func NewDiskListPage (cur DiskList, getNextPage func(context.Context, DiskList) (DiskList, error)) DiskListPage { + return DiskListPage{ + fn: getNextPage, + dl: cur, + } + } + + // DiskProperties disk resource properties. + type DiskProperties struct { + // TimeCreated - READ-ONLY; The time when the disk was created. + TimeCreated *date.Time `json:"timeCreated,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + HyperVGeneration HyperVGeneration `json:"hyperVGeneration,omitempty"` + // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // DiskSizeBytes - READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 `json:"diskSizeBytes,omitempty"` + // UniqueID - READ-ONLY; Unique Guid identifying the resource. + UniqueID *string `json:"uniqueId,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // ProvisioningState - READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` + // DiskState - READ-ONLY; The state of the disk. Possible values include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', 'ReadyToUpload', 'ActiveUpload' + DiskState DiskState `json:"diskState,omitempty"` + // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + } + + // MarshalJSON is the custom marshaler for DiskProperties. + func (dp DiskProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(dp.OsType != "") { + objectMap["osType"] = dp.OsType + } + if(dp.HyperVGeneration != "") { + objectMap["hyperVGeneration"] = dp.HyperVGeneration + } + if(dp.CreationData != nil) { + objectMap["creationData"] = dp.CreationData + } + if(dp.DiskSizeGB != nil) { + objectMap["diskSizeGB"] = dp.DiskSizeGB + } + if(dp.EncryptionSettingsCollection != nil) { + objectMap["encryptionSettingsCollection"] = dp.EncryptionSettingsCollection + } + if(dp.DiskIOPSReadWrite != nil) { + objectMap["diskIOPSReadWrite"] = dp.DiskIOPSReadWrite + } + if(dp.DiskMBpsReadWrite != nil) { + objectMap["diskMBpsReadWrite"] = dp.DiskMBpsReadWrite + } + if(dp.Encryption != nil) { + objectMap["encryption"] = dp.Encryption + } + return json.Marshal(objectMap) + } + + // DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type DisksCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return + } + + // DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. + type DisksDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DisksDeleteFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // DisksGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type DisksGrantAccessFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DisksGrantAccessFuture) Result(client DisksClient) (au AccessURI, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { + au, err = client.GrantAccessResponder(au.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") + } + } + return + } + + // DiskSku the disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, or UltraSSD_LRS. + type DiskSku struct { + // Name - The sku name. Possible values include: 'StandardLRS', 'PremiumLRS', 'StandardSSDLRS', 'UltraSSDLRS' + Name DiskStorageAccountTypes `json:"name,omitempty"` + // Tier - READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty"` + } + + // MarshalJSON is the custom marshaler for DiskSku. + func (ds DiskSku)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ds.Name != "") { + objectMap["name"] = ds.Name + } + return json.Marshal(objectMap) + } + + // DisksRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type DisksRevokeAccessFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DisksRevokeAccessFuture) Result(client DisksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture") + return + } + ar.Response = future.Response() + return + } + + // DisksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. + type DisksUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *DisksUpdateFuture) Result(client DisksClient) (d Disk, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return + } + + // DiskUpdate disk update resource. + type DiskUpdate struct { + *DiskUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + Sku *DiskSku `json:"sku,omitempty"` + } + + // MarshalJSON is the custom marshaler for DiskUpdate. + func (du DiskUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(du.DiskUpdateProperties != nil) { + objectMap["properties"] = du.DiskUpdateProperties + } + if(du.Tags != nil) { + objectMap["tags"] = du.Tags + } + if(du.Sku != nil) { + objectMap["sku"] = du.Sku + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for DiskUpdate struct. + func (du *DiskUpdate) 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 diskUpdateProperties DiskUpdateProperties + err = json.Unmarshal(*v, &diskUpdateProperties) + if err != nil { + return err + } + du.DiskUpdateProperties = &diskUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + du.Tags = tags + } + case "sku": + if v != nil { + var sku DiskSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + du.Sku = &sku + } + } + } + + return nil + } + + // DiskUpdateProperties disk resource update properties. + type DiskUpdateProperties struct { + // OsType - the Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // DiskIOPSReadWrite - The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. + DiskMBpsReadWrite *int32 `json:"diskMBpsReadWrite,omitempty"` + // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + } + + // Encryption encryption at rest settings for disk or snapshot + type Encryption struct { + // DiskEncryptionSetID - ResourceId of the disk encryption set to use for enabling encryption at rest. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` + // Type - The type of key used to encrypt the data of the disk. Possible values include: 'EncryptionAtRestWithPlatformKey', 'EncryptionAtRestWithCustomerKey' + Type EncryptionType `json:"type,omitempty"` + } + + // EncryptionSetIdentity the managed identity for the disk encryption set. It should be given permission on + // the key vault before it can be used to encrypt disks. + type EncryptionSetIdentity struct { + // Type - The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. Possible values include: 'SystemAssigned' + Type DiskEncryptionSetIdentityType `json:"type,omitempty"` + // PrincipalID - READ-ONLY; The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity + TenantID *string `json:"tenantId,omitempty"` + } + + // MarshalJSON is the custom marshaler for EncryptionSetIdentity. + func (esi EncryptionSetIdentity)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(esi.Type != "") { + objectMap["type"] = esi.Type + } + return json.Marshal(objectMap) + } + + // EncryptionSetProperties ... + type EncryptionSetProperties struct { + // ActiveKey - The key vault key which is currently used by this disk encryption set. + ActiveKey *KeyVaultAndKeyReference `json:"activeKey,omitempty"` + // PreviousKeys - READ-ONLY; A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. + PreviousKeys *[]KeyVaultAndKeyReference `json:"previousKeys,omitempty"` + // ProvisioningState - READ-ONLY; The disk encryption set provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + } + + // MarshalJSON is the custom marshaler for EncryptionSetProperties. + func (esp EncryptionSetProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(esp.ActiveKey != nil) { + objectMap["activeKey"] = esp.ActiveKey + } + return json.Marshal(objectMap) + } + + // EncryptionSettingsCollection encryption settings for disk or snapshot + type EncryptionSettingsCollection struct { + // Enabled - Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. + Enabled *bool `json:"enabled,omitempty"` + // EncryptionSettings - A collection of encryption settings, one for each disk volume. + EncryptionSettings *[]EncryptionSettingsElement `json:"encryptionSettings,omitempty"` + // EncryptionSettingsVersion - Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. + EncryptionSettingsVersion *string `json:"encryptionSettingsVersion,omitempty"` + } + + // EncryptionSettingsElement encryption settings for one disk volume. + type EncryptionSettingsElement struct { + // DiskEncryptionKey - Key Vault Secret Url and vault id of the disk encryption key + DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` + // KeyEncryptionKey - Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. + KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` + } + + // GrantAccessData data used for requesting a SAS. + type GrantAccessData struct { + // Access - Possible values include: 'None', 'Read', 'Write' + Access AccessLevel `json:"access,omitempty"` + // DurationInSeconds - Time duration in seconds until the SAS access expires. + DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` + } + + // HardwareProfile specifies the hardware settings for the virtual machine. + type HardwareProfile struct { + // VMSize - Specifies the size of the virtual machine. For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes).

The available VM sizes depend on region and availability set. For a list of available sizes use these APIs:

[List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes)

[List all available virtual machine sizes in a region]( https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list)

[List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes).

This list of sizes is no longer updated and the **VirtualMachineSizeTypes** string constants will be removed from the subsequent REST API specification. Use [List all available virtual machine sizes in a region]( https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) to get the latest sizes. Possible values include: 'BasicA0', 'BasicA1', 'BasicA2', 'BasicA3', 'BasicA4', 'StandardA0', 'StandardA1', 'StandardA2', 'StandardA3', 'StandardA4', 'StandardA5', 'StandardA6', 'StandardA7', 'StandardA8', 'StandardA9', 'StandardA10', 'StandardA11', 'StandardA1V2', 'StandardA2V2', 'StandardA4V2', 'StandardA8V2', 'StandardA2mV2', 'StandardA4mV2', 'StandardA8mV2', 'StandardB1s', 'StandardB1ms', 'StandardB2s', 'StandardB2ms', 'StandardB4ms', 'StandardB8ms', 'StandardD1', 'StandardD2', 'StandardD3', 'StandardD4', 'StandardD11', 'StandardD12', 'StandardD13', 'StandardD14', 'StandardD1V2', 'StandardD2V2', 'StandardD3V2', 'StandardD4V2', 'StandardD5V2', 'StandardD2V3', 'StandardD4V3', 'StandardD8V3', 'StandardD16V3', 'StandardD32V3', 'StandardD64V3', 'StandardD2sV3', 'StandardD4sV3', 'StandardD8sV3', 'StandardD16sV3', 'StandardD32sV3', 'StandardD64sV3', 'StandardD11V2', 'StandardD12V2', 'StandardD13V2', 'StandardD14V2', 'StandardD15V2', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardDS1V2', 'StandardDS2V2', 'StandardDS3V2', 'StandardDS4V2', 'StandardDS5V2', 'StandardDS11V2', 'StandardDS12V2', 'StandardDS13V2', 'StandardDS14V2', 'StandardDS15V2', 'StandardDS134V2', 'StandardDS132V2', 'StandardDS148V2', 'StandardDS144V2', 'StandardE2V3', 'StandardE4V3', 'StandardE8V3', 'StandardE16V3', 'StandardE32V3', 'StandardE64V3', 'StandardE2sV3', 'StandardE4sV3', 'StandardE8sV3', 'StandardE16sV3', 'StandardE32sV3', 'StandardE64sV3', 'StandardE3216V3', 'StandardE328sV3', 'StandardE6432sV3', 'StandardE6416sV3', 'StandardF1', 'StandardF2', 'StandardF4', 'StandardF8', 'StandardF16', 'StandardF1s', 'StandardF2s', 'StandardF4s', 'StandardF8s', 'StandardF16s', 'StandardF2sV2', 'StandardF4sV2', 'StandardF8sV2', 'StandardF16sV2', 'StandardF32sV2', 'StandardF64sV2', 'StandardF72sV2', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5', 'StandardGS48', 'StandardGS44', 'StandardGS516', 'StandardGS58', 'StandardH8', 'StandardH16', 'StandardH8m', 'StandardH16m', 'StandardH16r', 'StandardH16mr', 'StandardL4s', 'StandardL8s', 'StandardL16s', 'StandardL32s', 'StandardM64s', 'StandardM64ms', 'StandardM128s', 'StandardM128ms', 'StandardM6432ms', 'StandardM6416ms', 'StandardM12864ms', 'StandardM12832ms', 'StandardNC6', 'StandardNC12', 'StandardNC24', 'StandardNC24r', 'StandardNC6sV2', 'StandardNC12sV2', 'StandardNC24sV2', 'StandardNC24rsV2', 'StandardNC6sV3', 'StandardNC12sV3', 'StandardNC24sV3', 'StandardNC24rsV3', 'StandardND6s', 'StandardND12s', 'StandardND24s', 'StandardND24rs', 'StandardNV6', 'StandardNV12', 'StandardNV24' + VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` + } + + // Image the source user image virtual hard disk. The virtual hard disk will be copied before being + // attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not + // exist. + type Image struct { + autorest.Response `json:"-"` + *ImageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for Image. + func (i Image)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(i.ImageProperties != nil) { + objectMap["properties"] = i.ImageProperties + } + if(i.Location != nil) { + objectMap["location"] = i.Location + } + if(i.Tags != nil) { + objectMap["tags"] = i.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for Image struct. + func (i *Image) 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 imageProperties ImageProperties + err = json.Unmarshal(*v, &imageProperties) + if err != nil { + return err + } + i.ImageProperties = &imageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + i.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + i.Tags = tags + } + } + } + + return nil + } + + // ImageDataDisk describes a data disk. + type ImageDataDisk struct { + // Lun - 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"` + // Snapshot - The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + // ManagedDisk - The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + // BlobURI - The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // DiskEncryptionSet - Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + } + + // ImageDisk describes a image disk. + type ImageDisk struct { + // Snapshot - The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + // ManagedDisk - The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + // BlobURI - The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // DiskEncryptionSet - Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + } + + // ImageDiskReference the source image used for creating the disk. + type ImageDiskReference struct { + // ID - A relative uri containing either a Platform Image Repository or user image reference. + ID *string `json:"id,omitempty"` + // Lun - If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. + Lun *int32 `json:"lun,omitempty"` + } + + // ImageListResult the List Image operation response. + type ImageListResult struct { + autorest.Response `json:"-"` + // Value - The list of Images. + Value *[]Image `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. + NextLink *string `json:"nextLink,omitempty"` + } + + // ImageListResultIterator provides access to a complete listing of Image values. + type ImageListResultIterator struct { + i int + page ImageListResultPage + } + // 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 * ImageListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImageListResultIterator.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 * ImageListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter ImageListResultIterator) 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 ImageListResultIterator) Response() ImageListResult { + 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 ImageListResultIterator) Value() Image { + if !iter.page.NotDone() { + return Image{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the ImageListResultIterator type. + func NewImageListResultIterator (page ImageListResultPage) ImageListResultIterator { + return ImageListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (ilr ImageListResult) IsEmpty() bool { + return ilr.Value == nil || len(*ilr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (ilr ImageListResult) hasNextLink() bool { + return ilr.NextLink != nil && len(*ilr.NextLink) != 0 + } + // imageListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (ilr ImageListResult) imageListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( ilr.NextLink))); + } + + // ImageListResultPage contains a page of Image values. + type ImageListResultPage struct { + fn func(context.Context, ImageListResult) (ImageListResult, error) + ilr ImageListResult + } + + // 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 * ImageListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ImageListResultPage.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.ilr) + if err != nil { + return err + } + page.ilr = 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 * ImageListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page ImageListResultPage) NotDone() bool { + return !page.ilr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page ImageListResultPage) Response() ImageListResult { + return page.ilr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page ImageListResultPage) Values() []Image { + if page.ilr.IsEmpty() { + return nil + } + return *page.ilr.Value + } + // Creates a new instance of the ImageListResultPage type. + func NewImageListResultPage (cur ImageListResult, getNextPage func(context.Context, ImageListResult) (ImageListResult, error)) ImageListResultPage { + return ImageListResultPage{ + fn: getNextPage, + ilr: cur, + } + } + + // ImageOSDisk describes an Operating System disk. + type ImageOSDisk struct { + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // OsState - The OS State. Possible values include: 'Generalized', 'Specialized' + OsState OperatingSystemStateTypes `json:"osState,omitempty"` + // Snapshot - The snapshot. + Snapshot *SubResource `json:"snapshot,omitempty"` + // ManagedDisk - The managedDisk. + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + // BlobURI - The Virtual Hard Disk. + BlobURI *string `json:"blobUri,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // DiskEncryptionSet - Specifies the customer managed disk encryption set resource id for the managed image disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + } + + // ImageProperties describes the properties of an Image. + type ImageProperties struct { + // SourceVirtualMachine - The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // HyperVGeneration - Gets the HyperVGenerationType of the VirtualMachine created from the image. Possible values include: 'HyperVGenerationTypesV1', 'HyperVGenerationTypesV2' + HyperVGeneration HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + } + + // MarshalJSON is the custom marshaler for ImageProperties. + func (IP ImageProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(IP.SourceVirtualMachine != nil) { + objectMap["sourceVirtualMachine"] = IP.SourceVirtualMachine + } + if(IP.StorageProfile != nil) { + objectMap["storageProfile"] = IP.StorageProfile + } + if(IP.HyperVGeneration != "") { + objectMap["hyperVGeneration"] = IP.HyperVGeneration + } + return json.Marshal(objectMap) + } + + // ImageReference specifies information about the image to use. You can specify information about platform + // images, marketplace images, or virtual machine images. This element is required when you want to use a + // platform image, marketplace image, or virtual machine image, but is not used in other creation + // operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. + type ImageReference struct { + // Publisher - The image publisher. + Publisher *string `json:"publisher,omitempty"` + // Offer - Specifies the offer of the platform image or marketplace image used to create the virtual machine. + Offer *string `json:"offer,omitempty"` + // Sku - The image SKU. + Sku *string `json:"sku,omitempty"` + // Version - Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. + Version *string `json:"version,omitempty"` + // ExactVersion - READ-ONLY; Specifies in decimal numbers, the version of platform image or marketplace image used to create the virtual machine. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'. + ExactVersion *string `json:"exactVersion,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for ImageReference. + func (ir ImageReference)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ir.Publisher != nil) { + objectMap["publisher"] = ir.Publisher + } + if(ir.Offer != nil) { + objectMap["offer"] = ir.Offer + } + if(ir.Sku != nil) { + objectMap["sku"] = ir.Sku + } + if(ir.Version != nil) { + objectMap["version"] = ir.Version + } + if(ir.ID != nil) { + objectMap["id"] = ir.ID + } + return json.Marshal(objectMap) + } + + // ImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type ImagesCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.CreateOrUpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return + } + + // ImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. + type ImagesDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *ImagesDeleteFuture) Result(client ImagesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // ImageStorageProfile describes a storage profile. + type ImageStorageProfile struct { + // OsDisk - Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` + // ZoneResilient - Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` + } + + // ImagesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. + type ImagesUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *ImagesUpdateFuture) Result(client ImagesClient) (i Image, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.ImagesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.UpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return + } + + // ImageUpdate the source user image virtual hard disk. Only tags may be updated. + type ImageUpdate struct { + *ImageProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for ImageUpdate. + func (iu ImageUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(iu.ImageProperties != nil) { + objectMap["properties"] = iu.ImageProperties + } + if(iu.Tags != nil) { + objectMap["tags"] = iu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for ImageUpdate struct. + func (iu *ImageUpdate) 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 imageProperties ImageProperties + err = json.Unmarshal(*v, &imageProperties) + if err != nil { + return err + } + iu.ImageProperties = &imageProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + iu.Tags = tags + } + } + } + + return nil + } + + // InnerError inner error details. + type InnerError struct { + // Exceptiontype - The exception type. + Exceptiontype *string `json:"exceptiontype,omitempty"` + // Errordetail - The internal error message or exception dump. + Errordetail *string `json:"errordetail,omitempty"` + } + + // InstanceViewStatus instance view status. + type InstanceViewStatus struct { + // Code - The status code. + Code *string `json:"code,omitempty"` + // Level - The level code. Possible values include: 'Info', 'Warning', 'Error' + Level StatusLevelTypes `json:"level,omitempty"` + // DisplayStatus - The short localizable label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - The detailed status message, including for alerts and error messages. + Message *string `json:"message,omitempty"` + // Time - The time of the status. + Time *date.Time `json:"time,omitempty"` + } + + // KeyVaultAndKeyReference key Vault Key Url and vault id of KeK, KeK is optional and when provided is used + // to unwrap the encryptionKey + type KeyVaultAndKeyReference struct { + // SourceVault - Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` + // KeyURL - Url pointing to a key or secret in KeyVault + KeyURL *string `json:"keyUrl,omitempty"` + } + + // KeyVaultAndSecretReference key Vault Secret Url and vault id of the encryption key + type KeyVaultAndSecretReference struct { + // SourceVault - Resource id of the KeyVault containing the key or secret + SourceVault *SourceVault `json:"sourceVault,omitempty"` + // SecretURL - Url pointing to a key or secret in KeyVault + SecretURL *string `json:"secretUrl,omitempty"` + } + + // KeyVaultKeyReference describes a reference to Key Vault Key + type KeyVaultKeyReference struct { + // KeyURL - The URL referencing a key encryption key in Key Vault. + KeyURL *string `json:"keyUrl,omitempty"` + // SourceVault - The relative URL of the Key Vault containing the key. + SourceVault *SubResource `json:"sourceVault,omitempty"` + } + + // KeyVaultSecretReference describes a reference to Key Vault Secret + type KeyVaultSecretReference struct { + // SecretURL - The URL referencing a secret in a Key Vault. + SecretURL *string `json:"secretUrl,omitempty"` + // SourceVault - The relative URL of the Key Vault containing the secret. + SourceVault *SubResource `json:"sourceVault,omitempty"` + } + + // LastPatchInstallationSummary describes the properties of the last installed patch summary. + type LastPatchInstallationSummary struct { + // Status - READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", or "CompletedWithWarnings.". Possible values include: 'PatchOperationStatusInProgress', 'PatchOperationStatusFailed', 'PatchOperationStatusSucceeded', 'PatchOperationStatusCompletedWithWarnings' + Status PatchOperationStatus `json:"status,omitempty"` + // InstallationActivityID - READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. + InstallationActivityID *string `json:"installationActivityId,omitempty"` + // MaintenanceWindowExceeded - READ-ONLY; Describes whether the operation ran out of time before it completed all its intended actions + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + // RebootStatus - READ-ONLY; The reboot status of the machine after the patch operation. It will be in "NotNeeded" status if reboot is not needed after the patch operation. "Required" will be the status once the patch is applied and machine is required to reboot. "Started" will be the reboot status when the machine has started to reboot. "Failed" will be the status if the machine is failed to reboot. "Completed" will be the status once the machine is rebooted successfully. Possible values include: 'RebootStatusNotNeeded', 'RebootStatusRequired', 'RebootStatusStarted', 'RebootStatusFailed', 'RebootStatusCompleted' + RebootStatus RebootStatus `json:"rebootStatus,omitempty"` + // NotSelectedPatchCount - READ-ONLY; The number of all available patches but not going to be installed because it didn't match a classification or inclusion list entry. + NotSelectedPatchCount *int32 `json:"notSelectedPatchCount,omitempty"` + // ExcludedPatchCount - READ-ONLY; The number of all available patches but excluded explicitly by a customer-specified exclusion list match. + ExcludedPatchCount *int32 `json:"excludedPatchCount,omitempty"` + // PendingPatchCount - READ-ONLY; The number of all available patches expected to be installed over the course of the patch installation operation. + PendingPatchCount *int32 `json:"pendingPatchCount,omitempty"` + // InstalledPatchCount - READ-ONLY; The count of patches that successfully installed. + InstalledPatchCount *int32 `json:"installedPatchCount,omitempty"` + // FailedPatchCount - READ-ONLY; The count of patches that failed installation. + FailedPatchCount *int32 `json:"failedPatchCount,omitempty"` + // StartTime - READ-ONLY; The UTC timestamp when the operation began. + StartTime *date.Time `json:"startTime,omitempty"` + // LastModifiedTime - READ-ONLY; The UTC timestamp when the operation began. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // StartedBy - READ-ONLY; The person or system account that started the operation + StartedBy *string `json:"startedBy,omitempty"` + // Error - READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty"` + } + + // LinuxConfiguration specifies the Linux operating system settings on the virtual machine.

For a + // list of supported Linux distributions, see [Linux on Azure-Endorsed + // Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + //

For running non-endorsed distributions, see [Information for Non-Endorsed + // Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + type LinuxConfiguration struct { + // DisablePasswordAuthentication - Specifies whether password authentication should be disabled. + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + // SSH - Specifies the ssh key configuration for a Linux OS. + SSH *SSHConfiguration `json:"ssh,omitempty"` + // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine.

When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + } + + // ListUsagesResult the List Usages operation response. + type ListUsagesResult struct { + autorest.Response `json:"-"` + // Value - The list of compute resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page of compute resource usage information. + NextLink *string `json:"nextLink,omitempty"` + } + + // ListUsagesResultIterator provides access to a complete listing of Usage values. + type ListUsagesResultIterator struct { + i int + page ListUsagesResultPage + } + // 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 * ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ListUsagesResultIterator.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 * ListUsagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter ListUsagesResultIterator) 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 ListUsagesResultIterator) Response() ListUsagesResult { + 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 ListUsagesResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the ListUsagesResultIterator type. + func NewListUsagesResultIterator (page ListUsagesResultPage) ListUsagesResultIterator { + return ListUsagesResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (lur ListUsagesResult) IsEmpty() bool { + return lur.Value == nil || len(*lur.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (lur ListUsagesResult) hasNextLink() bool { + return lur.NextLink != nil && len(*lur.NextLink) != 0 + } + // listUsagesResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lur.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( lur.NextLink))); + } + + // ListUsagesResultPage contains a page of Usage values. + type ListUsagesResultPage struct { + fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) + lur ListUsagesResult + } + + // 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 * ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ListUsagesResultPage.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.lur) + if err != nil { + return err + } + page.lur = 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 * ListUsagesResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page ListUsagesResultPage) NotDone() bool { + return !page.lur.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page ListUsagesResultPage) Response() ListUsagesResult { + return page.lur + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page ListUsagesResultPage) Values() []Usage { + if page.lur.IsEmpty() { + return nil + } + return *page.lur.Value + } + // Creates a new instance of the ListUsagesResultPage type. + func NewListUsagesResultPage (cur ListUsagesResult, getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { + return ListUsagesResultPage{ + fn: getNextPage, + lur: cur, + } + } + + // ListVirtualMachineExtensionImage ... + type ListVirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` + } + + // ListVirtualMachineImageResource ... + type ListVirtualMachineImageResource struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineImageResource `json:"value,omitempty"` + } + + // LogAnalyticsExportRequestRateByIntervalFuture an abstraction for monitoring and retrieving the results + // of a long-running operation. + type LogAnalyticsExportRequestRateByIntervalFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *LogAnalyticsExportRequestRateByIntervalFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportRequestRateByIntervalFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if laor.Response.Response, err = future.GetResult(sender); err == nil && laor.Response.Response.StatusCode != http.StatusNoContent { + laor, err = client.ExportRequestRateByIntervalResponder(laor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", laor.Response.Response, "Failure responding to request") + } + } + return + } + + // LogAnalyticsExportThrottledRequestsFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type LogAnalyticsExportThrottledRequestsFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *LogAnalyticsExportThrottledRequestsFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportThrottledRequestsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if laor.Response.Response, err = future.GetResult(sender); err == nil && laor.Response.Response.StatusCode != http.StatusNoContent { + laor, err = client.ExportThrottledRequestsResponder(laor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", laor.Response.Response, "Failure responding to request") + } + } + return + } + + // LogAnalyticsInputBase api input base class for LogAnalytics Api. + type LogAnalyticsInputBase struct { + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + // GroupByClientApplicationID - Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + // GroupByUserAgent - Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + } + + // LogAnalyticsOperationResult logAnalytics operation status response + type LogAnalyticsOperationResult struct { + autorest.Response `json:"-"` + // Properties - READ-ONLY; LogAnalyticsOutput + Properties *LogAnalyticsOutput `json:"properties,omitempty"` + } + + // LogAnalyticsOutput logAnalytics output properties + type LogAnalyticsOutput struct { + // Output - READ-ONLY; Output file Uri path to blob container. + Output *string `json:"output,omitempty"` + } + + // MaintenanceRedeployStatus maintenance Operation Status. + type MaintenanceRedeployStatus struct { + // IsCustomerInitiatedMaintenanceAllowed - True, if customer is allowed to perform Maintenance. + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + // PreMaintenanceWindowStartTime - Start Time for the Pre Maintenance Window. + PreMaintenanceWindowStartTime *date.Time `json:"preMaintenanceWindowStartTime,omitempty"` + // PreMaintenanceWindowEndTime - End Time for the Pre Maintenance Window. + PreMaintenanceWindowEndTime *date.Time `json:"preMaintenanceWindowEndTime,omitempty"` + // MaintenanceWindowStartTime - Start Time for the Maintenance Window. + MaintenanceWindowStartTime *date.Time `json:"maintenanceWindowStartTime,omitempty"` + // MaintenanceWindowEndTime - End Time for the Maintenance Window. + MaintenanceWindowEndTime *date.Time `json:"maintenanceWindowEndTime,omitempty"` + // LastOperationResultCode - The Last Maintenance Operation Result Code. Possible values include: 'MaintenanceOperationResultCodeTypesNone', 'MaintenanceOperationResultCodeTypesRetryLater', 'MaintenanceOperationResultCodeTypesMaintenanceAborted', 'MaintenanceOperationResultCodeTypesMaintenanceCompleted' + LastOperationResultCode MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + // LastOperationMessage - Message returned for the last Maintenance Operation. + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + } + + // ManagedDiskParameters the parameters of a managed disk. + type ManagedDiskParameters struct { + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // DiskEncryptionSet - Specifies the customer managed disk encryption set resource id for the managed disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // NetworkInterfaceReference describes a network interface reference. + type NetworkInterfaceReference struct { + *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for NetworkInterfaceReference. + func (nir NetworkInterfaceReference)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(nir.NetworkInterfaceReferenceProperties != nil) { + objectMap["properties"] = nir.NetworkInterfaceReferenceProperties + } + if(nir.ID != nil) { + objectMap["id"] = nir.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for NetworkInterfaceReference struct. + func (nir *NetworkInterfaceReference) 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 networkInterfaceReferenceProperties NetworkInterfaceReferenceProperties + err = json.Unmarshal(*v, &networkInterfaceReferenceProperties) + if err != nil { + return err + } + nir.NetworkInterfaceReferenceProperties = &networkInterfaceReferenceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + nir.ID = &ID + } + } + } + + return nil + } + + // NetworkInterfaceReferenceProperties describes a network interface reference properties. + type NetworkInterfaceReferenceProperties struct { + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + } + + // NetworkProfile specifies the network interfaces of the virtual machine. + type NetworkProfile struct { + // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine. + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` + } + + // OperationListResult the List Compute Operation operation response. + type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of compute operations + Value *[]OperationValue `json:"value,omitempty"` + } + + // OperationValue describes the properties of a Compute Operation value. + type OperationValue struct { + // Origin - READ-ONLY; The origin of the compute operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the compute operation. + Name *string `json:"name,omitempty"` + *OperationValueDisplay `json:"display,omitempty"` + } + + // MarshalJSON is the custom marshaler for OperationValue. + func (ov OperationValue)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ov.OperationValueDisplay != nil) { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for OperationValue struct. + func (ov *OperationValue) 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 "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil + } + + // OperationValueDisplay describes the properties of a Compute Operation Value Display. + type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the compute operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` + } + + // OrchestrationServiceStateInput the input for OrchestrationServiceState + type OrchestrationServiceStateInput struct { + // ServiceName - The name of the service. Possible values include: 'AutomaticRepairs' + ServiceName OrchestrationServiceNames `json:"serviceName,omitempty"` + // Action - The action to be performed. Possible values include: 'Resume', 'Suspend' + Action OrchestrationServiceStateAction `json:"action,omitempty"` + } + + // OrchestrationServiceSummary summary for an orchestration service of a virtual machine scale set. + type OrchestrationServiceSummary struct { + // ServiceName - READ-ONLY; The name of the service. Possible values include: 'AutomaticRepairs', 'DummyOrchestrationServiceName' + ServiceName OrchestrationServiceNames `json:"serviceName,omitempty"` + // ServiceState - READ-ONLY; The current state of the service. Possible values include: 'NotRunning', 'Running', 'Suspended' + ServiceState OrchestrationServiceState `json:"serviceState,omitempty"` + } + + // OSDisk specifies information about the operating system disk used by the virtual machine.

For + // more information about disks, see [About disks and VHDs for Azure virtual + // machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + type OSDisk struct { + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.

Possible values are:

**Windows**

**Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // EncryptionSettings - Specifies the encryption settings for the OS Disk.

Minimum api-version: 2015-06-15 + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Vhd - The virtual hard disk. + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // Caching - Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None** for Standard storage. **ReadOnly** for Premium storage. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // DiffDiskSettings - Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + // CreateOption - Specifies how the virtual machine should be created.

Possible values are:

**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.

**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + } + + // OSDiskImage contains the os disk image information. + type OSDiskImage struct { + // OperatingSystem - The operating system of the osDiskImage. Possible values include: 'Windows', 'Linux' + OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` + } + + // OSProfile specifies the operating system settings for the virtual machine. Some of the settings cannot + // be changed once VM is provisioned. + type OSProfile struct { + // ComputerName - Specifies the host OS name of the virtual machine.

This name cannot be updated after the VM is created.

**Max-length (Windows):** 15 characters

**Max-length (Linux):** 64 characters.

For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). + ComputerName *string `json:"computerName,omitempty"` + // AdminUsername - Specifies the name of the administrator account.

This property cannot be updated after the VM is created.

**Windows-only restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length (Linux):** 1 character

**Max-length (Linux):** 64 characters

**Max-length (Windows):** 20 characters

  • For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
  • For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

    **Minimum-length (Windows):** 8 characters

    **Minimum-length (Linux):** 6 characters

    **Max-length (Windows):** 123 characters

    **Max-length (Linux):** 72 characters

    **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
    Has lower characters
    Has upper characters
    Has a digit
    Has a special character (Regex match [\W_])

    **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

    For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + AdminPassword *string `json:"adminPassword,omitempty"` + // CustomData - Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

    **Note: Do not pass any secrets or passwords in customData property**

    This property cannot be updated after the VM is created.

    customData is passed to the VM to be saved as a file, for more information see [Custom Data on Azure VMs](https://azure.microsoft.com/en-us/blog/custom-data-and-cloud-init-on-windows-azure/)

    For using cloud-init for your Linux VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

    For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)

    For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - Specifies set of certificates that should be installed onto the virtual machine. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + // AllowExtensionOperations - Specifies whether extension operations should be allowed on the virtual machine.

    This may only be set to False when no extensions are present on the virtual machine. + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + // RequireGuestProvisionSignal - Specifies whether the guest provision signal is required to infer provision success of the virtual machine. **Note: This property is for private testing only, and all customers must not set the property to false.** + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + } + + // PatchSettings ... + type PatchSettings struct { + // PatchMode - Specifies the mode of in-guest patching to IaaS virtual machine.

    Possible values are:

    **Manual** - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates must be false

    **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates must be true.

    ** AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. Possible values include: 'Manual', 'AutomaticByOS', 'AutomaticByPlatform' + PatchMode InGuestPatchMode `json:"patchMode,omitempty"` + } + + // Plan specifies information about the marketplace image used to create the virtual machine. This element + // is only used for marketplace images. Before you can use a marketplace image from an API, you must enable + // the image for programmatic use. In the Azure portal, find the marketplace image that you want to use + // and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and + // then click **Save**. + type Plan struct { + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string `json:"product,omitempty"` + // PromotionCode - The promotion code. + PromotionCode *string `json:"promotionCode,omitempty"` + } + + // ProximityPlacementGroup specifies information about the proximity placement group. + type ProximityPlacementGroup struct { + autorest.Response `json:"-"` + // ProximityPlacementGroupProperties - Describes the properties of a Proximity Placement Group. + *ProximityPlacementGroupProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for ProximityPlacementGroup. + func (ppg ProximityPlacementGroup)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ppg.ProximityPlacementGroupProperties != nil) { + objectMap["properties"] = ppg.ProximityPlacementGroupProperties + } + if(ppg.Location != nil) { + objectMap["location"] = ppg.Location + } + if(ppg.Tags != nil) { + objectMap["tags"] = ppg.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for ProximityPlacementGroup struct. + func (ppg *ProximityPlacementGroup) 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 proximityPlacementGroupProperties ProximityPlacementGroupProperties + err = json.Unmarshal(*v, &proximityPlacementGroupProperties) + if err != nil { + return err + } + ppg.ProximityPlacementGroupProperties = &proximityPlacementGroupProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ppg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ppg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ppg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ppg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ppg.Tags = tags + } + } + } + + return nil + } + + // ProximityPlacementGroupListResult the List Proximity Placement Group operation response. + type ProximityPlacementGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of proximity placement groups + Value *[]ProximityPlacementGroup `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of proximity placement groups. + NextLink *string `json:"nextLink,omitempty"` + } + + // ProximityPlacementGroupListResultIterator provides access to a complete listing of + // ProximityPlacementGroup values. + type ProximityPlacementGroupListResultIterator struct { + i int + page ProximityPlacementGroupListResultPage + } + // 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 * ProximityPlacementGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupListResultIterator.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 * ProximityPlacementGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter ProximityPlacementGroupListResultIterator) 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 ProximityPlacementGroupListResultIterator) Response() ProximityPlacementGroupListResult { + 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 ProximityPlacementGroupListResultIterator) Value() ProximityPlacementGroup { + if !iter.page.NotDone() { + return ProximityPlacementGroup{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the ProximityPlacementGroupListResultIterator type. + func NewProximityPlacementGroupListResultIterator (page ProximityPlacementGroupListResultPage) ProximityPlacementGroupListResultIterator { + return ProximityPlacementGroupListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (ppglr ProximityPlacementGroupListResult) IsEmpty() bool { + return ppglr.Value == nil || len(*ppglr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (ppglr ProximityPlacementGroupListResult) hasNextLink() bool { + return ppglr.NextLink != nil && len(*ppglr.NextLink) != 0 + } + // proximityPlacementGroupListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (ppglr ProximityPlacementGroupListResult) proximityPlacementGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ppglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( ppglr.NextLink))); + } + + // ProximityPlacementGroupListResultPage contains a page of ProximityPlacementGroup values. + type ProximityPlacementGroupListResultPage struct { + fn func(context.Context, ProximityPlacementGroupListResult) (ProximityPlacementGroupListResult, error) + ppglr ProximityPlacementGroupListResult + } + + // 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 * ProximityPlacementGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupListResultPage.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.ppglr) + if err != nil { + return err + } + page.ppglr = 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 * ProximityPlacementGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page ProximityPlacementGroupListResultPage) NotDone() bool { + return !page.ppglr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page ProximityPlacementGroupListResultPage) Response() ProximityPlacementGroupListResult { + return page.ppglr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page ProximityPlacementGroupListResultPage) Values() []ProximityPlacementGroup { + if page.ppglr.IsEmpty() { + return nil + } + return *page.ppglr.Value + } + // Creates a new instance of the ProximityPlacementGroupListResultPage type. + func NewProximityPlacementGroupListResultPage (cur ProximityPlacementGroupListResult, getNextPage func(context.Context, ProximityPlacementGroupListResult) (ProximityPlacementGroupListResult, error)) ProximityPlacementGroupListResultPage { + return ProximityPlacementGroupListResultPage{ + fn: getNextPage, + ppglr: cur, + } + } + + // ProximityPlacementGroupProperties describes the properties of a Proximity Placement Group. + type ProximityPlacementGroupProperties struct { + // ProximityPlacementGroupType - Specifies the type of the proximity placement group.

    Possible values are:

    **Standard** : Co-locate resources within an Azure region or Availability Zone.

    **Ultra** : For future use. Possible values include: 'Standard', 'Ultra' + ProximityPlacementGroupType ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + // VirtualMachines - READ-ONLY; A list of references to all virtual machines in the proximity placement group. + VirtualMachines *[]SubResourceWithColocationStatus `json:"virtualMachines,omitempty"` + // VirtualMachineScaleSets - READ-ONLY; A list of references to all virtual machine scale sets in the proximity placement group. + VirtualMachineScaleSets *[]SubResourceWithColocationStatus `json:"virtualMachineScaleSets,omitempty"` + // AvailabilitySets - READ-ONLY; A list of references to all availability sets in the proximity placement group. + AvailabilitySets *[]SubResourceWithColocationStatus `json:"availabilitySets,omitempty"` + // ColocationStatus - Describes colocation status of the Proximity Placement Group. + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + } + + // MarshalJSON is the custom marshaler for ProximityPlacementGroupProperties. + func (ppgp ProximityPlacementGroupProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ppgp.ProximityPlacementGroupType != "") { + objectMap["proximityPlacementGroupType"] = ppgp.ProximityPlacementGroupType + } + if(ppgp.ColocationStatus != nil) { + objectMap["colocationStatus"] = ppgp.ColocationStatus + } + return json.Marshal(objectMap) + } + + // ProximityPlacementGroupUpdate specifies information about the proximity placement group. + type ProximityPlacementGroupUpdate struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for ProximityPlacementGroupUpdate. + func (ppgu ProximityPlacementGroupUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ppgu.Tags != nil) { + objectMap["tags"] = ppgu.Tags + } + return json.Marshal(objectMap) + } + + // PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + type PurchasePlan struct { + // Publisher - The publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Name - The plan ID. + Name *string `json:"name,omitempty"` + // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + Product *string `json:"product,omitempty"` + } + + // RecoveryWalkResponse response after calling a manual recovery walk + type RecoveryWalkResponse struct { + autorest.Response `json:"-"` + // WalkPerformed - READ-ONLY; Whether the recovery walk was performed + WalkPerformed *bool `json:"walkPerformed,omitempty"` + // NextPlatformUpdateDomain - READ-ONLY; The next update domain that needs to be walked. Null means walk spanning all update domains has been completed + NextPlatformUpdateDomain *int32 `json:"nextPlatformUpdateDomain,omitempty"` + } + + // RequestRateByIntervalInput api request input for LogAnalytics getRequestRateByInterval Api. + type RequestRateByIntervalInput struct { + // IntervalLength - Interval value in minutes used to create LogAnalytics call rate logs. Possible values include: 'ThreeMins', 'FiveMins', 'ThirtyMins', 'SixtyMins' + IntervalLength IntervalInMins `json:"intervalLength,omitempty"` + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + // GroupByClientApplicationID - Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + // GroupByUserAgent - Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + } + + // Resource the Resource model definition. + type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for Resource. + func (r Resource)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(r.Location != nil) { + objectMap["location"] = r.Location + } + if(r.Tags != nil) { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) + } + + // RetrieveBootDiagnosticsDataResult the SAS URIs of the console screenshot and serial log blobs. + type RetrieveBootDiagnosticsDataResult struct { + autorest.Response `json:"-"` + // ConsoleScreenshotBlobURI - READ-ONLY; The console screenshot blob URI + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` + // SerialConsoleLogBlobURI - READ-ONLY; The serial console log blob URI. + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` + } + + // RollbackStatusInfo information about rollback on failed VM instances after a OS Upgrade operation. + type RollbackStatusInfo struct { + // SuccessfullyRolledbackInstanceCount - READ-ONLY; The number of instances which have been successfully rolled back. + SuccessfullyRolledbackInstanceCount *int32 `json:"successfullyRolledbackInstanceCount,omitempty"` + // FailedRolledbackInstanceCount - READ-ONLY; The number of instances which failed to rollback. + FailedRolledbackInstanceCount *int32 `json:"failedRolledbackInstanceCount,omitempty"` + // RollbackError - READ-ONLY; Error details if OS rollback failed. + RollbackError *APIError `json:"rollbackError,omitempty"` + } + + // RollingUpgradePolicy the configuration parameters used while performing a rolling upgrade. + type RollingUpgradePolicy struct { + // MaxBatchInstancePercent - The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. + MaxBatchInstancePercent *int32 `json:"maxBatchInstancePercent,omitempty"` + // MaxUnhealthyInstancePercent - The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%. + MaxUnhealthyInstancePercent *int32 `json:"maxUnhealthyInstancePercent,omitempty"` + // MaxUnhealthyUpgradedInstancePercent - The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. + MaxUnhealthyUpgradedInstancePercent *int32 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + // PauseTimeBetweenBatches - The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S). + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + } + + // RollingUpgradeProgressInfo information about the number of virtual machine instances in each upgrade + // state. + type RollingUpgradeProgressInfo struct { + // SuccessfulInstanceCount - READ-ONLY; The number of instances that have been successfully upgraded. + SuccessfulInstanceCount *int32 `json:"successfulInstanceCount,omitempty"` + // FailedInstanceCount - READ-ONLY; The number of instances that have failed to be upgraded successfully. + FailedInstanceCount *int32 `json:"failedInstanceCount,omitempty"` + // InProgressInstanceCount - READ-ONLY; The number of instances that are currently being upgraded. + InProgressInstanceCount *int32 `json:"inProgressInstanceCount,omitempty"` + // PendingInstanceCount - READ-ONLY; The number of instances that have not yet begun to be upgraded. + PendingInstanceCount *int32 `json:"pendingInstanceCount,omitempty"` + } + + // RollingUpgradeRunningStatus information about the current running state of the overall upgrade. + type RollingUpgradeRunningStatus struct { + // Code - READ-ONLY; Code indicating the current status of the upgrade. Possible values include: 'RollingForward', 'Cancelled', 'Completed', 'Faulted' + Code RollingUpgradeStatusCode `json:"code,omitempty"` + // StartTime - READ-ONLY; Start time of the upgrade. + StartTime *date.Time `json:"startTime,omitempty"` + // LastAction - READ-ONLY; The last action performed on the rolling upgrade. Possible values include: 'Start', 'Cancel' + LastAction RollingUpgradeActionType `json:"lastAction,omitempty"` + // LastActionTime - READ-ONLY; Last action time of the upgrade. + LastActionTime *date.Time `json:"lastActionTime,omitempty"` + } + + // RollingUpgradeStatusInfo the status of the latest virtual machine scale set rolling upgrade. + type RollingUpgradeStatusInfo struct { + autorest.Response `json:"-"` + *RollingUpgradeStatusInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for RollingUpgradeStatusInfo. + func (rusi RollingUpgradeStatusInfo)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(rusi.RollingUpgradeStatusInfoProperties != nil) { + objectMap["properties"] = rusi.RollingUpgradeStatusInfoProperties + } + if(rusi.Location != nil) { + objectMap["location"] = rusi.Location + } + if(rusi.Tags != nil) { + objectMap["tags"] = rusi.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for RollingUpgradeStatusInfo struct. + func (rusi *RollingUpgradeStatusInfo) 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 rollingUpgradeStatusInfoProperties RollingUpgradeStatusInfoProperties + err = json.Unmarshal(*v, &rollingUpgradeStatusInfoProperties) + if err != nil { + return err + } + rusi.RollingUpgradeStatusInfoProperties = &rollingUpgradeStatusInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rusi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rusi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rusi.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rusi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rusi.Tags = tags + } + } + } + + return nil + } + + // RollingUpgradeStatusInfoProperties the status of the latest virtual machine scale set rolling upgrade. + type RollingUpgradeStatusInfoProperties struct { + // Policy - READ-ONLY; The rolling upgrade policies applied for this upgrade. + Policy *RollingUpgradePolicy `json:"policy,omitempty"` + // RunningStatus - READ-ONLY; Information about the current running state of the overall upgrade. + RunningStatus *RollingUpgradeRunningStatus `json:"runningStatus,omitempty"` + // Progress - READ-ONLY; Information about the number of virtual machine instances in each upgrade state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + // Error - READ-ONLY; Error details for this upgrade, if there are any. + Error *APIError `json:"error,omitempty"` + } + + // ScaleInPolicy describes a scale-in policy for a virtual machine scale set. + type ScaleInPolicy struct { + // Rules - The rules to be followed when scaling-in a virtual machine scale set.

    Possible values are:

    **Default** When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not protected from scale-in.

    **OldestVM** When a virtual machine scale set is being scaled-in, the oldest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the oldest virtual machines that are not protected will be chosen for removal.

    **NewestVM** When a virtual machine scale set is being scaled-in, the newest virtual machines that are not protected from scale-in will be chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced across zones. Within each zone, the newest virtual machines that are not protected will be chosen for removal.

    + Rules *[]VirtualMachineScaleSetScaleInRules `json:"rules,omitempty"` + } + + // ScheduledEventsProfile ... + type ScheduledEventsProfile struct { + // TerminateNotificationProfile - Specifies Terminate Scheduled Event related configurations. + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` + } + + // SecurityProfile specifies the Security profile settings for the virtual machine or virtual machine scale + // set. + type SecurityProfile struct { + // EncryptionAtHost - This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual machine scale set. This will enable the encryption for all the disks including Resource/Temp disk at host itself.

    Default: The Encryption at host will be disabled unless this property is set to true for the resource. + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + } + + // Sku describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware + // the scale set is currently on, you need to deallocate the VMs in the scale set before you modify the SKU + // name. + type Sku struct { + // Name - The sku name. + Name *string `json:"name,omitempty"` + // Tier - Specifies the tier of virtual machines in a scale set.

    Possible Values:

    **Standard**

    **Basic** + Tier *string `json:"tier,omitempty"` + // Capacity - Specifies the number of virtual machines in the scale set. + Capacity *int64 `json:"capacity,omitempty"` + } + + // Snapshot snapshot resource. + type Snapshot struct { + autorest.Response `json:"-"` + // ManagedBy - READ-ONLY; Unused. Always Null. + ManagedBy *string `json:"managedBy,omitempty"` + Sku *SnapshotSku `json:"sku,omitempty"` + *SnapshotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for Snapshot. + func (s Snapshot)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(s.Sku != nil) { + objectMap["sku"] = s.Sku + } + if(s.SnapshotProperties != nil) { + objectMap["properties"] = s.SnapshotProperties + } + if(s.Location != nil) { + objectMap["location"] = s.Location + } + if(s.Tags != nil) { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for Snapshot struct. + func (s *Snapshot) 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 "managedBy": + if v != nil { + var managedBy string + err = json.Unmarshal(*v, &managedBy) + if err != nil { + return err + } + s.ManagedBy = &managedBy + } + case "sku": + if v != nil { + var sku SnapshotSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + s.Sku = &sku + } + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil + } + + // SnapshotList the List Snapshots operation response. + type SnapshotList struct { + autorest.Response `json:"-"` + // Value - A list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. + NextLink *string `json:"nextLink,omitempty"` + } + + // SnapshotListIterator provides access to a complete listing of Snapshot values. + type SnapshotListIterator struct { + i int + page SnapshotListPage + } + // 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 * SnapshotListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotListIterator.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 * SnapshotListIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter SnapshotListIterator) 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 SnapshotListIterator) Response() SnapshotList { + 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 SnapshotListIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the SnapshotListIterator type. + func NewSnapshotListIterator (page SnapshotListPage) SnapshotListIterator { + return SnapshotListIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (sl SnapshotList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (sl SnapshotList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 + } + // snapshotListPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (sl SnapshotList) snapshotListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( sl.NextLink))); + } + + // SnapshotListPage contains a page of Snapshot values. + type SnapshotListPage struct { + fn func(context.Context, SnapshotList) (SnapshotList, error) + sl SnapshotList + } + + // 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 * SnapshotListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotListPage.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.sl) + if err != nil { + return err + } + page.sl = 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 * SnapshotListPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page SnapshotListPage) NotDone() bool { + return !page.sl.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page SnapshotListPage) Response() SnapshotList { + return page.sl + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page SnapshotListPage) Values() []Snapshot { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value + } + // Creates a new instance of the SnapshotListPage type. + func NewSnapshotListPage (cur SnapshotList, getNextPage func(context.Context, SnapshotList) (SnapshotList, error)) SnapshotListPage { + return SnapshotListPage{ + fn: getNextPage, + sl: cur, + } + } + + // SnapshotProperties snapshot resource properties. + type SnapshotProperties struct { + // TimeCreated - READ-ONLY; The time when the disk was created. + TimeCreated *date.Time `json:"timeCreated,omitempty"` + // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // HyperVGeneration - The hypervisor generation of the Virtual Machine. Applicable to OS disks only. Possible values include: 'V1', 'V2' + HyperVGeneration HyperVGeneration `json:"hyperVGeneration,omitempty"` + // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created. + CreationData *CreationData `json:"creationData,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // DiskSizeBytes - READ-ONLY; The size of the disk in bytes. This field is read only. + DiskSizeBytes *int64 `json:"diskSizeBytes,omitempty"` + // UniqueID - READ-ONLY; Unique Guid identifying the resource. + UniqueID *string `json:"uniqueId,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // ProvisioningState - READ-ONLY; The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Incremental - Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. + Incremental *bool `json:"incremental,omitempty"` + // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + } + + // MarshalJSON is the custom marshaler for SnapshotProperties. + func (sp SnapshotProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(sp.OsType != "") { + objectMap["osType"] = sp.OsType + } + if(sp.HyperVGeneration != "") { + objectMap["hyperVGeneration"] = sp.HyperVGeneration + } + if(sp.CreationData != nil) { + objectMap["creationData"] = sp.CreationData + } + if(sp.DiskSizeGB != nil) { + objectMap["diskSizeGB"] = sp.DiskSizeGB + } + if(sp.EncryptionSettingsCollection != nil) { + objectMap["encryptionSettingsCollection"] = sp.EncryptionSettingsCollection + } + if(sp.Incremental != nil) { + objectMap["incremental"] = sp.Incremental + } + if(sp.Encryption != nil) { + objectMap["encryption"] = sp.Encryption + } + return json.Marshal(objectMap) + } + + // SnapshotsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type SnapshotsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return + } + + // SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type SnapshotsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *SnapshotsDeleteFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // SnapshotsGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type SnapshotsGrantAccessFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *SnapshotsGrantAccessFuture) Result(client SnapshotsClient) (au AccessURI, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { + au, err = client.GrantAccessResponder(au.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") + } + } + return + } + + // SnapshotSku the snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + type SnapshotSku struct { + // Name - The sku name. Possible values include: 'SnapshotStorageAccountTypesStandardLRS', 'SnapshotStorageAccountTypesPremiumLRS', 'SnapshotStorageAccountTypesStandardZRS' + Name SnapshotStorageAccountTypes `json:"name,omitempty"` + // Tier - READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty"` + } + + // MarshalJSON is the custom marshaler for SnapshotSku. + func (ss SnapshotSku)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ss.Name != "") { + objectMap["name"] = ss.Name + } + return json.Marshal(objectMap) + } + + // SnapshotsRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type SnapshotsRevokeAccessFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *SnapshotsRevokeAccessFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture") + return + } + ar.Response = future.Response() + return + } + + // SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type SnapshotsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *SnapshotsUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return + } + + // SnapshotUpdate snapshot update resource. + type SnapshotUpdate struct { + *SnapshotUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + Sku *SnapshotSku `json:"sku,omitempty"` + } + + // MarshalJSON is the custom marshaler for SnapshotUpdate. + func (su SnapshotUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(su.SnapshotUpdateProperties != nil) { + objectMap["properties"] = su.SnapshotUpdateProperties + } + if(su.Tags != nil) { + objectMap["tags"] = su.Tags + } + if(su.Sku != nil) { + objectMap["sku"] = su.Sku + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for SnapshotUpdate struct. + func (su *SnapshotUpdate) 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 snapshotUpdateProperties SnapshotUpdateProperties + err = json.Unmarshal(*v, &snapshotUpdateProperties) + if err != nil { + return err + } + su.SnapshotUpdateProperties = &snapshotUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + su.Tags = tags + } + case "sku": + if v != nil { + var sku SnapshotSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + su.Sku = &sku + } + } + } + + return nil + } + + // SnapshotUpdateProperties snapshot resource update properties. + type SnapshotUpdateProperties struct { + // OsType - the Operating System type. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // EncryptionSettingsCollection - Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + // Encryption - Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. + Encryption *Encryption `json:"encryption,omitempty"` + } + + // SourceVault the vault id is an Azure Resource Manager Resource id in the form + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + type SourceVault struct { + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // SSHConfiguration SSH configuration for Linux based VMs running on Azure + type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` + } + + // SSHPublicKey contains information about SSH certificate public key and the path on the Linux VM where + // the public key is placed. + type SSHPublicKey struct { + // Path - Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + Path *string `json:"path,omitempty"` + // KeyData - SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format.

    For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + KeyData *string `json:"keyData,omitempty"` + } + + // SSHPublicKeyGenerateKeyPairResult response from generation of an SSH key pair. + type SSHPublicKeyGenerateKeyPairResult struct { + autorest.Response `json:"-"` + // PrivateKey - Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. + PrivateKey *string `json:"privateKey,omitempty"` + // PublicKey - Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. + PublicKey *string `json:"publicKey,omitempty"` + // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName} + ID *string `json:"id,omitempty"` + } + + // SSHPublicKeyResource specifies information about the SSH public key. + type SSHPublicKeyResource struct { + autorest.Response `json:"-"` + // SSHPublicKeyResourceProperties - Properties of the SSH public key. + *SSHPublicKeyResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for SSHPublicKeyResource. + func (spkr SSHPublicKeyResource)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(spkr.SSHPublicKeyResourceProperties != nil) { + objectMap["properties"] = spkr.SSHPublicKeyResourceProperties + } + if(spkr.Location != nil) { + objectMap["location"] = spkr.Location + } + if(spkr.Tags != nil) { + objectMap["tags"] = spkr.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for SSHPublicKeyResource struct. + func (spkr *SSHPublicKeyResource) 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 SSHPublicKeyResourceProperties SSHPublicKeyResourceProperties + err = json.Unmarshal(*v, &SSHPublicKeyResourceProperties) + if err != nil { + return err + } + spkr.SSHPublicKeyResourceProperties = &SSHPublicKeyResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spkr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spkr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spkr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spkr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spkr.Tags = tags + } + } + } + + return nil + } + + // SSHPublicKeyResourceProperties properties of the SSH public key. + type SSHPublicKeyResourceProperties struct { + // PublicKey - SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + PublicKey *string `json:"publicKey,omitempty"` + } + + // SSHPublicKeysGroupListResult the list SSH public keys operation response. + type SSHPublicKeysGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of SSH public keys + Value *[]SSHPublicKeyResource `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of SSH public keys. Call ListNext() with this URI to fetch the next page of SSH public keys. + NextLink *string `json:"nextLink,omitempty"` + } + + // SSHPublicKeysGroupListResultIterator provides access to a complete listing of SSHPublicKeyResource + // values. + type SSHPublicKeysGroupListResultIterator struct { + i int + page SSHPublicKeysGroupListResultPage + } + // 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 * SSHPublicKeysGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysGroupListResultIterator.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 * SSHPublicKeysGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter SSHPublicKeysGroupListResultIterator) 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 SSHPublicKeysGroupListResultIterator) Response() SSHPublicKeysGroupListResult { + 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 SSHPublicKeysGroupListResultIterator) Value() SSHPublicKeyResource { + if !iter.page.NotDone() { + return SSHPublicKeyResource{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the SSHPublicKeysGroupListResultIterator type. + func NewSSHPublicKeysGroupListResultIterator (page SSHPublicKeysGroupListResultPage) SSHPublicKeysGroupListResultIterator { + return SSHPublicKeysGroupListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (spkglr SSHPublicKeysGroupListResult) IsEmpty() bool { + return spkglr.Value == nil || len(*spkglr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (spkglr SSHPublicKeysGroupListResult) hasNextLink() bool { + return spkglr.NextLink != nil && len(*spkglr.NextLink) != 0 + } + // sSHPublicKeysGroupListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (spkglr SSHPublicKeysGroupListResult) sSHPublicKeysGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !spkglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( spkglr.NextLink))); + } + + // SSHPublicKeysGroupListResultPage contains a page of SSHPublicKeyResource values. + type SSHPublicKeysGroupListResultPage struct { + fn func(context.Context, SSHPublicKeysGroupListResult) (SSHPublicKeysGroupListResult, error) + spkglr SSHPublicKeysGroupListResult + } + + // 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 * SSHPublicKeysGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysGroupListResultPage.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.spkglr) + if err != nil { + return err + } + page.spkglr = 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 * SSHPublicKeysGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page SSHPublicKeysGroupListResultPage) NotDone() bool { + return !page.spkglr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page SSHPublicKeysGroupListResultPage) Response() SSHPublicKeysGroupListResult { + return page.spkglr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page SSHPublicKeysGroupListResultPage) Values() []SSHPublicKeyResource { + if page.spkglr.IsEmpty() { + return nil + } + return *page.spkglr.Value + } + // Creates a new instance of the SSHPublicKeysGroupListResultPage type. + func NewSSHPublicKeysGroupListResultPage (cur SSHPublicKeysGroupListResult, getNextPage func(context.Context, SSHPublicKeysGroupListResult) (SSHPublicKeysGroupListResult, error)) SSHPublicKeysGroupListResultPage { + return SSHPublicKeysGroupListResultPage{ + fn: getNextPage, + spkglr: cur, + } + } + + // SSHPublicKeyUpdateResource specifies information about the SSH public key. + type SSHPublicKeyUpdateResource struct { + // SSHPublicKeyResourceProperties - Properties of the SSH public key. + *SSHPublicKeyResourceProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for SSHPublicKeyUpdateResource. + func (spkur SSHPublicKeyUpdateResource)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(spkur.SSHPublicKeyResourceProperties != nil) { + objectMap["properties"] = spkur.SSHPublicKeyResourceProperties + } + if(spkur.Tags != nil) { + objectMap["tags"] = spkur.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for SSHPublicKeyUpdateResource struct. + func (spkur *SSHPublicKeyUpdateResource) 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 SSHPublicKeyResourceProperties SSHPublicKeyResourceProperties + err = json.Unmarshal(*v, &SSHPublicKeyResourceProperties) + if err != nil { + return err + } + spkur.SSHPublicKeyResourceProperties = &SSHPublicKeyResourceProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spkur.Tags = tags + } + } + } + + return nil + } + + // StorageProfile specifies the storage settings for the virtual machine disks. + type StorageProfile struct { + // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - Specifies information about the operating system disk used by the virtual machine.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *OSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + } + + // SubResource ... + type SubResource struct { + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // SubResourceReadOnly ... + type SubResourceReadOnly struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + } + + // SubResourceWithColocationStatus ... + type SubResourceWithColocationStatus struct { + // ColocationStatus - Describes colocation status of a resource in the Proximity Placement Group. + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // TerminateNotificationProfile ... + type TerminateNotificationProfile struct { + // NotBeforeTimeout - Configurable length of time a Virtual Machine being deleted will have to potentially approve the Terminate Scheduled Event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 minutes (PT5M) + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` + // Enable - Specifies whether the Terminate Scheduled event is enabled or disabled. + Enable *bool `json:"enable,omitempty"` + } + + // ThrottledRequestsInput api request input for LogAnalytics getThrottledRequests Api. + type ThrottledRequestsInput struct { + // BlobContainerSasURI - SAS Uri of the logging blob container to which LogAnalytics Api writes output logs to. + BlobContainerSasURI *string `json:"blobContainerSasUri,omitempty"` + // FromTime - From time of the query + FromTime *date.Time `json:"fromTime,omitempty"` + // ToTime - To time of the query + ToTime *date.Time `json:"toTime,omitempty"` + // GroupByThrottlePolicy - Group query result by Throttle Policy applied. + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + // GroupByOperationName - Group query result by Operation Name. + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + // GroupByResourceName - Group query result by Resource Name. + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + // GroupByClientApplicationID - Group query result by Client Application ID. + GroupByClientApplicationID *bool `json:"groupByClientApplicationId,omitempty"` + // GroupByUserAgent - Group query result by User Agent. + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + } + + // UpdateResource the Update Resource model definition. + type UpdateResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for UpdateResource. + func (ur UpdateResource)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(ur.Tags != nil) { + objectMap["tags"] = ur.Tags + } + return json.Marshal(objectMap) + } + + // UpgradeOperationHistoricalStatusInfo virtual Machine Scale Set OS Upgrade History operation response. + type UpgradeOperationHistoricalStatusInfo struct { + // Properties - READ-ONLY; Information about the properties of the upgrade operation. + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Resource location + Location *string `json:"location,omitempty"` + } + + // UpgradeOperationHistoricalStatusInfoProperties describes each OS upgrade on the Virtual Machine Scale + // Set. + type UpgradeOperationHistoricalStatusInfoProperties struct { + // RunningStatus - READ-ONLY; Information about the overall status of the upgrade operation. + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty"` + // Progress - READ-ONLY; Counts of the VMs in each state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + // Error - READ-ONLY; Error Details for this upgrade if there are any. + Error *APIError `json:"error,omitempty"` + // StartedBy - READ-ONLY; Invoker of the Upgrade Operation. Possible values include: 'Unknown', 'User', 'Platform' + StartedBy UpgradeOperationInvoker `json:"startedBy,omitempty"` + // TargetImageReference - READ-ONLY; Image Reference details + TargetImageReference *ImageReference `json:"targetImageReference,omitempty"` + // RollbackInfo - READ-ONLY; Information about OS rollback if performed + RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty"` + } + + // UpgradeOperationHistoryStatus information about the current running state of the overall upgrade. + type UpgradeOperationHistoryStatus struct { + // Code - READ-ONLY; Code indicating the current status of the upgrade. Possible values include: 'UpgradeStateRollingForward', 'UpgradeStateCancelled', 'UpgradeStateCompleted', 'UpgradeStateFaulted' + Code UpgradeState `json:"code,omitempty"` + // StartTime - READ-ONLY; Start time of the upgrade. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; End time of the upgrade. + EndTime *date.Time `json:"endTime,omitempty"` + } + + // UpgradePolicy describes an upgrade policy - automatic, manual, or rolling. + type UpgradePolicy struct { + // Mode - Specifies the mode of an upgrade to virtual machines in the scale set.

    Possible values are:

    **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.

    **Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'UpgradeModeAutomatic', 'UpgradeModeManual', 'UpgradeModeRolling' + Mode UpgradeMode `json:"mode,omitempty"` + // RollingUpgradePolicy - The configuration parameters used while performing a rolling upgrade. + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` + // AutomaticOSUpgradePolicy - Configuration parameters used for performing automatic OS Upgrade. + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` + } + + // Usage describes Compute Resource Usage. + type Usage struct { + // Unit - An enum describing the unit of usage measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current usage of the resource. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - The maximum permitted usage of the resource. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` + } + + // UsageName the Usage Names. + type UsageName struct { + // Value - The name of the resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - The localized name of the resource. + LocalizedValue *string `json:"localizedValue,omitempty"` + } + + // VaultCertificate describes a single certificate reference in a Key Vault, and where the certificate + // should reside on the VM. + type VaultCertificate struct { + // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:

    {
    "data":"",
    "dataType":"pfx",
    "password":""
    } + CertificateURL *string `json:"certificateUrl,omitempty"` + // CertificateStore - For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account.

    For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted. + CertificateStore *string `json:"certificateStore,omitempty"` + } + + // VaultSecretGroup describes a set of certificates which are all in the same Key Vault. + type VaultSecretGroup struct { + // SourceVault - The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + SourceVault *SubResource `json:"sourceVault,omitempty"` + // VaultCertificates - The list of key vault references in SourceVault which contain certificates. + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` + } + + // VirtualHardDisk describes the uri of a disk. + type VirtualHardDisk struct { + // URI - Specifies the virtual hard disk's uri. + URI *string `json:"uri,omitempty"` + } + + // VirtualMachine describes a Virtual Machine. + type VirtualMachine struct { + autorest.Response `json:"-"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineProperties `json:"properties,omitempty"` + // Resources - READ-ONLY; The virtual machine child extension resources. + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + // Identity - The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + // Zones - The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachine. + func (VM VirtualMachine)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(VM.Plan != nil) { + objectMap["plan"] = VM.Plan + } + if(VM.VirtualMachineProperties != nil) { + objectMap["properties"] = VM.VirtualMachineProperties + } + if(VM.Identity != nil) { + objectMap["identity"] = VM.Identity + } + if(VM.Zones != nil) { + objectMap["zones"] = VM.Zones + } + if(VM.Location != nil) { + objectMap["location"] = VM.Location + } + if(VM.Tags != nil) { + objectMap["tags"] = VM.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. + func (VM *VirtualMachine) 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 "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + VM.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineProperties VirtualMachineProperties + err = json.Unmarshal(*v, &virtualMachineProperties) + if err != nil { + return err + } + VM.VirtualMachineProperties = &virtualMachineProperties + } + case "resources": + if v != nil { + var resources []VirtualMachineExtension + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + VM.Resources = &resources + } + case "identity": + if v != nil { + var identity VirtualMachineIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + VM.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + VM.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + VM.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + VM.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + VM.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + VM.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + VM.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineAgentInstanceView the instance view of the VM Agent running on the virtual machine. + type VirtualMachineAgentInstanceView struct { + // VMAgentVersion - The VM Agent full version. + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` + // ExtensionHandlers - The virtual machine extension handler instance view. + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // VirtualMachineAssessPatchesResult describes the properties of an AssessPatches result. + type VirtualMachineAssessPatchesResult struct { + autorest.Response `json:"-"` + // Status - READ-ONLY; The overall success or failure status of the operation. It remains "InProgress" until the operation completes. At that point it will become "Failed", "Succeeded", or "CompletedWithWarnings.". Possible values include: 'PatchOperationStatusInProgress', 'PatchOperationStatusFailed', 'PatchOperationStatusSucceeded', 'PatchOperationStatusCompletedWithWarnings' + Status PatchOperationStatus `json:"status,omitempty"` + // AssessmentActivityID - READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. + AssessmentActivityID *string `json:"assessmentActivityId,omitempty"` + // RebootPending - READ-ONLY; The overall reboot status of the VM. It will be true when partially installed patches require a reboot to complete installation but the reboot has not yet occurred. + RebootPending *bool `json:"rebootPending,omitempty"` + // CriticalAndSecurityPatchCount - READ-ONLY; The number of critical or security patches that have been detected as available and not yet installed. + CriticalAndSecurityPatchCount *int32 `json:"criticalAndSecurityPatchCount,omitempty"` + // OtherPatchCount - READ-ONLY; The number of all available patches excluding critical and security. + OtherPatchCount *int32 `json:"otherPatchCount,omitempty"` + // StartDateTime - READ-ONLY; The UTC timestamp when the operation began. + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // Patches - READ-ONLY; The list of patches that have been detected as available for installation. + Patches *[]VirtualMachineSoftwarePatchProperties `json:"patches,omitempty"` + // Error - READ-ONLY; The errors that were encountered during execution of the operation. The details array contains the list of them. + Error *APIError `json:"error,omitempty"` + } + + // VirtualMachineCaptureParameters capture Virtual Machine parameters. + type VirtualMachineCaptureParameters struct { + // VhdPrefix - The captured virtual hard disk's name prefix. + VhdPrefix *string `json:"vhdPrefix,omitempty"` + // DestinationContainerName - The destination container name. + DestinationContainerName *string `json:"destinationContainerName,omitempty"` + // OverwriteVhds - Specifies whether to overwrite the destination virtual hard disk, in case of conflict. + OverwriteVhds *bool `json:"overwriteVhds,omitempty"` + } + + // VirtualMachineCaptureResult output of virtual machine capture operation. + type VirtualMachineCaptureResult struct { + autorest.Response `json:"-"` + // Schema - READ-ONLY; the schema of the captured virtual machine + Schema *string `json:"$schema,omitempty"` + // ContentVersion - READ-ONLY; the version of the content + ContentVersion *string `json:"contentVersion,omitempty"` + // Parameters - READ-ONLY; parameters of the captured virtual machine + Parameters interface{} `json:"parameters,omitempty"` + // Resources - READ-ONLY; a list of resource items of the captured virtual machine + Resources *[]interface{} `json:"resources,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineCaptureResult. + func (vmcr VirtualMachineCaptureResult)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmcr.ID != nil) { + objectMap["id"] = vmcr.ID + } + return json.Marshal(objectMap) + } + + // VirtualMachineExtension describes a Virtual Machine Extension. + type VirtualMachineExtension struct { + autorest.Response `json:"-"` + *VirtualMachineExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineExtension. + func (vme VirtualMachineExtension)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vme.VirtualMachineExtensionProperties != nil) { + objectMap["properties"] = vme.VirtualMachineExtensionProperties + } + if(vme.Location != nil) { + objectMap["location"] = vme.Location + } + if(vme.Tags != nil) { + objectMap["tags"] = vme.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineExtension struct. + func (vme *VirtualMachineExtension) 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 virtualMachineExtensionProperties VirtualMachineExtensionProperties + err = json.Unmarshal(*v, &virtualMachineExtensionProperties) + if err != nil { + return err + } + vme.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vme.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vme.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vme.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vme.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vme.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineExtensionHandlerInstanceView the instance view of a virtual machine extension handler. + type VirtualMachineExtensionHandlerInstanceView struct { + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // Status - The extension handler status. + Status *InstanceViewStatus `json:"status,omitempty"` + } + + // VirtualMachineExtensionImage describes a Virtual Machine Extension Image. + type VirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineExtensionImage. + func (vmei VirtualMachineExtensionImage)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmei.VirtualMachineExtensionImageProperties != nil) { + objectMap["properties"] = vmei.VirtualMachineExtensionImageProperties + } + if(vmei.Location != nil) { + objectMap["location"] = vmei.Location + } + if(vmei.Tags != nil) { + objectMap["tags"] = vmei.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionImage struct. + func (vmei *VirtualMachineExtensionImage) 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 virtualMachineExtensionImageProperties VirtualMachineExtensionImageProperties + err = json.Unmarshal(*v, &virtualMachineExtensionImageProperties) + if err != nil { + return err + } + vmei.VirtualMachineExtensionImageProperties = &virtualMachineExtensionImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmei.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmei.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmei.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmei.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmei.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineExtensionImageProperties describes the properties of a Virtual Machine Extension Image. + type VirtualMachineExtensionImageProperties struct { + // OperatingSystem - The operating system this extension supports. + OperatingSystem *string `json:"operatingSystem,omitempty"` + // ComputeRole - The type of role (IaaS or PaaS) this extension supports. + ComputeRole *string `json:"computeRole,omitempty"` + // HandlerSchema - The schema defined by publisher, where extension consumers should provide settings in a matching schema. + HandlerSchema *string `json:"handlerSchema,omitempty"` + // VMScaleSetEnabled - Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the extension is only enabled for CRP VMs but not VMSS. + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` + // SupportsMultipleExtensions - Whether the handler can support multiple extensions. + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` + } + + // VirtualMachineExtensionInstanceView the instance view of a virtual machine extension. + type VirtualMachineExtensionInstanceView struct { + // Name - The virtual machine extension name. + Name *string `json:"name,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // Substatuses - The resource status information. + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + } + + // VirtualMachineExtensionProperties describes the properties of a Virtual Machine Extension. + type VirtualMachineExtensionProperties struct { + // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // EnableAutomaticUpgrade - Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // InstanceView - The virtual machine extension instance view. + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineExtensionProperties. + func (vmep VirtualMachineExtensionProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmep.ForceUpdateTag != nil) { + objectMap["forceUpdateTag"] = vmep.ForceUpdateTag + } + if(vmep.Publisher != nil) { + objectMap["publisher"] = vmep.Publisher + } + if(vmep.Type != nil) { + objectMap["type"] = vmep.Type + } + if(vmep.TypeHandlerVersion != nil) { + objectMap["typeHandlerVersion"] = vmep.TypeHandlerVersion + } + if(vmep.AutoUpgradeMinorVersion != nil) { + objectMap["autoUpgradeMinorVersion"] = vmep.AutoUpgradeMinorVersion + } + if(vmep.EnableAutomaticUpgrade != nil) { + objectMap["enableAutomaticUpgrade"] = vmep.EnableAutomaticUpgrade + } + if(vmep.Settings != nil) { + objectMap["settings"] = vmep.Settings + } + if(vmep.ProtectedSettings != nil) { + objectMap["protectedSettings"] = vmep.ProtectedSettings + } + if(vmep.InstanceView != nil) { + objectMap["instanceView"] = vmep.InstanceView + } + return json.Marshal(objectMap) + } + + // VirtualMachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineExtensionsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineExtensionsCreateOrUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { + vme, err = client.CreateOrUpdateResponder(vme.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineExtensionsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineExtensionsListResult the List Extension operation response + type VirtualMachineExtensionsListResult struct { + autorest.Response `json:"-"` + // Value - The list of extensions + Value *[]VirtualMachineExtension `json:"value,omitempty"` + } + + // VirtualMachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineExtensionsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineExtensionsUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { + vme, err = client.UpdateResponder(vme.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineExtensionUpdate describes a Virtual Machine Extension. + type VirtualMachineExtensionUpdate struct { + *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate. + func (vmeu VirtualMachineExtensionUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmeu.VirtualMachineExtensionUpdateProperties != nil) { + objectMap["properties"] = vmeu.VirtualMachineExtensionUpdateProperties + } + if(vmeu.Tags != nil) { + objectMap["tags"] = vmeu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionUpdate struct. + func (vmeu *VirtualMachineExtensionUpdate) 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 virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties + err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties) + if err != nil { + return err + } + vmeu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmeu.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineExtensionUpdateProperties describes the properties of a Virtual Machine Extension. + type VirtualMachineExtensionUpdateProperties struct { + // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // EnableAutomaticUpgrade - Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + } + + // VirtualMachineHealthStatus the health status of the VM. + type VirtualMachineHealthStatus struct { + // Status - READ-ONLY; The health status information for the VM. + Status *InstanceViewStatus `json:"status,omitempty"` + } + + // VirtualMachineIdentity identity for the virtual machine. + type VirtualMachineIdentity struct { + // PrincipalID - READ-ONLY; The principal id of virtual machine identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the virtual machine. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*VirtualMachineIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineIdentity. + func (vmi VirtualMachineIdentity)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmi.Type != "") { + objectMap["type"] = vmi.Type + } + if(vmi.UserAssignedIdentities != nil) { + objectMap["userAssignedIdentities"] = vmi.UserAssignedIdentities + } + return json.Marshal(objectMap) + } + + // VirtualMachineIdentityUserAssignedIdentitiesValue ... + type VirtualMachineIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` + } + + // VirtualMachineImage describes a Virtual Machine Image. + type VirtualMachineImage struct { + autorest.Response `json:"-"` + *VirtualMachineImageProperties `json:"properties,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Location - The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineImage. + func (vmi VirtualMachineImage)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmi.VirtualMachineImageProperties != nil) { + objectMap["properties"] = vmi.VirtualMachineImageProperties + } + if(vmi.Name != nil) { + objectMap["name"] = vmi.Name + } + if(vmi.Location != nil) { + objectMap["location"] = vmi.Location + } + if(vmi.Tags != nil) { + objectMap["tags"] = vmi.Tags + } + if(vmi.ID != nil) { + objectMap["id"] = vmi.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineImage struct. + func (vmi *VirtualMachineImage) 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 virtualMachineImageProperties VirtualMachineImageProperties + err = json.Unmarshal(*v, &virtualMachineImageProperties) + if err != nil { + return err + } + vmi.VirtualMachineImageProperties = &virtualMachineImageProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmi.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmi.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmi.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineImageProperties describes the properties of a Virtual Machine Image. + type VirtualMachineImageProperties struct { + Plan *PurchasePlan `json:"plan,omitempty"` + OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties `json:"automaticOSUpgradeProperties,omitempty"` + // HyperVGeneration - Possible values include: 'HyperVGenerationTypesV1', 'HyperVGenerationTypesV2' + HyperVGeneration HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + // Disallowed - Specifies disallowed configuration for the VirtualMachine created from the image + Disallowed *DisallowedConfiguration `json:"disallowed,omitempty"` + } + + // VirtualMachineImageResource virtual machine image resource information. + type VirtualMachineImageResource struct { + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Location - The supported Azure location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). + Tags map[string]*string `json:"tags"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineImageResource. + func (vmir VirtualMachineImageResource)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmir.Name != nil) { + objectMap["name"] = vmir.Name + } + if(vmir.Location != nil) { + objectMap["location"] = vmir.Location + } + if(vmir.Tags != nil) { + objectMap["tags"] = vmir.Tags + } + if(vmir.ID != nil) { + objectMap["id"] = vmir.ID + } + return json.Marshal(objectMap) + } + + // VirtualMachineInstanceView the instance view of a virtual machine. + type VirtualMachineInstanceView struct { + autorest.Response `json:"-"` + // PlatformUpdateDomain - Specifies the update domain of the virtual machine. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + // PlatformFaultDomain - Specifies the fault domain of the virtual machine. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + // ComputerName - The computer name assigned to the virtual machine. + ComputerName *string `json:"computerName,omitempty"` + // OsName - The Operating System running on the virtual machine. + OsName *string `json:"osName,omitempty"` + // OsVersion - The version of Operating System running on the virtual machine. + OsVersion *string `json:"osVersion,omitempty"` + // HyperVGeneration - Specifies the HyperVGeneration Type associated with a resource. Possible values include: 'HyperVGenerationTypeV1', 'HyperVGenerationTypeV2' + HyperVGeneration HyperVGenerationType `json:"hyperVGeneration,omitempty"` + // RdpThumbPrint - The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + // VMAgent - The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + // MaintenanceRedeployStatus - The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + // Disks - The virtual machine disk information. + Disks *[]DiskInstanceView `json:"disks,omitempty"` + // Extensions - The extensions information. + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + // VMHealth - READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

    You can easily view the output of your console log.

    Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + // AssignedHost - READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when the virtual machine is associated with a dedicated host group that has automatic placement enabled.

    Minimum api-version: 2020-06-01. + AssignedHost *string `json:"assignedHost,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + // PatchStatus - The status of virtual machine patch operations. + PatchStatus *VirtualMachinePatchStatus `json:"patchStatus,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineInstanceView. + func (vmiv VirtualMachineInstanceView)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmiv.PlatformUpdateDomain != nil) { + objectMap["platformUpdateDomain"] = vmiv.PlatformUpdateDomain + } + if(vmiv.PlatformFaultDomain != nil) { + objectMap["platformFaultDomain"] = vmiv.PlatformFaultDomain + } + if(vmiv.ComputerName != nil) { + objectMap["computerName"] = vmiv.ComputerName + } + if(vmiv.OsName != nil) { + objectMap["osName"] = vmiv.OsName + } + if(vmiv.OsVersion != nil) { + objectMap["osVersion"] = vmiv.OsVersion + } + if(vmiv.HyperVGeneration != "") { + objectMap["hyperVGeneration"] = vmiv.HyperVGeneration + } + if(vmiv.RdpThumbPrint != nil) { + objectMap["rdpThumbPrint"] = vmiv.RdpThumbPrint + } + if(vmiv.VMAgent != nil) { + objectMap["vmAgent"] = vmiv.VMAgent + } + if(vmiv.MaintenanceRedeployStatus != nil) { + objectMap["maintenanceRedeployStatus"] = vmiv.MaintenanceRedeployStatus + } + if(vmiv.Disks != nil) { + objectMap["disks"] = vmiv.Disks + } + if(vmiv.Extensions != nil) { + objectMap["extensions"] = vmiv.Extensions + } + if(vmiv.BootDiagnostics != nil) { + objectMap["bootDiagnostics"] = vmiv.BootDiagnostics + } + if(vmiv.Statuses != nil) { + objectMap["statuses"] = vmiv.Statuses + } + if(vmiv.PatchStatus != nil) { + objectMap["patchStatus"] = vmiv.PatchStatus + } + return json.Marshal(objectMap) + } + + // VirtualMachineListResult the List Virtual Machine operation response. + type VirtualMachineListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machines. + Value *[]VirtualMachine `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineListResultIterator provides access to a complete listing of VirtualMachine values. + type VirtualMachineListResultIterator struct { + i int + page VirtualMachineListResultPage + } + // 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 * VirtualMachineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineListResultIterator.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 * VirtualMachineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineListResultIterator) 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 VirtualMachineListResultIterator) Response() VirtualMachineListResult { + 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 VirtualMachineListResultIterator) Value() VirtualMachine { + if !iter.page.NotDone() { + return VirtualMachine{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineListResultIterator type. + func NewVirtualMachineListResultIterator (page VirtualMachineListResultPage) VirtualMachineListResultIterator { + return VirtualMachineListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmlr VirtualMachineListResult) IsEmpty() bool { + return vmlr.Value == nil || len(*vmlr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmlr VirtualMachineListResult) hasNextLink() bool { + return vmlr.NextLink != nil && len(*vmlr.NextLink) != 0 + } + // virtualMachineListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmlr VirtualMachineListResult) virtualMachineListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmlr.NextLink))); + } + + // VirtualMachineListResultPage contains a page of VirtualMachine values. + type VirtualMachineListResultPage struct { + fn func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error) + vmlr VirtualMachineListResult + } + + // 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 * VirtualMachineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineListResultPage.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.vmlr) + if err != nil { + return err + } + page.vmlr = 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 * VirtualMachineListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineListResultPage) NotDone() bool { + return !page.vmlr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineListResultPage) Response() VirtualMachineListResult { + return page.vmlr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineListResultPage) Values() []VirtualMachine { + if page.vmlr.IsEmpty() { + return nil + } + return *page.vmlr.Value + } + // Creates a new instance of the VirtualMachineListResultPage type. + func NewVirtualMachineListResultPage (cur VirtualMachineListResult, getNextPage func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error)) VirtualMachineListResultPage { + return VirtualMachineListResultPage{ + fn: getNextPage, + vmlr: cur, + } + } + + // VirtualMachinePatchStatus the status of virtual machine patch operations. + type VirtualMachinePatchStatus struct { + // AvailablePatchSummary - The available patch summary of the latest assessment operation for the virtual machine. + AvailablePatchSummary *AvailablePatchSummary `json:"availablePatchSummary,omitempty"` + // LastPatchInstallationSummary - The installation summary of the latest installation operation for the virtual machine. + LastPatchInstallationSummary *LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` + } + + // VirtualMachineProperties describes the properties of a Virtual Machine. + type VirtualMachineProperties struct { + // HardwareProfile - Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the virtual machine. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // OsProfile - Specifies the operating system settings used while creating the virtual machine. Some of the settings cannot be changed once VM is provisioned. + OsProfile *OSProfile `json:"osProfile,omitempty"` + // NetworkProfile - Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // SecurityProfile - Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

    For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set.

    This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + // VirtualMachineScaleSet - Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set.

    This property cannot exist along with a non-null properties.availabilitySet reference.

    Minimum api‐version: 2019‐03‐01 + VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the virtual machine should be assigned to.

    Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // Priority - Specifies the priority for the virtual machine.

    Minimum api-version: 2019-03-01. Possible values include: 'Regular', 'Low', 'Spot' + Priority VirtualMachinePriorityTypes `json:"priority,omitempty"` + // EvictionPolicy - Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set.

    For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01.

    For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete' + EvictionPolicy VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + // BillingProfile - Specifies the billing related details of a Azure Spot virtual machine.

    Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + // Host - Specifies information about the dedicated host that the virtual machine resides in.

    Minimum api-version: 2018-10-01. + Host *SubResource `json:"host,omitempty"` + // HostGroup - Specifies information about the dedicated host group that the virtual machine resides in.

    Minimum api-version: 2020-06-01.

    NOTE: User cannot specify both host and hostGroup properties. + HostGroup *SubResource `json:"hostGroup,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // InstanceView - READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises.

    Possible values for Windows Server operating system are:

    Windows_Client

    Windows_Server

    Possible values for Linux Server operating system are:

    RHEL_BYOS (for RHEL)

    SLES_BYOS (for SUSE)

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)

    [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // VMID - READ-ONLY; Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + VMID *string `json:"vmId,omitempty"` + // ExtensionsTimeBudget - Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M).

    Minimum api-version: 2020-06-01 + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineProperties. + func (vmp VirtualMachineProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmp.HardwareProfile != nil) { + objectMap["hardwareProfile"] = vmp.HardwareProfile + } + if(vmp.StorageProfile != nil) { + objectMap["storageProfile"] = vmp.StorageProfile + } + if(vmp.AdditionalCapabilities != nil) { + objectMap["additionalCapabilities"] = vmp.AdditionalCapabilities + } + if(vmp.OsProfile != nil) { + objectMap["osProfile"] = vmp.OsProfile + } + if(vmp.NetworkProfile != nil) { + objectMap["networkProfile"] = vmp.NetworkProfile + } + if(vmp.SecurityProfile != nil) { + objectMap["securityProfile"] = vmp.SecurityProfile + } + if(vmp.DiagnosticsProfile != nil) { + objectMap["diagnosticsProfile"] = vmp.DiagnosticsProfile + } + if(vmp.AvailabilitySet != nil) { + objectMap["availabilitySet"] = vmp.AvailabilitySet + } + if(vmp.VirtualMachineScaleSet != nil) { + objectMap["virtualMachineScaleSet"] = vmp.VirtualMachineScaleSet + } + if(vmp.ProximityPlacementGroup != nil) { + objectMap["proximityPlacementGroup"] = vmp.ProximityPlacementGroup + } + if(vmp.Priority != "") { + objectMap["priority"] = vmp.Priority + } + if(vmp.EvictionPolicy != "") { + objectMap["evictionPolicy"] = vmp.EvictionPolicy + } + if(vmp.BillingProfile != nil) { + objectMap["billingProfile"] = vmp.BillingProfile + } + if(vmp.Host != nil) { + objectMap["host"] = vmp.Host + } + if(vmp.HostGroup != nil) { + objectMap["hostGroup"] = vmp.HostGroup + } + if(vmp.LicenseType != nil) { + objectMap["licenseType"] = vmp.LicenseType + } + if(vmp.ExtensionsTimeBudget != nil) { + objectMap["extensionsTimeBudget"] = vmp.ExtensionsTimeBudget + } + return json.Marshal(objectMap) + } + + // VirtualMachineReimageParameters parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk + // will always be reimaged + type VirtualMachineReimageParameters struct { + // TempDisk - Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` + } + + // VirtualMachinesAssessPatchesFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachinesAssessPatchesFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesAssessPatchesFuture) Result(client VirtualMachinesClient) (vmapr VirtualMachineAssessPatchesResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesAssessPatchesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesAssessPatchesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmapr.Response.Response, err = future.GetResult(sender); err == nil && vmapr.Response.Response.StatusCode != http.StatusNoContent { + vmapr, err = client.AssessPatchesResponder(vmapr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesAssessPatchesFuture", "Result", vmapr.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSet describes a Virtual Machine Scale Set. + type VirtualMachineScaleSet struct { + autorest.Response `json:"-"` + // Sku - The virtual machine scale set sku. + Sku *Sku `json:"sku,omitempty"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + // Zones - The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSet. + func (vmss VirtualMachineScaleSet)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmss.Sku != nil) { + objectMap["sku"] = vmss.Sku + } + if(vmss.Plan != nil) { + objectMap["plan"] = vmss.Plan + } + if(vmss.VirtualMachineScaleSetProperties != nil) { + objectMap["properties"] = vmss.VirtualMachineScaleSetProperties + } + if(vmss.Identity != nil) { + objectMap["identity"] = vmss.Identity + } + if(vmss.Zones != nil) { + objectMap["zones"] = vmss.Zones + } + if(vmss.Location != nil) { + objectMap["location"] = vmss.Location + } + if(vmss.Tags != nil) { + objectMap["tags"] = vmss.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSet struct. + func (vmss *VirtualMachineScaleSet) 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 "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmss.Sku = &sku + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmss.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineScaleSetProperties VirtualMachineScaleSetProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetProperties) + if err != nil { + return err + } + vmss.VirtualMachineScaleSetProperties = &virtualMachineScaleSetProperties + } + case "identity": + if v != nil { + var identity VirtualMachineScaleSetIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmss.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmss.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmss.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmss.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmss.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineScaleSetDataDisk describes a virtual machine scale set data disk. + type VirtualMachineScaleSetDataDisk struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Lun - 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"` + // Caching - Specifies the caching requirements.

    Possible values are:

    **None**

    **ReadOnly**

    **ReadWrite**

    Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - The create option. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + // DiskIOPSReadWrite - Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + // DiskMBpsReadWrite - Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB. + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + } + + // VirtualMachineScaleSetExtension describes a Virtual Machine Scale Set Extension. + type VirtualMachineScaleSetExtension struct { + autorest.Response `json:"-"` + // Name - The name of the extension. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtension. + func (vmsse VirtualMachineScaleSetExtension)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmsse.Name != nil) { + objectMap["name"] = vmsse.Name + } + if(vmsse.VirtualMachineScaleSetExtensionProperties != nil) { + objectMap["properties"] = vmsse.VirtualMachineScaleSetExtensionProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtension struct. + func (vmsse *VirtualMachineScaleSetExtension) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmsse.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmsse.Type = &typeVar + } + case "properties": + if v != nil { + var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties) + if err != nil { + return err + } + vmsse.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmsse.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetExtensionListResult the List VM scale set extension operation response. + type VirtualMachineScaleSetExtensionListResult struct { + autorest.Response `json:"-"` + // Value - The list of VM scale set extensions. + Value *[]VirtualMachineScaleSetExtension `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of VM scale set extensions. Call ListNext() with this to fetch the next page of VM scale set extensions. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetExtensionListResultIterator provides access to a complete listing of + // VirtualMachineScaleSetExtension values. + type VirtualMachineScaleSetExtensionListResultIterator struct { + i int + page VirtualMachineScaleSetExtensionListResultPage + } + // 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 * VirtualMachineScaleSetExtensionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionListResultIterator.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 * VirtualMachineScaleSetExtensionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetExtensionListResultIterator) 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 VirtualMachineScaleSetExtensionListResultIterator) Response() VirtualMachineScaleSetExtensionListResult { + 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 VirtualMachineScaleSetExtensionListResultIterator) Value() VirtualMachineScaleSetExtension { + if !iter.page.NotDone() { + return VirtualMachineScaleSetExtension{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetExtensionListResultIterator type. + func NewVirtualMachineScaleSetExtensionListResultIterator (page VirtualMachineScaleSetExtensionListResultPage) VirtualMachineScaleSetExtensionListResultIterator { + return VirtualMachineScaleSetExtensionListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmsselr VirtualMachineScaleSetExtensionListResult) IsEmpty() bool { + return vmsselr.Value == nil || len(*vmsselr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmsselr VirtualMachineScaleSetExtensionListResult) hasNextLink() bool { + return vmsselr.NextLink != nil && len(*vmsselr.NextLink) != 0 + } + // virtualMachineScaleSetExtensionListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmsselr VirtualMachineScaleSetExtensionListResult) virtualMachineScaleSetExtensionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmsselr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmsselr.NextLink))); + } + + // VirtualMachineScaleSetExtensionListResultPage contains a page of VirtualMachineScaleSetExtension values. + type VirtualMachineScaleSetExtensionListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetExtensionListResult) (VirtualMachineScaleSetExtensionListResult, error) + vmsselr VirtualMachineScaleSetExtensionListResult + } + + // 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 * VirtualMachineScaleSetExtensionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionListResultPage.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.vmsselr) + if err != nil { + return err + } + page.vmsselr = 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 * VirtualMachineScaleSetExtensionListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetExtensionListResultPage) NotDone() bool { + return !page.vmsselr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetExtensionListResultPage) Response() VirtualMachineScaleSetExtensionListResult { + return page.vmsselr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetExtensionListResultPage) Values() []VirtualMachineScaleSetExtension { + if page.vmsselr.IsEmpty() { + return nil + } + return *page.vmsselr.Value + } + // Creates a new instance of the VirtualMachineScaleSetExtensionListResultPage type. + func NewVirtualMachineScaleSetExtensionListResultPage (cur VirtualMachineScaleSetExtensionListResult, getNextPage func(context.Context, VirtualMachineScaleSetExtensionListResult) (VirtualMachineScaleSetExtensionListResult, error)) VirtualMachineScaleSetExtensionListResultPage { + return VirtualMachineScaleSetExtensionListResultPage{ + fn: getNextPage, + vmsselr: cur, + } + } + + // VirtualMachineScaleSetExtensionProfile describes a virtual machine scale set extension profile. + type VirtualMachineScaleSetExtensionProfile struct { + // Extensions - The virtual machine scale set child extension resources. + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` + // ExtensionsTimeBudget - Specifies the time alloted for all extensions to start. The time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in ISO 8601 format. The default value is 90 minutes (PT1H30M).

    Minimum api-version: 2020-06-01 + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + } + + // VirtualMachineScaleSetExtensionProperties describes the properties of a Virtual Machine Scale Set + // Extension. + type VirtualMachineScaleSetExtensionProperties struct { + // ForceUpdateTag - If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // Publisher - The name of the extension handler publisher. + Publisher *string `json:"publisher,omitempty"` + // Type - Specifies the type of the extension; an example is "CustomScriptExtension". + Type *string `json:"type,omitempty"` + // TypeHandlerVersion - Specifies the version of the script handler. + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // EnableAutomaticUpgrade - Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + // Settings - Json formatted public settings for the extension. + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtensionProperties. + func (vmssep VirtualMachineScaleSetExtensionProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssep.ForceUpdateTag != nil) { + objectMap["forceUpdateTag"] = vmssep.ForceUpdateTag + } + if(vmssep.Publisher != nil) { + objectMap["publisher"] = vmssep.Publisher + } + if(vmssep.Type != nil) { + objectMap["type"] = vmssep.Type + } + if(vmssep.TypeHandlerVersion != nil) { + objectMap["typeHandlerVersion"] = vmssep.TypeHandlerVersion + } + if(vmssep.AutoUpgradeMinorVersion != nil) { + objectMap["autoUpgradeMinorVersion"] = vmssep.AutoUpgradeMinorVersion + } + if(vmssep.EnableAutomaticUpgrade != nil) { + objectMap["enableAutomaticUpgrade"] = vmssep.EnableAutomaticUpgrade + } + if(vmssep.Settings != nil) { + objectMap["settings"] = vmssep.Settings + } + if(vmssep.ProtectedSettings != nil) { + objectMap["protectedSettings"] = vmssep.ProtectedSettings + } + if(vmssep.ProvisionAfterExtensions != nil) { + objectMap["provisionAfterExtensions"] = vmssep.ProvisionAfterExtensions + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the + // results of a long-running operation. + type VirtualMachineScaleSetExtensionsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetExtensionsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetExtensionsClient) (vmsse VirtualMachineScaleSetExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmsse.Response.Response, err = future.GetResult(sender); err == nil && vmsse.Response.Response.StatusCode != http.StatusNoContent { + vmsse, err = client.CreateOrUpdateResponder(vmsse.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", vmsse.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineScaleSetExtensionsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetExtensionsDeleteFuture) Result(client VirtualMachineScaleSetExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineScaleSetExtensionsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetExtensionsUpdateFuture) Result(client VirtualMachineScaleSetExtensionsClient) (vmsse VirtualMachineScaleSetExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmsse.Response.Response, err = future.GetResult(sender); err == nil && vmsse.Response.Response.StatusCode != http.StatusNoContent { + vmsse, err = client.UpdateResponder(vmsse.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsUpdateFuture", "Result", vmsse.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetExtensionUpdate describes a Virtual Machine Scale Set Extension. + type VirtualMachineScaleSetExtensionUpdate struct { + // Name - READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtensionUpdate. + func (vmsseu VirtualMachineScaleSetExtensionUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmsseu.VirtualMachineScaleSetExtensionProperties != nil) { + objectMap["properties"] = vmsseu.VirtualMachineScaleSetExtensionProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtensionUpdate struct. + func (vmsseu *VirtualMachineScaleSetExtensionUpdate) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmsseu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmsseu.Type = &typeVar + } + case "properties": + if v != nil { + var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties) + if err != nil { + return err + } + vmsseu.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmsseu.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetIdentity identity for the virtual machine scale set. + type VirtualMachineScaleSetIdentity struct { + // PrincipalID - READ-ONLY; The principal id of virtual machine scale set identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the virtual machine scale set. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the virtual machine scale set. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine scale set. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetIdentity. + func (vmssi VirtualMachineScaleSetIdentity)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssi.Type != "") { + objectMap["type"] = vmssi.Type + } + if(vmssi.UserAssignedIdentities != nil) { + objectMap["userAssignedIdentities"] = vmssi.UserAssignedIdentities + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue ... + type VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` + } + + // VirtualMachineScaleSetInstanceView the instance view of a virtual machine scale set. + type VirtualMachineScaleSetInstanceView struct { + autorest.Response `json:"-"` + // VirtualMachine - READ-ONLY; The instance view status summary for the virtual machine scale set. + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` + // Extensions - READ-ONLY; The extensions information. + Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + // OrchestrationServices - READ-ONLY; The orchestration services information. + OrchestrationServices *[]OrchestrationServiceSummary `json:"orchestrationServices,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetInstanceView. + func (vmssiv VirtualMachineScaleSetInstanceView)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssiv.Statuses != nil) { + objectMap["statuses"] = vmssiv.Statuses + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetInstanceViewStatusesSummary instance view statuses summary for virtual machines of + // a virtual machine scale set. + type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + // StatusesSummary - READ-ONLY; The extensions information. + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` + } + + // VirtualMachineScaleSetIPConfiguration describes a virtual machine scale set network profile's IP + // configuration. + type VirtualMachineScaleSetIPConfiguration struct { + // Name - The IP configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetIPConfiguration. + func (vmssic VirtualMachineScaleSetIPConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssic.Name != nil) { + objectMap["name"] = vmssic.Name + } + if(vmssic.VirtualMachineScaleSetIPConfigurationProperties != nil) { + objectMap["properties"] = vmssic.VirtualMachineScaleSetIPConfigurationProperties + } + if(vmssic.ID != nil) { + objectMap["id"] = vmssic.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetIPConfiguration struct. + func (vmssic *VirtualMachineScaleSetIPConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssic.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetIPConfigurationProperties VirtualMachineScaleSetIPConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetIPConfigurationProperties) + if err != nil { + return err + } + vmssic.VirtualMachineScaleSetIPConfigurationProperties = &virtualMachineScaleSetIPConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssic.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetIPConfigurationProperties describes a virtual machine scale set network profile's + // IP configuration properties. + type VirtualMachineScaleSetIPConfigurationProperties struct { + // Subnet - Specifies the identifier of the subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddressConfiguration - The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + // PrivateIPAddressVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // ApplicationGatewayBackendAddressPools - Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of multiple application gateways. Multiple scale sets cannot use the same application gateway. + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + // ApplicationSecurityGroups - Specifies an array of references to application security group. + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + // LoadBalancerBackendAddressPools - Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatPools - Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + } + + // VirtualMachineScaleSetIPTag contains the IP tag associated with the public IP address. + type VirtualMachineScaleSetIPTag struct { + // IPTagType - IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + // Tag - IP tag associated with the public IP. Example: SQL, Storage etc. + Tag *string `json:"tag,omitempty"` + } + + // VirtualMachineScaleSetListOSUpgradeHistory list of Virtual Machine Scale Set OS Upgrade History + // operation response. + type VirtualMachineScaleSetListOSUpgradeHistory struct { + autorest.Response `json:"-"` + // Value - The list of OS upgrades performed on the virtual machine scale set. + Value *[]UpgradeOperationHistoricalStatusInfo `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of OS Upgrade History. Call ListNext() with this to fetch the next page of history of upgrades. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetListOSUpgradeHistoryIterator provides access to a complete listing of + // UpgradeOperationHistoricalStatusInfo values. + type VirtualMachineScaleSetListOSUpgradeHistoryIterator struct { + i int + page VirtualMachineScaleSetListOSUpgradeHistoryPage + } + // 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 * VirtualMachineScaleSetListOSUpgradeHistoryIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListOSUpgradeHistoryIterator.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 * VirtualMachineScaleSetListOSUpgradeHistoryIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetListOSUpgradeHistoryIterator) 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 VirtualMachineScaleSetListOSUpgradeHistoryIterator) Response() VirtualMachineScaleSetListOSUpgradeHistory { + 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 VirtualMachineScaleSetListOSUpgradeHistoryIterator) Value() UpgradeOperationHistoricalStatusInfo { + if !iter.page.NotDone() { + return UpgradeOperationHistoricalStatusInfo{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetListOSUpgradeHistoryIterator type. + func NewVirtualMachineScaleSetListOSUpgradeHistoryIterator (page VirtualMachineScaleSetListOSUpgradeHistoryPage) VirtualMachineScaleSetListOSUpgradeHistoryIterator { + return VirtualMachineScaleSetListOSUpgradeHistoryIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) IsEmpty() bool { + return vmsslouh.Value == nil || len(*vmsslouh.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) hasNextLink() bool { + return vmsslouh.NextLink != nil && len(*vmsslouh.NextLink) != 0 + } + // virtualMachineScaleSetListOSUpgradeHistoryPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) virtualMachineScaleSetListOSUpgradeHistoryPreparer(ctx context.Context) (*http.Request, error) { + if !vmsslouh.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmsslouh.NextLink))); + } + + // VirtualMachineScaleSetListOSUpgradeHistoryPage contains a page of UpgradeOperationHistoricalStatusInfo + // values. + type VirtualMachineScaleSetListOSUpgradeHistoryPage struct { + fn func(context.Context, VirtualMachineScaleSetListOSUpgradeHistory) (VirtualMachineScaleSetListOSUpgradeHistory, error) + vmsslouh VirtualMachineScaleSetListOSUpgradeHistory + } + + // 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 * VirtualMachineScaleSetListOSUpgradeHistoryPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListOSUpgradeHistoryPage.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.vmsslouh) + if err != nil { + return err + } + page.vmsslouh = 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 * VirtualMachineScaleSetListOSUpgradeHistoryPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) NotDone() bool { + return !page.vmsslouh.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) Response() VirtualMachineScaleSetListOSUpgradeHistory { + return page.vmsslouh + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetListOSUpgradeHistoryPage) Values() []UpgradeOperationHistoricalStatusInfo { + if page.vmsslouh.IsEmpty() { + return nil + } + return *page.vmsslouh.Value + } + // Creates a new instance of the VirtualMachineScaleSetListOSUpgradeHistoryPage type. + func NewVirtualMachineScaleSetListOSUpgradeHistoryPage (cur VirtualMachineScaleSetListOSUpgradeHistory, getNextPage func(context.Context, VirtualMachineScaleSetListOSUpgradeHistory) (VirtualMachineScaleSetListOSUpgradeHistory, error)) VirtualMachineScaleSetListOSUpgradeHistoryPage { + return VirtualMachineScaleSetListOSUpgradeHistoryPage{ + fn: getNextPage, + vmsslouh: cur, + } + } + + // VirtualMachineScaleSetListResult the List Virtual Machine operation response. + type VirtualMachineScaleSetListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets. + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetListResultIterator provides access to a complete listing of VirtualMachineScaleSet + // values. + type VirtualMachineScaleSetListResultIterator struct { + i int + page VirtualMachineScaleSetListResultPage + } + // 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 * VirtualMachineScaleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListResultIterator.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 * VirtualMachineScaleSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetListResultIterator) 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 VirtualMachineScaleSetListResultIterator) Response() VirtualMachineScaleSetListResult { + 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 VirtualMachineScaleSetListResultIterator) Value() VirtualMachineScaleSet { + if !iter.page.NotDone() { + return VirtualMachineScaleSet{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetListResultIterator type. + func NewVirtualMachineScaleSetListResultIterator (page VirtualMachineScaleSetListResultPage) VirtualMachineScaleSetListResultIterator { + return VirtualMachineScaleSetListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmsslr VirtualMachineScaleSetListResult) IsEmpty() bool { + return vmsslr.Value == nil || len(*vmsslr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmsslr VirtualMachineScaleSetListResult) hasNextLink() bool { + return vmsslr.NextLink != nil && len(*vmsslr.NextLink) != 0 + } + // virtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmsslr VirtualMachineScaleSetListResult) virtualMachineScaleSetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmsslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmsslr.NextLink))); + } + + // VirtualMachineScaleSetListResultPage contains a page of VirtualMachineScaleSet values. + type VirtualMachineScaleSetListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error) + vmsslr VirtualMachineScaleSetListResult + } + + // 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 * VirtualMachineScaleSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListResultPage.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.vmsslr) + if err != nil { + return err + } + page.vmsslr = 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 * VirtualMachineScaleSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetListResultPage) NotDone() bool { + return !page.vmsslr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetListResultPage) Response() VirtualMachineScaleSetListResult { + return page.vmsslr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetListResultPage) Values() []VirtualMachineScaleSet { + if page.vmsslr.IsEmpty() { + return nil + } + return *page.vmsslr.Value + } + // Creates a new instance of the VirtualMachineScaleSetListResultPage type. + func NewVirtualMachineScaleSetListResultPage (cur VirtualMachineScaleSetListResult, getNextPage func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error)) VirtualMachineScaleSetListResultPage { + return VirtualMachineScaleSetListResultPage{ + fn: getNextPage, + vmsslr: cur, + } + } + + // VirtualMachineScaleSetListSkusResult the Virtual Machine Scale Set List Skus operation response. + type VirtualMachineScaleSetListSkusResult struct { + autorest.Response `json:"-"` + // Value - The list of skus available for the virtual machine scale set. + Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with this to fetch the next page of VMSS Skus. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetListSkusResultIterator provides access to a complete listing of + // VirtualMachineScaleSetSku values. + type VirtualMachineScaleSetListSkusResultIterator struct { + i int + page VirtualMachineScaleSetListSkusResultPage + } + // 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 * VirtualMachineScaleSetListSkusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListSkusResultIterator.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 * VirtualMachineScaleSetListSkusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetListSkusResultIterator) 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 VirtualMachineScaleSetListSkusResultIterator) Response() VirtualMachineScaleSetListSkusResult { + 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 VirtualMachineScaleSetListSkusResultIterator) Value() VirtualMachineScaleSetSku { + if !iter.page.NotDone() { + return VirtualMachineScaleSetSku{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetListSkusResultIterator type. + func NewVirtualMachineScaleSetListSkusResultIterator (page VirtualMachineScaleSetListSkusResultPage) VirtualMachineScaleSetListSkusResultIterator { + return VirtualMachineScaleSetListSkusResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmsslsr VirtualMachineScaleSetListSkusResult) IsEmpty() bool { + return vmsslsr.Value == nil || len(*vmsslsr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmsslsr VirtualMachineScaleSetListSkusResult) hasNextLink() bool { + return vmsslsr.NextLink != nil && len(*vmsslsr.NextLink) != 0 + } + // virtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmsslsr VirtualMachineScaleSetListSkusResult) virtualMachineScaleSetListSkusResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmsslsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmsslsr.NextLink))); + } + + // VirtualMachineScaleSetListSkusResultPage contains a page of VirtualMachineScaleSetSku values. + type VirtualMachineScaleSetListSkusResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error) + vmsslsr VirtualMachineScaleSetListSkusResult + } + + // 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 * VirtualMachineScaleSetListSkusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListSkusResultPage.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.vmsslsr) + if err != nil { + return err + } + page.vmsslsr = 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 * VirtualMachineScaleSetListSkusResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetListSkusResultPage) NotDone() bool { + return !page.vmsslsr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetListSkusResultPage) Response() VirtualMachineScaleSetListSkusResult { + return page.vmsslsr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetListSkusResultPage) Values() []VirtualMachineScaleSetSku { + if page.vmsslsr.IsEmpty() { + return nil + } + return *page.vmsslsr.Value + } + // Creates a new instance of the VirtualMachineScaleSetListSkusResultPage type. + func NewVirtualMachineScaleSetListSkusResultPage (cur VirtualMachineScaleSetListSkusResult, getNextPage func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error)) VirtualMachineScaleSetListSkusResultPage { + return VirtualMachineScaleSetListSkusResultPage{ + fn: getNextPage, + vmsslsr: cur, + } + } + + // VirtualMachineScaleSetListWithLinkResult the List Virtual Machine operation response. + type VirtualMachineScaleSetListWithLinkResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets. + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of Virtual Machine Scale Sets. + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetListWithLinkResultIterator provides access to a complete listing of + // VirtualMachineScaleSet values. + type VirtualMachineScaleSetListWithLinkResultIterator struct { + i int + page VirtualMachineScaleSetListWithLinkResultPage + } + // 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 * VirtualMachineScaleSetListWithLinkResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListWithLinkResultIterator.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 * VirtualMachineScaleSetListWithLinkResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetListWithLinkResultIterator) 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 VirtualMachineScaleSetListWithLinkResultIterator) Response() VirtualMachineScaleSetListWithLinkResult { + 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 VirtualMachineScaleSetListWithLinkResultIterator) Value() VirtualMachineScaleSet { + if !iter.page.NotDone() { + return VirtualMachineScaleSet{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetListWithLinkResultIterator type. + func NewVirtualMachineScaleSetListWithLinkResultIterator (page VirtualMachineScaleSetListWithLinkResultPage) VirtualMachineScaleSetListWithLinkResultIterator { + return VirtualMachineScaleSetListWithLinkResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) IsEmpty() bool { + return vmsslwlr.Value == nil || len(*vmsslwlr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) hasNextLink() bool { + return vmsslwlr.NextLink != nil && len(*vmsslwlr.NextLink) != 0 + } + // virtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) virtualMachineScaleSetListWithLinkResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmsslwlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmsslwlr.NextLink))); + } + + // VirtualMachineScaleSetListWithLinkResultPage contains a page of VirtualMachineScaleSet values. + type VirtualMachineScaleSetListWithLinkResultPage struct { + fn func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error) + vmsslwlr VirtualMachineScaleSetListWithLinkResult + } + + // 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 * VirtualMachineScaleSetListWithLinkResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetListWithLinkResultPage.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.vmsslwlr) + if err != nil { + return err + } + page.vmsslwlr = 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 * VirtualMachineScaleSetListWithLinkResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetListWithLinkResultPage) NotDone() bool { + return !page.vmsslwlr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetListWithLinkResultPage) Response() VirtualMachineScaleSetListWithLinkResult { + return page.vmsslwlr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetListWithLinkResultPage) Values() []VirtualMachineScaleSet { + if page.vmsslwlr.IsEmpty() { + return nil + } + return *page.vmsslwlr.Value + } + // Creates a new instance of the VirtualMachineScaleSetListWithLinkResultPage type. + func NewVirtualMachineScaleSetListWithLinkResultPage (cur VirtualMachineScaleSetListWithLinkResult, getNextPage func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error)) VirtualMachineScaleSetListWithLinkResultPage { + return VirtualMachineScaleSetListWithLinkResultPage{ + fn: getNextPage, + vmsslwlr: cur, + } + } + + // VirtualMachineScaleSetManagedDiskParameters describes the parameters of a ScaleSet managed disk. + type VirtualMachineScaleSetManagedDiskParameters struct { + // StorageAccountType - Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values include: 'StorageAccountTypesStandardLRS', 'StorageAccountTypesPremiumLRS', 'StorageAccountTypesStandardSSDLRS', 'StorageAccountTypesUltraSSDLRS' + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` + // DiskEncryptionSet - Specifies the customer managed disk encryption set resource id for the managed disk. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + } + + // VirtualMachineScaleSetNetworkConfiguration describes a virtual machine scale set network profile's + // network configurations. + type VirtualMachineScaleSetNetworkConfiguration struct { + // Name - The network configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetNetworkConfiguration. + func (vmssnc VirtualMachineScaleSetNetworkConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssnc.Name != nil) { + objectMap["name"] = vmssnc.Name + } + if(vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties != nil) { + objectMap["properties"] = vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties + } + if(vmssnc.ID != nil) { + objectMap["id"] = vmssnc.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetNetworkConfiguration struct. + func (vmssnc *VirtualMachineScaleSetNetworkConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssnc.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetNetworkConfigurationProperties VirtualMachineScaleSetNetworkConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetNetworkConfigurationProperties) + if err != nil { + return err + } + vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties = &virtualMachineScaleSetNetworkConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssnc.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetNetworkConfigurationDNSSettings describes a virtual machines scale sets network + // configuration's DNS settings. + type VirtualMachineScaleSetNetworkConfigurationDNSSettings struct { + // DNSServers - List of DNS servers IP addresses + DNSServers *[]string `json:"dnsServers,omitempty"` + } + + // VirtualMachineScaleSetNetworkConfigurationProperties describes a virtual machine scale set network + // profile's IP configuration. + type VirtualMachineScaleSetNetworkConfigurationProperties struct { + // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. + Primary *bool `json:"primary,omitempty"` + // EnableAcceleratedNetworking - Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // NetworkSecurityGroup - The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // DNSSettings - The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPConfigurations - Specifies the IP configurations of the network interface. + IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableIPForwarding - Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + } + + // VirtualMachineScaleSetNetworkProfile describes a virtual machine scale set network profile. + type VirtualMachineScaleSetNetworkProfile struct { + // HealthProbe - A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference `json:"healthProbe,omitempty"` + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` + } + + // VirtualMachineScaleSetOSDisk describes a virtual machine scale set operating system disk. + type VirtualMachineScaleSetOSDisk struct { + // Name - The disk name. + Name *string `json:"name,omitempty"` + // Caching - Specifies the caching requirements.

    Possible values are:

    **None**

    **ReadOnly**

    **ReadWrite**

    Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // CreateOption - Specifies how the virtual machines in the scale set should be created.

    The only allowed value is: **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + // DiffDiskSettings - Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine scale set. + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + // DiskSizeGB - Specifies the size of the operating system disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.

    Possible values are:

    **Windows**

    **Linux**. Possible values include: 'Windows', 'Linux' + OsType OperatingSystemTypes `json:"osType,omitempty"` + // Image - Specifies information about the unmanaged user image to base the scale set on. + Image *VirtualHardDisk `json:"image,omitempty"` + // VhdContainers - Specifies the container urls that are used to store operating system disks for the scale set. + VhdContainers *[]string `json:"vhdContainers,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + } + + // VirtualMachineScaleSetOSProfile describes a virtual machine scale set OS profile. + type VirtualMachineScaleSetOSProfile struct { + // ComputerNamePrefix - Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + // AdminUsername - Specifies the name of the administrator account.

    **Windows-only restriction:** Cannot end in "."

    **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

    **Minimum-length (Linux):** 1 character

    **Max-length (Linux):** 64 characters

    **Max-length (Windows):** 20 characters

  • For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
  • For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

    **Minimum-length (Windows):** 8 characters

    **Minimum-length (Linux):** 6 characters

    **Max-length (Windows):** 123 characters

    **Max-length (Linux):** 72 characters

    **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
    Has lower characters
    Has upper characters
    Has a digit
    Has a special character (Regex match [\W_])

    **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"

    For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password) + AdminPassword *string `json:"adminPassword,omitempty"` + // CustomData - Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

    For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.

    For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)

    For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - Specifies set of certificates that should be installed onto the virtual machines in the scale set. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + } + + // VirtualMachineScaleSetProperties describes the properties of a Virtual Machine Scale Set. + type VirtualMachineScaleSetProperties struct { + // UpgradePolicy - The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + // AutomaticRepairsPolicy - Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + // VirtualMachineProfile - The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // Overprovision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + // DoNotRunExtensionsOnOverprovisionedVMs - When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + // UniqueID - READ-ONLY; Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + UniqueID *string `json:"uniqueId,omitempty"` + // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + // ZoneBalance - Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. + ZoneBalance *bool `json:"zoneBalance,omitempty"` + // PlatformFaultDomainCount - Fault Domain count for each placement group. + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

    Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + // HostGroup - Specifies information about the dedicated host group that the virtual machine scale set resides in.

    Minimum api-version: 2020-06-01. + HostGroup *SubResource `json:"hostGroup,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // ScaleInPolicy - Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetProperties. + func (vmssp VirtualMachineScaleSetProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssp.UpgradePolicy != nil) { + objectMap["upgradePolicy"] = vmssp.UpgradePolicy + } + if(vmssp.AutomaticRepairsPolicy != nil) { + objectMap["automaticRepairsPolicy"] = vmssp.AutomaticRepairsPolicy + } + if(vmssp.VirtualMachineProfile != nil) { + objectMap["virtualMachineProfile"] = vmssp.VirtualMachineProfile + } + if(vmssp.Overprovision != nil) { + objectMap["overprovision"] = vmssp.Overprovision + } + if(vmssp.DoNotRunExtensionsOnOverprovisionedVMs != nil) { + objectMap["doNotRunExtensionsOnOverprovisionedVMs"] = vmssp.DoNotRunExtensionsOnOverprovisionedVMs + } + if(vmssp.SinglePlacementGroup != nil) { + objectMap["singlePlacementGroup"] = vmssp.SinglePlacementGroup + } + if(vmssp.ZoneBalance != nil) { + objectMap["zoneBalance"] = vmssp.ZoneBalance + } + if(vmssp.PlatformFaultDomainCount != nil) { + objectMap["platformFaultDomainCount"] = vmssp.PlatformFaultDomainCount + } + if(vmssp.ProximityPlacementGroup != nil) { + objectMap["proximityPlacementGroup"] = vmssp.ProximityPlacementGroup + } + if(vmssp.HostGroup != nil) { + objectMap["hostGroup"] = vmssp.HostGroup + } + if(vmssp.AdditionalCapabilities != nil) { + objectMap["additionalCapabilities"] = vmssp.AdditionalCapabilities + } + if(vmssp.ScaleInPolicy != nil) { + objectMap["scaleInPolicy"] = vmssp.ScaleInPolicy + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetPublicIPAddressConfiguration describes a virtual machines scale set IP + // Configuration's PublicIPAddress configuration + type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + // Name - The publicIP address configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetPublicIPAddressConfiguration. + func (vmsspiac VirtualMachineScaleSetPublicIPAddressConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmsspiac.Name != nil) { + objectMap["name"] = vmsspiac.Name + } + if(vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties != nil) { + objectMap["properties"] = vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetPublicIPAddressConfiguration struct. + func (vmsspiac *VirtualMachineScaleSetPublicIPAddressConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmsspiac.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetPublicIPAddressConfigurationProperties VirtualMachineScaleSetPublicIPAddressConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetPublicIPAddressConfigurationProperties) + if err != nil { + return err + } + vmsspiac.VirtualMachineScaleSetPublicIPAddressConfigurationProperties = &virtualMachineScaleSetPublicIPAddressConfigurationProperties + } + } + } + + return nil + } + + // VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings describes a virtual machines scale sets + // network configuration's DNS settings. + type VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings struct { + // DomainNameLabel - The Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + } + + // VirtualMachineScaleSetPublicIPAddressConfigurationProperties describes a virtual machines scale set IP + // Configuration's PublicIPAddress configuration + type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // DNSSettings - The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPTags - The list of IP tags associated with the public IP address. + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + // PublicIPPrefix - The PublicIPPrefix from which to allocate publicIP addresses. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + // PublicIPAddressVersion - Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + } + + // VirtualMachineScaleSetReimageParameters describes a Virtual Machine Scale Set VM Reimage Parameters. + type VirtualMachineScaleSetReimageParameters struct { + // InstanceIds - The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + InstanceIds *[]string `json:"instanceIds,omitempty"` + // TempDisk - Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` + } + + // VirtualMachineScaleSetRollingUpgradesCancelFuture an abstraction for monitoring and retrieving the + // results of a long-running operation. + type VirtualMachineScaleSetRollingUpgradesCancelFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetRollingUpgradesCancelFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesCancelFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture an abstraction for monitoring and + // retrieving the results of a long-running operation. + type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture an abstraction for monitoring and retrieving + // the results of a long-running operation. + type VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineScaleSetsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { + vmss, err = client.CreateOrUpdateResponder(vmss.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetsDeallocateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsDeallocateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsDeleteInstancesFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineScaleSetsDeleteInstancesFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsDeleteInstancesFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetSku describes an available virtual machine scale set sku. + type VirtualMachineScaleSetSku struct { + // ResourceType - READ-ONLY; The type of resource the sku applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - READ-ONLY; The Sku. + Sku *Sku `json:"sku,omitempty"` + // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. + Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` + } + + // VirtualMachineScaleSetSkuCapacity describes scaling information of a sku. + type VirtualMachineScaleSetSkuCapacity struct { + // Minimum - READ-ONLY; The minimum capacity. + Minimum *int64 `json:"minimum,omitempty"` + // Maximum - READ-ONLY; The maximum capacity that can be set. + Maximum *int64 `json:"maximum,omitempty"` + // DefaultCapacity - READ-ONLY; The default capacity. + DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` + // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'VirtualMachineScaleSetSkuScaleTypeAutomatic', 'VirtualMachineScaleSetSkuScaleTypeNone' + ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` + } + + // VirtualMachineScaleSetsPerformMaintenanceFuture an abstraction for monitoring and retrieving the results + // of a long-running operation. + type VirtualMachineScaleSetsPerformMaintenanceFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsPowerOffFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsPowerOffFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsRedeployFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsRedeployFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsRedeployFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRedeployFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsReimageAllFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsReimageAllFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsReimageFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsReimageFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsRestartFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsRestartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsSetOrchestrationServiceStateFuture an abstraction for monitoring and retrieving + // the results of a long-running operation. + type VirtualMachineScaleSetsSetOrchestrationServiceStateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsSetOrchestrationServiceStateFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsSetOrchestrationServiceStateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsSetOrchestrationServiceStateFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetsStartFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsStartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetStorageProfile describes a virtual machine scale set storage profile. + type VirtualMachineScaleSetStorageProfile struct { + // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - Specifies information about the operating system disk used by the virtual machines in the scale set.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` + // DataDisks - Specifies the parameters that are used to add data disks to the virtual machines in the scale set.

    For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + } + + // VirtualMachineScaleSetsUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { + vmss, err = client.UpdateResponder(vmss.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetsUpdateInstancesFuture an abstraction for monitoring and retrieving the results of + // a long-running operation. + type VirtualMachineScaleSetsUpdateInstancesFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetsUpdateInstancesFuture) Result(client VirtualMachineScaleSetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetUpdate describes a Virtual Machine Scale Set. + type VirtualMachineScaleSetUpdate struct { + // Sku - The virtual machine scale set sku. + Sku *Sku `json:"sku,omitempty"` + // Plan - The purchase plan when deploying a virtual machine scale set from VM Marketplace images. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineScaleSetUpdateProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine scale set, if configured. + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdate. + func (vmssu VirtualMachineScaleSetUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssu.Sku != nil) { + objectMap["sku"] = vmssu.Sku + } + if(vmssu.Plan != nil) { + objectMap["plan"] = vmssu.Plan + } + if(vmssu.VirtualMachineScaleSetUpdateProperties != nil) { + objectMap["properties"] = vmssu.VirtualMachineScaleSetUpdateProperties + } + if(vmssu.Identity != nil) { + objectMap["identity"] = vmssu.Identity + } + if(vmssu.Tags != nil) { + objectMap["tags"] = vmssu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdate struct. + func (vmssu *VirtualMachineScaleSetUpdate) 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 "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmssu.Sku = &sku + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmssu.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateProperties VirtualMachineScaleSetUpdateProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateProperties) + if err != nil { + return err + } + vmssu.VirtualMachineScaleSetUpdateProperties = &virtualMachineScaleSetUpdateProperties + } + case "identity": + if v != nil { + var identity VirtualMachineScaleSetIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmssu.Identity = &identity + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmssu.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineScaleSetUpdateIPConfiguration describes a virtual machine scale set network profile's IP + // configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the + // new subnet are in the same virtual network + type VirtualMachineScaleSetUpdateIPConfiguration struct { + // Name - The IP configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdateIPConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdateIPConfiguration. + func (vmssuic VirtualMachineScaleSetUpdateIPConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssuic.Name != nil) { + objectMap["name"] = vmssuic.Name + } + if(vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties != nil) { + objectMap["properties"] = vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties + } + if(vmssuic.ID != nil) { + objectMap["id"] = vmssuic.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdateIPConfiguration struct. + func (vmssuic *VirtualMachineScaleSetUpdateIPConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssuic.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateIPConfigurationProperties VirtualMachineScaleSetUpdateIPConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateIPConfigurationProperties) + if err != nil { + return err + } + vmssuic.VirtualMachineScaleSetUpdateIPConfigurationProperties = &virtualMachineScaleSetUpdateIPConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssuic.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetUpdateIPConfigurationProperties describes a virtual machine scale set network + // profile's IP configuration properties. + type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + // Subnet - The subnet. + Subnet *APIEntityReference `json:"subnet,omitempty"` + // Primary - Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddressConfiguration - The publicIPAddressConfiguration. + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + // PrivateIPAddressVersion - Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // ApplicationGatewayBackendAddressPools - The application gateway backend address pools. + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + // ApplicationSecurityGroups - Specifies an array of references to application security group. + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + // LoadBalancerBackendAddressPools - The load balancer backend address pools. + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatPools - The load balancer inbound nat pools. + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + } + + // VirtualMachineScaleSetUpdateNetworkConfiguration describes a virtual machine scale set network profile's + // network configurations. + type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + // Name - The network configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdateNetworkConfigurationProperties `json:"properties,omitempty"` + // ID - Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdateNetworkConfiguration. + func (vmssunc VirtualMachineScaleSetUpdateNetworkConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssunc.Name != nil) { + objectMap["name"] = vmssunc.Name + } + if(vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties != nil) { + objectMap["properties"] = vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties + } + if(vmssunc.ID != nil) { + objectMap["id"] = vmssunc.ID + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdateNetworkConfiguration struct. + func (vmssunc *VirtualMachineScaleSetUpdateNetworkConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssunc.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdateNetworkConfigurationProperties VirtualMachineScaleSetUpdateNetworkConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdateNetworkConfigurationProperties) + if err != nil { + return err + } + vmssunc.VirtualMachineScaleSetUpdateNetworkConfigurationProperties = &virtualMachineScaleSetUpdateNetworkConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssunc.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetUpdateNetworkConfigurationProperties describes a virtual machine scale set + // updatable network profile's IP configuration.Use this object for updating network profile's IP + // Configuration. + type VirtualMachineScaleSetUpdateNetworkConfigurationProperties struct { + // Primary - Whether this is a primary NIC on a virtual machine. + Primary *bool `json:"primary,omitempty"` + // EnableAcceleratedNetworking - Specifies whether the network interface is accelerated networking-enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // NetworkSecurityGroup - The network security group. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // DNSSettings - The dns settings to be applied on the network interfaces. + DNSSettings *VirtualMachineScaleSetNetworkConfigurationDNSSettings `json:"dnsSettings,omitempty"` + // IPConfigurations - The virtual machine scale set IP Configuration. + IPConfigurations *[]VirtualMachineScaleSetUpdateIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableIPForwarding - Whether IP forwarding enabled on this NIC. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + } + + // VirtualMachineScaleSetUpdateNetworkProfile describes a virtual machine scale set network profile. + type VirtualMachineScaleSetUpdateNetworkProfile struct { + // HealthProbe - A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + HealthProbe *APIEntityReference `json:"healthProbe,omitempty"` + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetUpdateNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` + } + + // VirtualMachineScaleSetUpdateOSDisk describes virtual machine scale set operating system disk Update + // Object. This should be used for Updating VMSS OS Disk. + type VirtualMachineScaleSetUpdateOSDisk struct { + // Caching - The caching type. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' + Caching CachingTypes `json:"caching,omitempty"` + // WriteAcceleratorEnabled - Specifies whether writeAccelerator should be enabled or disabled on the disk. + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` + // DiskSizeGB - Specifies the size of the operating system disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.

    This value cannot be larger than 1023 GB + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // Image - The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist. + Image *VirtualHardDisk `json:"image,omitempty"` + // VhdContainers - The list of virtual hard disk container uris. + VhdContainers *[]string `json:"vhdContainers,omitempty"` + // ManagedDisk - The managed disk parameters. + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + } + + // VirtualMachineScaleSetUpdateOSProfile describes a virtual machine scale set OS profile. + type VirtualMachineScaleSetUpdateOSProfile struct { + // CustomData - A base-64 encoded string of custom data. + CustomData *string `json:"customData,omitempty"` + // WindowsConfiguration - The Windows Configuration of the OS profile. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // LinuxConfiguration - The Linux Configuration of the OS profile. + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + // Secrets - The List of certificates for addition to the VM. + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + } + + // VirtualMachineScaleSetUpdateProperties describes the properties of a Virtual Machine Scale Set. + type VirtualMachineScaleSetUpdateProperties struct { + // UpgradePolicy - The upgrade policy. + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + // AutomaticRepairsPolicy - Policy for automatic repairs. + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + // VirtualMachineProfile - The virtual machine profile. + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile `json:"virtualMachineProfile,omitempty"` + // Overprovision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. + Overprovision *bool `json:"overprovision,omitempty"` + // DoNotRunExtensionsOnOverprovisionedVMs - When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // ScaleInPolicy - Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + // ProximityPlacementGroup - Specifies information about the proximity placement group that the virtual machine scale set should be assigned to.

    Minimum api-version: 2018-04-01. + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + } + + // VirtualMachineScaleSetUpdatePublicIPAddressConfiguration describes a virtual machines scale set IP + // Configuration's PublicIPAddress configuration + type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + // Name - The publicIP address configuration name. + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetUpdatePublicIPAddressConfiguration. + func (vmssupiac VirtualMachineScaleSetUpdatePublicIPAddressConfiguration)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssupiac.Name != nil) { + objectMap["name"] = vmssupiac.Name + } + if(vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties != nil) { + objectMap["properties"] = vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct. + func (vmssupiac *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssupiac.Name = &name + } + case "properties": + if v != nil { + var virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties) + if err != nil { + return err + } + vmssupiac.VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties = &virtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties + } + } + } + + return nil + } + + // VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties describes a virtual machines scale + // set IP Configuration's PublicIPAddress configuration + type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties struct { + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // DNSSettings - The dns settings to be applied on the publicIP addresses . + DNSSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDNSSettings `json:"dnsSettings,omitempty"` + } + + // VirtualMachineScaleSetUpdateStorageProfile describes a virtual machine scale set storage profile. + type VirtualMachineScaleSetUpdateStorageProfile struct { + // ImageReference - The image reference. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - The OS disk. + OsDisk *VirtualMachineScaleSetUpdateOSDisk `json:"osDisk,omitempty"` + // DataDisks - The data disks. + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + } + + // VirtualMachineScaleSetUpdateVMProfile describes a virtual machine scale set virtual machine profile. + type VirtualMachineScaleSetUpdateVMProfile struct { + // OsProfile - The virtual machine scale set OS profile. + OsProfile *VirtualMachineScaleSetUpdateOSProfile `json:"osProfile,omitempty"` + // StorageProfile - The virtual machine scale set storage profile. + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile `json:"storageProfile,omitempty"` + // NetworkProfile - The virtual machine scale set network profile. + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile `json:"networkProfile,omitempty"` + // SecurityProfile - The virtual machine scale set Security profile + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // DiagnosticsProfile - The virtual machine scale set diagnostics profile. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // ExtensionProfile - The virtual machine scale set extension profile. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + // LicenseType - The license type, which is for bring your own license scenario. + LicenseType *string `json:"licenseType,omitempty"` + // BillingProfile - Specifies the billing related details of a Azure Spot VMSS.

    Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + // ScheduledEventsProfile - Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + } + + // VirtualMachineScaleSetVM describes a virtual machine scale set virtual machine. + type VirtualMachineScaleSetVM struct { + autorest.Response `json:"-"` + // InstanceID - READ-ONLY; The virtual machine instance ID. + InstanceID *string `json:"instanceId,omitempty"` + // Sku - READ-ONLY; The virtual machine SKU. + Sku *Sku `json:"sku,omitempty"` + *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + // Resources - READ-ONLY; The virtual machine child extension resources. + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + // Zones - READ-ONLY; The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetVM. + func (vmssv VirtualMachineScaleSetVM)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssv.VirtualMachineScaleSetVMProperties != nil) { + objectMap["properties"] = vmssv.VirtualMachineScaleSetVMProperties + } + if(vmssv.Plan != nil) { + objectMap["plan"] = vmssv.Plan + } + if(vmssv.Location != nil) { + objectMap["location"] = vmssv.Location + } + if(vmssv.Tags != nil) { + objectMap["tags"] = vmssv.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVM struct. + func (vmssv *VirtualMachineScaleSetVM) 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 "instanceId": + if v != nil { + var instanceID string + err = json.Unmarshal(*v, &instanceID) + if err != nil { + return err + } + vmssv.InstanceID = &instanceID + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + vmssv.Sku = &sku + } + case "properties": + if v != nil { + var virtualMachineScaleSetVMProperties VirtualMachineScaleSetVMProperties + err = json.Unmarshal(*v, &virtualMachineScaleSetVMProperties) + if err != nil { + return err + } + vmssv.VirtualMachineScaleSetVMProperties = &virtualMachineScaleSetVMProperties + } + case "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmssv.Plan = &plan + } + case "resources": + if v != nil { + var resources []VirtualMachineExtension + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + vmssv.Resources = &resources + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmssv.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssv.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssv.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmssv.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vmssv.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmssv.Tags = tags + } + } + } + + return nil + } + + // VirtualMachineScaleSetVMExtension describes a VMSS VM Extension. + type VirtualMachineScaleSetVMExtension struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + *VirtualMachineExtensionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMExtension. + func (vmssve VirtualMachineScaleSetVMExtension)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssve.VirtualMachineExtensionProperties != nil) { + objectMap["properties"] = vmssve.VirtualMachineExtensionProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVMExtension struct. + func (vmssve *VirtualMachineScaleSetVMExtension) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssve.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmssve.Type = &typeVar + } + case "properties": + if v != nil { + var virtualMachineExtensionProperties VirtualMachineExtensionProperties + err = json.Unmarshal(*v, &virtualMachineExtensionProperties) + if err != nil { + return err + } + vmssve.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssve.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the + // results of a long-running operation. + type VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetVMExtensionsClient) (vmssve VirtualMachineScaleSetVMExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmssve.Response.Response, err = future.GetResult(sender); err == nil && vmssve.Response.Response.StatusCode != http.StatusNoContent { + vmssve, err = client.CreateOrUpdateResponder(vmssve.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture", "Result", vmssve.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetVMExtensionsDeleteFuture an abstraction for monitoring and retrieving the results + // of a long-running operation. + type VirtualMachineScaleSetVMExtensionsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMExtensionsDeleteFuture) Result(client VirtualMachineScaleSetVMExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMExtensionsListResult the List VMSS VM Extension operation response + type VirtualMachineScaleSetVMExtensionsListResult struct { + autorest.Response `json:"-"` + // Value - The list of VMSS VM extensions + Value *[]VirtualMachineScaleSetVMExtension `json:"value,omitempty"` + } + + // VirtualMachineScaleSetVMExtensionsSummary extensions summary for virtual machines of a virtual machine + // scale set. + type VirtualMachineScaleSetVMExtensionsSummary struct { + // Name - READ-ONLY; The extension name. + Name *string `json:"name,omitempty"` + // StatusesSummary - READ-ONLY; The extensions information. + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` + } + + // VirtualMachineScaleSetVMExtensionsUpdateFuture an abstraction for monitoring and retrieving the results + // of a long-running operation. + type VirtualMachineScaleSetVMExtensionsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMExtensionsUpdateFuture) Result(client VirtualMachineScaleSetVMExtensionsClient) (vmssve VirtualMachineScaleSetVMExtension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmssve.Response.Response, err = future.GetResult(sender); err == nil && vmssve.Response.Response.StatusCode != http.StatusNoContent { + vmssve, err = client.UpdateResponder(vmssve.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsUpdateFuture", "Result", vmssve.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineScaleSetVMExtensionUpdate describes a VMSS VM Extension. + type VirtualMachineScaleSetVMExtensionUpdate struct { + // Name - READ-ONLY; The name of the extension. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMExtensionUpdate. + func (vmssveu VirtualMachineScaleSetVMExtensionUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssveu.VirtualMachineExtensionUpdateProperties != nil) { + objectMap["properties"] = vmssveu.VirtualMachineExtensionUpdateProperties + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVMExtensionUpdate struct. + func (vmssveu *VirtualMachineScaleSetVMExtensionUpdate) 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 "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vmssveu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vmssveu.Type = &typeVar + } + case "properties": + if v != nil { + var virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties + err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties) + if err != nil { + return err + } + vmssveu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vmssveu.ID = &ID + } + } + } + + return nil + } + + // VirtualMachineScaleSetVMInstanceIDs specifies a list of virtual machine instance IDs from the VM scale + // set. + type VirtualMachineScaleSetVMInstanceIDs struct { + // InstanceIds - The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. + InstanceIds *[]string `json:"instanceIds,omitempty"` + } + + // VirtualMachineScaleSetVMInstanceRequiredIDs specifies a list of virtual machine instance IDs from the VM + // scale set. + type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + // InstanceIds - The virtual machine scale set instance ids. + InstanceIds *[]string `json:"instanceIds,omitempty"` + } + + // VirtualMachineScaleSetVMInstanceView the instance view of a virtual machine scale set VM. + type VirtualMachineScaleSetVMInstanceView struct { + autorest.Response `json:"-"` + // PlatformUpdateDomain - The Update Domain count. + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + // PlatformFaultDomain - The Fault Domain count. + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + // RdpThumbPrint - The Remote desktop certificate thumbprint. + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + // VMAgent - The VM Agent running on the virtual machine. + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + // MaintenanceRedeployStatus - The Maintenance Operation status on the virtual machine. + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + // Disks - The disks information. + Disks *[]DiskInstanceView `json:"disks,omitempty"` + // Extensions - The extensions information. + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + // VMHealth - READ-ONLY; The health status for the VM. + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` + // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.

    You can easily view the output of your console log.

    Azure also enables you to see a screenshot of the VM from the hypervisor. + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + // AssignedHost - READ-ONLY; Resource id of the dedicated host, on which the virtual machine is allocated through automatic placement, when the virtual machine is associated with a dedicated host group that has automatic placement enabled.

    Minimum api-version: 2020-06-01. + AssignedHost *string `json:"assignedHost,omitempty"` + // PlacementGroupID - The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId. + PlacementGroupID *string `json:"placementGroupId,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMInstanceView. + func (vmssviv VirtualMachineScaleSetVMInstanceView)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssviv.PlatformUpdateDomain != nil) { + objectMap["platformUpdateDomain"] = vmssviv.PlatformUpdateDomain + } + if(vmssviv.PlatformFaultDomain != nil) { + objectMap["platformFaultDomain"] = vmssviv.PlatformFaultDomain + } + if(vmssviv.RdpThumbPrint != nil) { + objectMap["rdpThumbPrint"] = vmssviv.RdpThumbPrint + } + if(vmssviv.VMAgent != nil) { + objectMap["vmAgent"] = vmssviv.VMAgent + } + if(vmssviv.MaintenanceRedeployStatus != nil) { + objectMap["maintenanceRedeployStatus"] = vmssviv.MaintenanceRedeployStatus + } + if(vmssviv.Disks != nil) { + objectMap["disks"] = vmssviv.Disks + } + if(vmssviv.Extensions != nil) { + objectMap["extensions"] = vmssviv.Extensions + } + if(vmssviv.BootDiagnostics != nil) { + objectMap["bootDiagnostics"] = vmssviv.BootDiagnostics + } + if(vmssviv.Statuses != nil) { + objectMap["statuses"] = vmssviv.Statuses + } + if(vmssviv.PlacementGroupID != nil) { + objectMap["placementGroupId"] = vmssviv.PlacementGroupID + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetVMListResult the List Virtual Machine Scale Set VMs operation response. + type VirtualMachineScaleSetVMListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine scale sets VMs. + Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS VMs + NextLink *string `json:"nextLink,omitempty"` + } + + // VirtualMachineScaleSetVMListResultIterator provides access to a complete listing of + // VirtualMachineScaleSetVM values. + type VirtualMachineScaleSetVMListResultIterator struct { + i int + page VirtualMachineScaleSetVMListResultPage + } + // 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 * VirtualMachineScaleSetVMListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMListResultIterator.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 * VirtualMachineScaleSetVMListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) + } + // NotDone returns true if the enumeration should be started or is not yet complete. + func (iter VirtualMachineScaleSetVMListResultIterator) 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 VirtualMachineScaleSetVMListResultIterator) Response() VirtualMachineScaleSetVMListResult { + 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 VirtualMachineScaleSetVMListResultIterator) Value() VirtualMachineScaleSetVM { + if !iter.page.NotDone() { + return VirtualMachineScaleSetVM{} + } + return iter.page.Values()[iter.i] + } + // Creates a new instance of the VirtualMachineScaleSetVMListResultIterator type. + func NewVirtualMachineScaleSetVMListResultIterator (page VirtualMachineScaleSetVMListResultPage) VirtualMachineScaleSetVMListResultIterator { + return VirtualMachineScaleSetVMListResultIterator{page: page} + } + + + // IsEmpty returns true if the ListResult contains no values. + func (vmssvlr VirtualMachineScaleSetVMListResult) IsEmpty() bool { + return vmssvlr.Value == nil || len(*vmssvlr.Value) == 0 + } + + // hasNextLink returns true if the NextLink is not empty. + func (vmssvlr VirtualMachineScaleSetVMListResult) hasNextLink() bool { + return vmssvlr.NextLink != nil && len(*vmssvlr.NextLink) != 0 + } + // virtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. + // It returns nil if no more results exist. + func (vmssvlr VirtualMachineScaleSetVMListResult) virtualMachineScaleSetVMListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vmssvlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String( vmssvlr.NextLink))); + } + + // VirtualMachineScaleSetVMListResultPage contains a page of VirtualMachineScaleSetVM values. + type VirtualMachineScaleSetVMListResultPage struct { + fn func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error) + vmssvlr VirtualMachineScaleSetVMListResult + } + + // 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 * VirtualMachineScaleSetVMListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMListResultPage.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.vmssvlr) + if err != nil { + return err + } + page.vmssvlr = 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 * VirtualMachineScaleSetVMListResultPage) Next() error { + return page.NextWithContext(context.Background()) + } + // NotDone returns true if the page enumeration should be started or is not yet complete. + func (page VirtualMachineScaleSetVMListResultPage) NotDone() bool { + return !page.vmssvlr.IsEmpty() + } + // Response returns the raw server response from the last page request. + func (page VirtualMachineScaleSetVMListResultPage) Response() VirtualMachineScaleSetVMListResult { + return page.vmssvlr + } + // Values returns the slice of values for the current page or nil if there are no values. + func (page VirtualMachineScaleSetVMListResultPage) Values() []VirtualMachineScaleSetVM { + if page.vmssvlr.IsEmpty() { + return nil + } + return *page.vmssvlr.Value + } + // Creates a new instance of the VirtualMachineScaleSetVMListResultPage type. + func NewVirtualMachineScaleSetVMListResultPage (cur VirtualMachineScaleSetVMListResult, getNextPage func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error)) VirtualMachineScaleSetVMListResultPage { + return VirtualMachineScaleSetVMListResultPage{ + fn: getNextPage, + vmssvlr: cur, + } + } + + // VirtualMachineScaleSetVMNetworkProfileConfiguration describes a virtual machine scale set VM network + // profile. + type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + // NetworkInterfaceConfigurations - The list of network configurations. + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` + } + + // VirtualMachineScaleSetVMProfile describes a virtual machine scale set virtual machine profile. + type VirtualMachineScaleSetVMProfile struct { + // OsProfile - Specifies the operating system settings for the virtual machines in the scale set. + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + // NetworkProfile - Specifies properties of the network interfaces of the virtual machines in the scale set. + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + // SecurityProfile - Specifies the Security related profile settings for the virtual machines in the scale set. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // ExtensionProfile - Specifies a collection of settings for extensions installed on virtual machines in the scale set. + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises.

    Possible values for Windows Server operating system are:

    Windows_Client

    Windows_Server

    Possible values for Linux Server operating system are:

    RHEL_BYOS (for RHEL)

    SLES_BYOS (for SUSE)

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)

    [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // Priority - Specifies the priority for the virtual machines in the scale set.

    Minimum api-version: 2017-10-30-preview. Possible values include: 'Regular', 'Low', 'Spot' + Priority VirtualMachinePriorityTypes `json:"priority,omitempty"` + // EvictionPolicy - Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set.

    For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01.

    For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete' + EvictionPolicy VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + // BillingProfile - Specifies the billing related details of a Azure Spot VMSS.

    Minimum api-version: 2019-03-01. + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + // ScheduledEventsProfile - Specifies Scheduled Event related configurations. + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + } + + // VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual + // machine. + type VirtualMachineScaleSetVMProperties struct { + // LatestModelApplied - READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. + LatestModelApplied *bool `json:"latestModelApplied,omitempty"` + // VMID - READ-ONLY; Azure VM unique ID. + VMID *string `json:"vmId,omitempty"` + // InstanceView - READ-ONLY; The virtual machine instance view. + InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` + // HardwareProfile - Specifies the hardware settings for the virtual machine. + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + // StorageProfile - Specifies the storage settings for the virtual machine disks. + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + // AdditionalCapabilities - Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For instance: whether the virtual machine has the capability to support attaching managed data disks with UltraSSD_LRS storage account type. + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // OsProfile - Specifies the operating system settings for the virtual machine. + OsProfile *OSProfile `json:"osProfile,omitempty"` + // SecurityProfile - Specifies the Security related profile settings for the virtual machine. + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + // NetworkProfile - Specifies the network interfaces of the virtual machine. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // NetworkProfileConfiguration - Specifies the network profile configuration of the virtual machine. + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration `json:"networkProfileConfiguration,omitempty"` + // DiagnosticsProfile - Specifies the boot diagnostic settings state.

    Minimum api-version: 2015-06-15. + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).

    For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)

    Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` + // LicenseType - Specifies that the image or disk that is being used was licensed on-premises.

    Possible values for Windows Server operating system are:

    Windows_Client

    Windows_Server

    Possible values for Linux Server operating system are:

    RHEL_BYOS (for RHEL)

    SLES_BYOS (for SUSE)

    For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)

    [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux)

    Minimum api-version: 2015-06-15 + LicenseType *string `json:"licenseType,omitempty"` + // ModelDefinitionApplied - READ-ONLY; Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or the customized model for the virtual machine. + ModelDefinitionApplied *string `json:"modelDefinitionApplied,omitempty"` + // ProtectionPolicy - Specifies the protection policy of the virtual machine. + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy `json:"protectionPolicy,omitempty"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMProperties. + func (vmssvp VirtualMachineScaleSetVMProperties)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmssvp.HardwareProfile != nil) { + objectMap["hardwareProfile"] = vmssvp.HardwareProfile + } + if(vmssvp.StorageProfile != nil) { + objectMap["storageProfile"] = vmssvp.StorageProfile + } + if(vmssvp.AdditionalCapabilities != nil) { + objectMap["additionalCapabilities"] = vmssvp.AdditionalCapabilities + } + if(vmssvp.OsProfile != nil) { + objectMap["osProfile"] = vmssvp.OsProfile + } + if(vmssvp.SecurityProfile != nil) { + objectMap["securityProfile"] = vmssvp.SecurityProfile + } + if(vmssvp.NetworkProfile != nil) { + objectMap["networkProfile"] = vmssvp.NetworkProfile + } + if(vmssvp.NetworkProfileConfiguration != nil) { + objectMap["networkProfileConfiguration"] = vmssvp.NetworkProfileConfiguration + } + if(vmssvp.DiagnosticsProfile != nil) { + objectMap["diagnosticsProfile"] = vmssvp.DiagnosticsProfile + } + if(vmssvp.AvailabilitySet != nil) { + objectMap["availabilitySet"] = vmssvp.AvailabilitySet + } + if(vmssvp.LicenseType != nil) { + objectMap["licenseType"] = vmssvp.LicenseType + } + if(vmssvp.ProtectionPolicy != nil) { + objectMap["protectionPolicy"] = vmssvp.ProtectionPolicy + } + return json.Marshal(objectMap) + } + + // VirtualMachineScaleSetVMProtectionPolicy the protection policy of a virtual machine scale set VM. + type VirtualMachineScaleSetVMProtectionPolicy struct { + // ProtectFromScaleIn - Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation. + ProtectFromScaleIn *bool `json:"protectFromScaleIn,omitempty"` + // ProtectFromScaleSetActions - Indicates that model updates or actions (including scale-in) initiated on the virtual machine scale set should not be applied to the virtual machine scale set VM. + ProtectFromScaleSetActions *bool `json:"protectFromScaleSetActions,omitempty"` + } + + // VirtualMachineScaleSetVMReimageParameters describes a Virtual Machine Scale Set VM Reimage Parameters. + type VirtualMachineScaleSetVMReimageParameters struct { + // TempDisk - Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + TempDisk *bool `json:"tempDisk,omitempty"` + } + + // VirtualMachineScaleSetVMsDeallocateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsDeallocateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsDeleteFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsPerformMaintenanceFuture an abstraction for monitoring and retrieving the + // results of a long-running operation. + type VirtualMachineScaleSetVMsPerformMaintenanceFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsPowerOffFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsPowerOffFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsRedeployFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsRedeployFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsRedeployFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRedeployFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsReimageAllFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsReimageAllFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsReimageFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsReimageFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsRestartFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsRestartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsStartFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsStartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineScaleSetVMsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineScaleSetVMsUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachineScaleSetVMsUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachineScaleSetVMsUpdateFuture) Result(client VirtualMachineScaleSetVMsClient) (vmssv VirtualMachineScaleSetVM, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmssv.Response.Response, err = future.GetResult(sender); err == nil && vmssv.Response.Response.StatusCode != http.StatusNoContent { + vmssv, err = client.UpdateResponder(vmssv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", vmssv.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachinesCaptureFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesCaptureFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vmcr.Response.Response, err = future.GetResult(sender); err == nil && vmcr.Response.Response.StatusCode != http.StatusNoContent { + vmcr, err = client.CaptureResponder(vmcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", vmcr.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachinesConvertToManagedDisksFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachinesConvertToManagedDisksFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachinesCreateOrUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.CreateOrUpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachinesDeallocateFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachinesDeallocateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesDeleteFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineSize describes the properties of a VM size. + type VirtualMachineSize struct { + // Name - The name of the virtual machine size. + Name *string `json:"name,omitempty"` + // NumberOfCores - The number of cores supported by the virtual machine size. + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // OsDiskSizeInMB - The OS disk size, in MB, allowed by the virtual machine size. + OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` + // ResourceDiskSizeInMB - The resource disk size, in MB, allowed by the virtual machine size. + ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` + // MemoryInMB - The amount of memory, in MB, supported by the virtual machine size. + MemoryInMB *int32 `json:"memoryInMB,omitempty"` + // MaxDataDiskCount - The maximum number of data disks that can be attached to the virtual machine size. + MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` + } + + // VirtualMachineSizeListResult the List Virtual Machine operation response. + type VirtualMachineSizeListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine sizes. + Value *[]VirtualMachineSize `json:"value,omitempty"` + } + + // VirtualMachineSoftwarePatchProperties describes the properties of a Virtual Machine software patch. + type VirtualMachineSoftwarePatchProperties struct { + // PatchID - READ-ONLY; A unique identifier for the patch. + PatchID *string `json:"patchId,omitempty"` + // Name - READ-ONLY; The friendly name of the patch. + Name *string `json:"name,omitempty"` + // Version - READ-ONLY; The version number of the patch. This property applies only to Linux patches. + Version *string `json:"version,omitempty"` + // Kbid - READ-ONLY; The KBID of the patch. Only applies to Windows patches. + Kbid *string `json:"kbid,omitempty"` + // Classifications - READ-ONLY; The classification(s) of the patch as provided by the patch publisher. + Classifications *[]string `json:"classifications,omitempty"` + // RebootBehavior - READ-ONLY; Describes the reboot requirements of the patch. Possible values include: 'NeverReboots', 'AlwaysRequiresReboot', 'CanRequestReboot' + RebootBehavior SoftwareUpdateRebootBehavior `json:"rebootBehavior,omitempty"` + // ActivityID - READ-ONLY; The activity ID of the operation that produced this result. It is used to correlate across CRP and extension logs. + ActivityID *string `json:"activityId,omitempty"` + // PublishedDate - READ-ONLY; The UTC timestamp when the repository published this patch. + PublishedDate *date.Time `json:"publishedDate,omitempty"` + // LastModifiedDateTime - READ-ONLY; The UTC timestamp of the last update to this patch record. + LastModifiedDateTime *date.Time `json:"lastModifiedDateTime,omitempty"` + // AssessmentState - READ-ONLY; Describes the outcome of an install operation for a given patch. Possible values include: 'Installed', 'Failed', 'Excluded', 'NotSelected', 'Pending', 'Available' + AssessmentState PatchAssessmentState `json:"assessmentState,omitempty"` + } + + // VirtualMachinesPerformMaintenanceFuture an abstraction for monitoring and retrieving the results of a + // long-running operation. + type VirtualMachinesPerformMaintenanceFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesPerformMaintenanceFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPerformMaintenanceFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesPowerOffFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesReapplyFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesReapplyFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesReapplyFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesReapplyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesReapplyFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesRedeployFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesReimageFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesReimageFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesReimageFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesReimageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesReimageFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesRestartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesStartFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") + return + } + ar.Response = future.Response() + return + } + + // VirtualMachineStatusCodeCount the status code and count of the virtual machine scale set instance view + // status summary. + type VirtualMachineStatusCodeCount struct { + // Code - READ-ONLY; The instance view status code. + Code *string `json:"code,omitempty"` + // Count - READ-ONLY; The number of instances having a particular status code. + Count *int32 `json:"count,omitempty"` + } + + // VirtualMachinesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running + // operation. + type VirtualMachinesUpdateFuture struct { + azure.Future + } + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + func (future *VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { + VM, err = client.UpdateResponder(VM.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") + } + } + return + } + + // VirtualMachineUpdate describes a Virtual Machine Update. + type VirtualMachineUpdate struct { + // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineProperties `json:"properties,omitempty"` + // Identity - The identity of the virtual machine, if configured. + Identity *VirtualMachineIdentity `json:"identity,omitempty"` + // Zones - The virtual machine zones. + Zones *[]string `json:"zones,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + } + + // MarshalJSON is the custom marshaler for VirtualMachineUpdate. + func (vmu VirtualMachineUpdate)MarshalJSON() ([]byte, error){ + objectMap := make(map[string]interface{}) + if(vmu.Plan != nil) { + objectMap["plan"] = vmu.Plan + } + if(vmu.VirtualMachineProperties != nil) { + objectMap["properties"] = vmu.VirtualMachineProperties + } + if(vmu.Identity != nil) { + objectMap["identity"] = vmu.Identity + } + if(vmu.Zones != nil) { + objectMap["zones"] = vmu.Zones + } + if(vmu.Tags != nil) { + objectMap["tags"] = vmu.Tags + } + return json.Marshal(objectMap) + } + // UnmarshalJSON is the custom unmarshaler for VirtualMachineUpdate struct. + func (vmu *VirtualMachineUpdate) 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 "plan": + if v != nil { + var plan Plan + err = json.Unmarshal(*v, &plan) + if err != nil { + return err + } + vmu.Plan = &plan + } + case "properties": + if v != nil { + var virtualMachineProperties VirtualMachineProperties + err = json.Unmarshal(*v, &virtualMachineProperties) + if err != nil { + return err + } + vmu.VirtualMachineProperties = &virtualMachineProperties + } + case "identity": + if v != nil { + var identity VirtualMachineIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + vmu.Identity = &identity + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + vmu.Zones = &zones + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vmu.Tags = tags + } + } + } + + return nil + } + + // VMScaleSetConvertToSinglePlacementGroupInput ... + type VMScaleSetConvertToSinglePlacementGroupInput struct { + // ActivePlacementGroupID - Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, please use Virtual Machine Scale Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual machine instances. + ActivePlacementGroupID *string `json:"activePlacementGroupId,omitempty"` + } + + // WindowsConfiguration specifies Windows operating system settings on the virtual machine. + type WindowsConfiguration struct { + // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine.

    When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + // EnableAutomaticUpdates - Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true.

    For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + // TimeZone - Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time".

    Possible values can be [TimeZoneInfo.Id](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value from time zones returned by [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.getsystemtimezones). + TimeZone *string `json:"timeZone,omitempty"` + // AdditionalUnattendContent - Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + // PatchSettings - Specifies settings related to in-guest patching (KBs). + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + // WinRM - Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. + WinRM *WinRMConfiguration `json:"winRM,omitempty"` + } + + // WinRMConfiguration describes Windows Remote Management configuration of the VM + type WinRMConfiguration struct { + // Listeners - The list of Windows Remote Management listeners + Listeners *[]WinRMListener `json:"listeners,omitempty"` + } + + // WinRMListener describes Protocol and thumbprint of Windows Remote Management listener + type WinRMListener struct { + // Protocol - Specifies the protocol of WinRM listener.

    Possible values are:
    **http**

    **https**. Possible values include: 'HTTP', 'HTTPS' + Protocol ProtocolTypes `json:"protocol,omitempty"` + // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:

    {
    "data":"",
    "dataType":"pfx",
    "password":""
    } + CertificateURL *string `json:"certificateUrl,omitempty"` + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/operations.go b/profiles/2020-09-01/compute/mgmt/compute/operations.go new file mode 100644 index 000000000000..12a4fc1ad8b0 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/operations.go @@ -0,0 +1,108 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// OperationsClient is the compute 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 compute operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, 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, "compute.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, "compute.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + + // ListPreparer prepares the List request. + func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPath("/providers/Microsoft.Compute/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 OperationListResult, 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/profiles/2020-09-01/compute/mgmt/compute/proximityplacementgroups.go b/profiles/2020-09-01/compute/mgmt/compute/proximityplacementgroups.go new file mode 100644 index 000000000000..972ea0f33522 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/proximityplacementgroups.go @@ -0,0 +1,578 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// ProximityPlacementGroupsClient is the compute Client +type ProximityPlacementGroupsClient struct { + BaseClient +} +// NewProximityPlacementGroupsClient creates an instance of the ProximityPlacementGroupsClient client. +func NewProximityPlacementGroupsClient(subscriptionID string) ProximityPlacementGroupsClient { + return NewProximityPlacementGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProximityPlacementGroupsClientWithBaseURI creates an instance of the ProximityPlacementGroupsClient 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 NewProximityPlacementGroupsClientWithBaseURI(baseURI string, subscriptionID string) ProximityPlacementGroupsClient { + return ProximityPlacementGroupsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate create or update a proximity placement group. + // Parameters: + // resourceGroupName - the name of the resource group. + // proximityPlacementGroupName - the name of the proximity placement group. + // parameters - parameters supplied to the Create Proximity Placement Group operation. +func (client ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client ProximityPlacementGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup) (*http.Request, error) { + pathParameters := map[string]interface{} { + "proximityPlacementGroupName": autorest.Encode("path",proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client ProximityPlacementGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client ProximityPlacementGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ProximityPlacementGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete delete a proximity placement group. + // Parameters: + // resourceGroupName - the name of the resource group. + // proximityPlacementGroupName - the name of the proximity placement group. +func (client ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, proximityPlacementGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", nil , "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client ProximityPlacementGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "proximityPlacementGroupName": autorest.Encode("path",proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client ProximityPlacementGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client ProximityPlacementGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get retrieves information about a proximity placement group . + // Parameters: + // resourceGroupName - the name of the resource group. + // proximityPlacementGroupName - the name of the proximity placement group. + // includeColocationStatus - includeColocationStatus=true enables fetching the colocation status of all the + // resources in the proximity placement group. +func (client ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, includeColocationStatus string) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, proximityPlacementGroupName, includeColocationStatus) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client ProximityPlacementGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, includeColocationStatus string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "proximityPlacementGroupName": autorest.Encode("path",proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(includeColocationStatus) > 0 { + queryParameters["includeColocationStatus"] = autorest.Encode("query",includeColocationStatus) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}",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 ProximityPlacementGroupsClient) 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 ProximityPlacementGroupsClient) GetResponder(resp *http.Response) (result ProximityPlacementGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListByResourceGroup lists all proximity placement groups in a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client ProximityPlacementGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ppglr.Response.Response != nil { + sc = result.ppglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ppglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ppglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.ppglr.hasNextLink() && result.ppglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client ProximityPlacementGroupsClient) 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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups",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 ProximityPlacementGroupsClient) 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 ProximityPlacementGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ProximityPlacementGroupListResult, 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 ProximityPlacementGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) { + req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "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, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ProximityPlacementGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.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 lists all proximity placement groups in a subscription. +func (client ProximityPlacementGroupsClient) ListBySubscription(ctx context.Context) (result ProximityPlacementGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.ListBySubscription") + defer func() { + sc := -1 + if result.ppglr.Response.Response != nil { + sc = result.ppglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", nil , "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.ppglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.ppglr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "ListBySubscription", resp, "Failure responding to request") + } + if result.ppglr.hasNextLink() && result.ppglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListBySubscriptionPreparer prepares the ListBySubscription request. + func (client ProximityPlacementGroupsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups",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 ProximityPlacementGroupsClient) 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 ProximityPlacementGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result ProximityPlacementGroupListResult, 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 ProximityPlacementGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ProximityPlacementGroupListResult) (result ProximityPlacementGroupListResult, err error) { + req, err := lastResults.proximityPlacementGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "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, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. + func (client ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context) (result ProximityPlacementGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.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 update a proximity placement group. + // Parameters: + // resourceGroupName - the name of the resource group. + // proximityPlacementGroupName - the name of the proximity placement group. + // parameters - parameters supplied to the Update Proximity Placement Group operation. +func (client ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (result ProximityPlacementGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/ProximityPlacementGroupsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, proximityPlacementGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", nil , "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ProximityPlacementGroupsClient", "Update", resp, "Failure responding to request") + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client ProximityPlacementGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "proximityPlacementGroupName": autorest.Encode("path",proximityPlacementGroupName), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/proximityPlacementGroups/{proximityPlacementGroupName}",pathParameters), +autorest.WithJSON(parameters), +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 ProximityPlacementGroupsClient) 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 ProximityPlacementGroupsClient) UpdateResponder(resp *http.Response) (result ProximityPlacementGroup, 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/profiles/2020-09-01/compute/mgmt/compute/snapshots.go b/profiles/2020-09-01/compute/mgmt/compute/snapshots.go new file mode 100644 index 000000000000..9d6cab5871f2 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/snapshots.go @@ -0,0 +1,753 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// SnapshotsClient is the compute Client +type SnapshotsClient struct { + BaseClient +} +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient 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 NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate creates or updates a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + // snapshot - snapshot object supplied in the body of the Put disk operation. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: snapshot, + Constraints: []validation.Constraint{ {Target: "snapshot.SnapshotProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "snapshot.SnapshotProperties.CreationData", Name: validation.Null, Rule: true , + Chain: []validation.Constraint{ {Target: "snapshot.SnapshotProperties.CreationData.ImageReference", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "snapshot.SnapshotProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}, + {Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "snapshot.SnapshotProperties.EncryptionSettingsCollection.Enabled", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + snapshot.ManagedBy = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}",pathParameters), +autorest.WithJSON(snapshot), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (future SnapshotsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete deletes a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get gets information about a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}",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 SnapshotsClient) 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 SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// GrantAccess grants access to a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + // grantAccessData - access data object supplied in the body of the get snapshot access operation. +func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.GrantAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: grantAccessData, + Constraints: []validation.Constraint{ {Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error()) + } + + req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", nil , "Failure preparing request") + return + } + + result, err = client.GrantAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", result.Response(), "Failure sending request") + return + } + + return +} + + // GrantAccessPreparer prepares the GrantAccess request. + func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess",pathParameters), +autorest.WithJSON(grantAccessData), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GrantAccessSender sends the GrantAccess request. The method will close the + // http.Response Body if it receives an error. + func (client SnapshotsClient) GrantAccessSender(req *http.Request) (future SnapshotsGrantAccessFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // GrantAccessResponder handles the response to the GrantAccess request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List lists snapshots under a subscription. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.List") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.sl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure responding to request") + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots",pathParameters), +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 SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.snapshotListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.List") + 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.List(ctx) + return + } + +// ListByResourceGroup lists snapshots under a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client SnapshotsClient) 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 = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots",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 SnapshotsClient) 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 SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, 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 SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.snapshotListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "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, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.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 + } + +// RevokeAccess revokes access to a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. +func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.RevokeAccess") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", nil , "Failure preparing request") + return + } + + result, err = client.RevokeAccessSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", result.Response(), "Failure sending request") + return + } + + return +} + + // RevokeAccessPreparer prepares the RevokeAccess request. + func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RevokeAccessSender sends the RevokeAccess request. The method will close the + // http.Response Body if it receives an error. + func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (future SnapshotsRevokeAccessFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RevokeAccessResponder handles the response to the RevokeAccess request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Update updates (patches) a snapshot. + // Parameters: + // resourceGroupName - the name of the resource group. + // snapshotName - the name of the snapshot that is being created. The name can't be changed after the snapshot + // is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. + // snapshot - snapshot object supplied in the body of the Patch snapshot operation. +func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SnapshotsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "snapshotName": autorest.Encode("path",snapshotName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2019-07-01" + 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.Compute/snapshots/{snapshotName}",pathParameters), +autorest.WithJSON(snapshot), +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 SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/sshpublickeys.go b/profiles/2020-09-01/compute/mgmt/compute/sshpublickeys.go new file mode 100644 index 000000000000..0b015403609d --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/sshpublickeys.go @@ -0,0 +1,651 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// SSHPublicKeysClient is the compute Client +type SSHPublicKeysClient struct { + BaseClient +} +// NewSSHPublicKeysClient creates an instance of the SSHPublicKeysClient client. +func NewSSHPublicKeysClient(subscriptionID string) SSHPublicKeysClient { + return NewSSHPublicKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSSHPublicKeysClientWithBaseURI creates an instance of the SSHPublicKeysClient 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 NewSSHPublicKeysClientWithBaseURI(baseURI string, subscriptionID string) SSHPublicKeysClient { + return SSHPublicKeysClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// Create creates a new SSH public key resource. + // Parameters: + // resourceGroupName - the name of the resource group. + // SSHPublicKeyName - the name of the SSH public key. + // parameters - parameters supplied to create the SSH public key. +func (client SSHPublicKeysClient) Create(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters SSHPublicKeyResource) (result SSHPublicKeyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePreparer(ctx, resourceGroupName, SSHPublicKeyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Create", nil , "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Create", resp, "Failure responding to request") + } + + return +} + + // CreatePreparer prepares the Create request. + func (client SSHPublicKeysClient) CreatePreparer(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters SSHPublicKeyResource) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "sshPublicKeyName": autorest.Encode("path",SSHPublicKeyName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateSender sends the Create request. The method will close the + // http.Response Body if it receives an error. + func (client SSHPublicKeysClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // CreateResponder handles the response to the Create request. The method always + // closes the http.Response Body. + func (client SSHPublicKeysClient) CreateResponder(resp *http.Response) (result SSHPublicKeyResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete delete an SSH public key. + // Parameters: + // resourceGroupName - the name of the resource group. + // SSHPublicKeyName - the name of the SSH public key. +func (client SSHPublicKeysClient) Delete(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, SSHPublicKeyName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Delete", nil , "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Delete", resp, "Failure responding to request") + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client SSHPublicKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "sshPublicKeyName": autorest.Encode("path",SSHPublicKeyName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client SSHPublicKeysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client SSHPublicKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// GenerateKeyPair generates and returns a public/private key pair and populates the SSH public key resource with the +// public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key +// resource. + // Parameters: + // resourceGroupName - the name of the resource group. + // SSHPublicKeyName - the name of the SSH public key. +func (client SSHPublicKeysClient) GenerateKeyPair(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result SSHPublicKeyGenerateKeyPairResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.GenerateKeyPair") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GenerateKeyPairPreparer(ctx, resourceGroupName, SSHPublicKeyName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "GenerateKeyPair", nil , "Failure preparing request") + return + } + + resp, err := client.GenerateKeyPairSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "GenerateKeyPair", resp, "Failure sending request") + return + } + + result, err = client.GenerateKeyPairResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "GenerateKeyPair", resp, "Failure responding to request") + } + + return +} + + // GenerateKeyPairPreparer prepares the GenerateKeyPair request. + func (client SSHPublicKeysClient) GenerateKeyPairPreparer(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "sshPublicKeyName": autorest.Encode("path",SSHPublicKeyName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GenerateKeyPairSender sends the GenerateKeyPair request. The method will close the + // http.Response Body if it receives an error. + func (client SSHPublicKeysClient) GenerateKeyPairSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GenerateKeyPairResponder handles the response to the GenerateKeyPair request. The method always + // closes the http.Response Body. + func (client SSHPublicKeysClient) GenerateKeyPairResponder(resp *http.Response) (result SSHPublicKeyGenerateKeyPairResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Get retrieves information about an SSH public key. + // Parameters: + // resourceGroupName - the name of the resource group. + // SSHPublicKeyName - the name of the SSH public key. +func (client SSHPublicKeysClient) Get(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (result SSHPublicKeyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, SSHPublicKeyName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client SSHPublicKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, SSHPublicKeyName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "sshPublicKeyName": autorest.Encode("path",SSHPublicKeyName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}",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 SSHPublicKeysClient) 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 SSHPublicKeysClient) GetResponder(resp *http.Response) (result SSHPublicKeyResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListByResourceGroup lists all of the SSH public keys in the specified resource group. Use the nextLink property in +// the response to get the next page of SSH public keys. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client SSHPublicKeysClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SSHPublicKeysGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.spkglr.Response.Response != nil { + sc = result.spkglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListByResourceGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.spkglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.spkglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.spkglr.hasNextLink() && result.spkglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByResourceGroupPreparer prepares the ListByResourceGroup request. + func (client SSHPublicKeysClient) 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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys",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 SSHPublicKeysClient) 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 SSHPublicKeysClient) ListByResourceGroupResponder(resp *http.Response) (result SSHPublicKeysGroupListResult, 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 SSHPublicKeysClient) listByResourceGroupNextResults(ctx context.Context, lastResults SSHPublicKeysGroupListResult) (result SSHPublicKeysGroupListResult, err error) { + req, err := lastResults.sSHPublicKeysGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "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, "compute.SSHPublicKeysClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. + func (client SSHPublicKeysClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SSHPublicKeysGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.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 lists all of the SSH public keys in the subscription. Use the nextLink property in the response +// to get the next page of SSH public keys. +func (client SSHPublicKeysClient) ListBySubscription(ctx context.Context) (result SSHPublicKeysGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.ListBySubscription") + defer func() { + sc := -1 + if result.spkglr.Response.Response != nil { + sc = result.spkglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListBySubscription", nil , "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.spkglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.spkglr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "ListBySubscription", resp, "Failure responding to request") + } + if result.spkglr.hasNextLink() && result.spkglr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListBySubscriptionPreparer prepares the ListBySubscription request. + func (client SSHPublicKeysClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys",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 SSHPublicKeysClient) 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 SSHPublicKeysClient) ListBySubscriptionResponder(resp *http.Response) (result SSHPublicKeysGroupListResult, 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 SSHPublicKeysClient) listBySubscriptionNextResults(ctx context.Context, lastResults SSHPublicKeysGroupListResult) (result SSHPublicKeysGroupListResult, err error) { + req, err := lastResults.sSHPublicKeysGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "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, "compute.SSHPublicKeysClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. + func (client SSHPublicKeysClient) ListBySubscriptionComplete(ctx context.Context) (result SSHPublicKeysGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.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 updates a new SSH public key resource. + // Parameters: + // resourceGroupName - the name of the resource group. + // SSHPublicKeyName - the name of the SSH public key. + // parameters - parameters supplied to update the SSH public key. +func (client SSHPublicKeysClient) Update(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters SSHPublicKeyUpdateResource) (result SSHPublicKeyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/SSHPublicKeysClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, SSHPublicKeyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Update", nil , "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.SSHPublicKeysClient", "Update", resp, "Failure responding to request") + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client SSHPublicKeysClient) UpdatePreparer(ctx context.Context, resourceGroupName string, SSHPublicKeyName string, parameters SSHPublicKeyUpdateResource) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "sshPublicKeyName": autorest.Encode("path",SSHPublicKeyName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + 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.Compute/sshPublicKeys/{sshPublicKeyName}",pathParameters), +autorest.WithJSON(parameters), +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 SSHPublicKeysClient) 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 SSHPublicKeysClient) UpdateResponder(resp *http.Response) (result SSHPublicKeyResource, 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/profiles/2020-09-01/compute/mgmt/compute/usage.go b/profiles/2020-09-01/compute/mgmt/compute/usage.go new file mode 100644 index 000000000000..79efa8e0e09f --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/usage.go @@ -0,0 +1,164 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// UsageClient is the compute Client +type UsageClient struct { + BaseClient +} +// NewUsageClient creates an instance of the UsageClient client. +func NewUsageClient(subscriptionID string) UsageClient { + return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageClientWithBaseURI creates an instance of the UsageClient 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 NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { + return UsageClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// List gets, for the specified location, the current compute resource usage information as well as the limits for +// compute resources under the subscription. + // Parameters: + // location - the location for which resource usage is queried. +func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/UsageClient.List") + defer func() { + sc := -1 + if result.lur.Response.Response != nil { + sc = result.lur.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: location, + Constraints: []validation.Constraint{ {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.UsageClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lur.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request") + return + } + + result.lur, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request") + } + if result.lur.hasNextLink() && result.lur.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages",pathParameters), +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 UsageClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client UsageClient) listNextResults(ctx context.Context, lastResults ListUsagesResult) (result ListUsagesResult, err error) { + req, err := lastResults.listUsagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/UsageClient.List") + 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.List(ctx, location) + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/version.go b/profiles/2020-09-01/compute/mgmt/compute/version.go new file mode 100644 index 000000000000..4f3b63a86fdb --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/version.go @@ -0,0 +1,31 @@ +package compute + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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() + " compute/mgmt" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensionimages.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensionimages.go new file mode 100644 index 000000000000..35ba1598f464 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensionimages.go @@ -0,0 +1,278 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineExtensionImagesClient is the compute Client +type VirtualMachineExtensionImagesClient struct { + BaseClient +} +// NewVirtualMachineExtensionImagesClient creates an instance of the VirtualMachineExtensionImagesClient client. +func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient { + return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the VirtualMachineExtensionImagesClient +// 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 NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient { + return VirtualMachineExtensionImagesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// Get gets a virtual machine extension image. + // Parameters: + // location - the name of a supported Azure region. +func (client VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineExtensionImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, typeParameter string, version string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "publisherName": autorest.Encode("path",publisherName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "type": autorest.Encode("path",typeParameter), + "version": autorest.Encode("path",version), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}",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 VirtualMachineExtensionImagesClient) 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 VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListTypes gets a list of virtual machine extension image types. + // Parameters: + // location - the name of a supported Azure region. +func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionImagesClient.ListTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListTypesPreparer(ctx, location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil , "Failure preparing request") + return + } + + resp, err := client.ListTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request") + return + } + + result, err = client.ListTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request") + } + + return +} + + // ListTypesPreparer prepares the ListTypes request. + func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "publisherName": autorest.Encode("path",publisherName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListTypesSender sends the ListTypes request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListTypesResponder handles the response to the ListTypes request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListVersions gets a list of virtual machine extension image versions. + // Parameters: + // location - the name of a supported Azure region. + // filter - the filter to apply on the operation. +func (client VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionImagesClient.ListVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil , "Failure preparing request") + return + } + + resp, err := client.ListVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request") + return + } + + result, err = client.ListVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request") + } + + return +} + + // ListVersionsPreparer prepares the ListVersions request. + func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "publisherName": autorest.Encode("path",publisherName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "type": autorest.Encode("path",typeParameter), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query",filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query",*top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query",orderby) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListVersionsSender sends the ListVersions request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListVersionsResponder handles the response to the ListVersions request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensions.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensions.go new file mode 100644 index 000000000000..cfa6f52deb9b --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineextensions.go @@ -0,0 +1,439 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineExtensionsClient is the compute Client +type VirtualMachineExtensionsClient struct { + BaseClient +} +// NewVirtualMachineExtensionsClient creates an instance of the VirtualMachineExtensionsClient client. +func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient { + return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the VirtualMachineExtensionsClient 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 NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient { + return VirtualMachineExtensionsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate the operation to create or update the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine where the extension should be created or updated. + // VMExtensionName - the name of the virtual machine extension. + // extensionParameters - parameters supplied to the Create Virtual Machine Extension operation. +func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineExtensionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete the operation to delete the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine where the extension should be deleted. + // VMExtensionName - the name of the virtual machine extension. +func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get the operation to get the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine containing the extension. + // VMExtensionName - the name of the virtual machine extension. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}",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 VirtualMachineExtensionsClient) 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 VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List the operation to get all extensions of a Virtual Machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine containing the extension. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, VMName string, expand string) (result VirtualMachineExtensionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionsClient.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, resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "List", resp, "Failure responding to request") + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions",pathParameters), +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 VirtualMachineExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineExtensionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Update the operation to update the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine where the extension should be updated. + // VMExtensionName - the name of the virtual machine extension. + // extensionParameters - parameters supplied to the Update Virtual Machine Extension operation. +func (client VirtualMachineExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (result VirtualMachineExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineExtensionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachineExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + 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.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +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 VirtualMachineExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineExtensionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachineExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineExtension, 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/profiles/2020-09-01/compute/mgmt/compute/virtualmachineimages.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineimages.go new file mode 100644 index 000000000000..ac32eb51da83 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachineimages.go @@ -0,0 +1,438 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineImagesClient is the compute Client +type VirtualMachineImagesClient struct { + BaseClient +} +// NewVirtualMachineImagesClient creates an instance of the VirtualMachineImagesClient client. +func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient { + return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineImagesClientWithBaseURI creates an instance of the VirtualMachineImagesClient 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 NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient { + return VirtualMachineImagesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// Get gets a virtual machine image. + // Parameters: + // location - the name of a supported Azure region. + // publisherName - a valid image publisher. + // offer - a valid image publisher offer. + // skus - a valid image SKU. + // version - a valid image SKU version. +func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "offer": autorest.Encode("path",offer), + "publisherName": autorest.Encode("path",publisherName), + "skus": autorest.Encode("path",skus), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "version": autorest.Encode("path",version), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}",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 VirtualMachineImagesClient) 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 VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + // Parameters: + // location - the name of a supported Azure region. + // publisherName - a valid image publisher. + // offer - a valid image publisher offer. + // skus - a valid image SKU. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, expand string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineImagesClient.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, location, publisherName, offer, skus, expand, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request") + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineImagesClient) ListPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, expand string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "offer": autorest.Encode("path",offer), + "publisherName": autorest.Encode("path",publisherName), + "skus": autorest.Encode("path",skus), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query",*top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query",orderby) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions",pathParameters), +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 VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListOffers gets a list of virtual machine image offers for the specified location and publisher. + // Parameters: + // location - the name of a supported Azure region. + // publisherName - a valid image publisher. +func (client VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineImagesClient.ListOffers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListOffersPreparer(ctx, location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil , "Failure preparing request") + return + } + + resp, err := client.ListOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request") + return + } + + result, err = client.ListOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request") + } + + return +} + + // ListOffersPreparer prepares the ListOffers request. + func (client VirtualMachineImagesClient) ListOffersPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "publisherName": autorest.Encode("path",publisherName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListOffersSender sends the ListOffers request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListOffersResponder handles the response to the ListOffers request. The method always + // closes the http.Response Body. + func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListPublishers gets a list of virtual machine image publishers for the specified Azure location. + // Parameters: + // location - the name of a supported Azure region. +func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineImagesClient.ListPublishers") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPublishersPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil , "Failure preparing request") + return + } + + resp, err := client.ListPublishersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request") + return + } + + result, err = client.ListPublishersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request") + } + + return +} + + // ListPublishersPreparer prepares the ListPublishers request. + func (client VirtualMachineImagesClient) ListPublishersPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListPublishersSender sends the ListPublishers request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListPublishersResponder handles the response to the ListPublishers request. The method always + // closes the http.Response Body. + func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + // Parameters: + // location - the name of a supported Azure region. + // publisherName - a valid image publisher. + // offer - a valid image publisher offer. +func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineImagesClient.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx, location, publisherName, offer) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil , "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + + // ListSkusPreparer prepares the ListSkus request. + func (client VirtualMachineImagesClient) ListSkusPreparer(ctx context.Context, location string, publisherName string, offer string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "offer": autorest.Encode("path",offer), + "publisherName": autorest.Encode("path",publisherName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListSkusSender sends the ListSkus request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListSkusResponder handles the response to the ListSkus request. The method always + // closes the http.Response Body. + func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachines.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachines.go new file mode 100644 index 000000000000..13a82e3f81e3 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachines.go @@ -0,0 +1,1959 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// VirtualMachinesClient is the compute Client +type VirtualMachinesClient struct { + BaseClient +} +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient 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 NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// AssessPatches assess patches on the VM. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) AssessPatches(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesAssessPatchesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.AssessPatches") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AssessPatchesPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "AssessPatches", nil , "Failure preparing request") + return + } + + result, err = client.AssessPatchesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "AssessPatches", result.Response(), "Failure sending request") + return + } + + return +} + + // AssessPatchesPreparer prepares the AssessPatches request. + func (client VirtualMachinesClient) AssessPatchesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // AssessPatchesSender sends the AssessPatches request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) AssessPatchesSender(req *http.Request) (future VirtualMachinesAssessPatchesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // AssessPatchesResponder handles the response to the AssessPatches request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) AssessPatchesResponder(resp *http.Response) (result VirtualMachineAssessPatchesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Capture captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create +// similar VMs. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // parameters - parameters supplied to the Capture Virtual Machine operation. +func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (result VirtualMachinesCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Capture") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "Capture", err.Error()) + } + + req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil , "Failure preparing request") + return + } + + result, err = client.CaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", result.Response(), "Failure sending request") + return + } + + return +} + + // CapturePreparer prepares the Capture request. + func (client VirtualMachinesClient) CapturePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CaptureSender sends the Capture request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) CaptureSender(req *http.Request) (future VirtualMachinesCaptureFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CaptureResponder handles the response to the Capture request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ConvertToManagedDisks converts virtual machine disks from blob-based to managed disks. Virtual machine must be +// stop-deallocated before invoking this operation. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesConvertToManagedDisksFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ConvertToManagedDisks") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ConvertToManagedDisksPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil , "Failure preparing request") + return + } + + result, err = client.ConvertToManagedDisksSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", result.Response(), "Failure sending request") + return + } + + return +} + + // ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request. + func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (future VirtualMachinesConvertToManagedDisksFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// CreateOrUpdate the operation to create or update a virtual machine. Please note some properties can be set only +// during virtual machine creation. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // parameters - parameters supplied to the Create Virtual Machine operation. +func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil }, + }}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + parameters.Resources = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Deallocate shuts down the virtual machine and releases the compute resources. You are not billed for the compute +// resources that this virtual machine uses. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Deallocate(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil , "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + + // DeallocatePreparer prepares the Deallocate request. + func (client VirtualMachinesClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeallocateSender sends the Deallocate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (future VirtualMachinesDeallocateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeallocateResponder handles the response to the Deallocate request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Delete the operation to delete a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // forceDeletion - optional parameter to force delete virtual machines. +func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, VMName string, forceDeletion *bool) (result VirtualMachinesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, forceDeletion) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, forceDeletion *bool) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if forceDeletion != nil { + queryParameters["forceDeletion"] = autorest.Encode("query",*forceDeletion) + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Generalize sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine +// before performing this operation.
    For Windows, please refer to [Create a managed image of a generalized VM in +// Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).
    For Linux, please +// refer to [How to create an image of a virtual machine or +// VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image). + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Generalize") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GeneralizePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil , "Failure preparing request") + return + } + + resp, err := client.GeneralizeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") + return + } + + result, err = client.GeneralizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request") + } + + return +} + + // GeneralizePreparer prepares the Generalize request. + func (client VirtualMachinesClient) GeneralizePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GeneralizeSender sends the Generalize request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GeneralizeResponder handles the response to the Generalize request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get retrieves information about the model view or the instance view of a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // expand - the expand expression to apply on the operation. +func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}",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 VirtualMachinesClient) 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 VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// InstanceView retrieves information about the run-time state of a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.InstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.InstanceViewPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", nil , "Failure preparing request") + return + } + + resp, err := client.InstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure sending request") + return + } + + result, err = client.InstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "InstanceView", resp, "Failure responding to request") + } + + return +} + + // InstanceViewPreparer prepares the InstanceView request. + func (client VirtualMachinesClient) InstanceViewPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // InstanceViewSender sends the InstanceView request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) InstanceViewSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // InstanceViewResponder handles the response to the InstanceView request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) InstanceViewResponder(resp *http.Response) (result VirtualMachineInstanceView, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to +// get the next page of virtual machines. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.List") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request") + } + if result.vmlr.hasNextLink() && result.vmlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachinesClient) ListPreparer(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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines",pathParameters), +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 VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client VirtualMachinesClient) listNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.List") + 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.List(ctx, resourceGroupName) + return + } + +// ListAll lists all of the virtual machines in the specified subscription. Use the nextLink property in the response +// to get the next page of virtual machines. + // Parameters: + // statusOnly - statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. +func (client VirtualMachinesClient) ListAll(ctx context.Context, statusOnly string) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ListAll") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx, statusOnly) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil , "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request") + } + if result.vmlr.hasNextLink() && result.vmlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListAllPreparer prepares the ListAll request. + func (client VirtualMachinesClient) ListAllPreparer(ctx context.Context, statusOnly string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(statusOnly) > 0 { + queryParameters["statusOnly"] = autorest.Encode("query",statusOnly) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListAllSender sends the ListAll request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListAllResponder handles the response to the ListAll request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listAllNextResults retrieves the next set of results, if any. + func (client VirtualMachinesClient) listAllNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListAllComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachinesClient) ListAllComplete(ctx context.Context, statusOnly string) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ListAll") + 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.ListAll(ctx, statusOnly) + return + } + +// ListAvailableSizes lists all available virtual machine sizes to which the specified virtual machine can be resized. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ListAvailableSizes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil , "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + + // ListAvailableSizesPreparer prepares the ListAvailableSizes request. + func (client VirtualMachinesClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// ListByLocation gets all the virtual machines under the specified subscription for the specified location. + // Parameters: + // location - the location for which virtual machines under the subscription are queried. +func (client VirtualMachinesClient) ListByLocation(ctx context.Context, location string) (result VirtualMachineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ListByLocation") + defer func() { + sc := -1 + if result.vmlr.Response.Response != nil { + sc = result.vmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: location, + Constraints: []validation.Constraint{ {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.VirtualMachinesClient", "ListByLocation", err.Error()) + } + + result.fn = client.listByLocationNextResults + req, err := client.ListByLocationPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", nil , "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.vmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure sending request") + return + } + + result.vmlr, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListByLocation", resp, "Failure responding to request") + } + if result.vmlr.hasNextLink() && result.vmlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListByLocationPreparer prepares the ListByLocation request. + func (client VirtualMachinesClient) ListByLocationPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListByLocationSender sends the ListByLocation request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListByLocationResponder handles the response to the ListByLocation request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ListByLocationResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listByLocationNextResults retrieves the next set of results, if any. + func (client VirtualMachinesClient) listByLocationNextResults(ctx context.Context, lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.virtualMachineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listByLocationNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListByLocationComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachinesClient) ListByLocationComplete(ctx context.Context, location string) (result VirtualMachineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.ListByLocation") + 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.ListByLocation(ctx, location) + return + } + +// PerformMaintenance the operation to perform maintenance on a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", nil , "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + + // PerformMaintenancePreparer prepares the PerformMaintenance request. + func (client VirtualMachinesClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PerformMaintenanceSender sends the PerformMaintenance request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachinesPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// PowerOff the operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same +// provisioned resources. You are still charged for this virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates + // non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + // specified +func (client VirtualMachinesClient) PowerOff(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (result VirtualMachinesPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMName, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil , "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + + // PowerOffPreparer prepares the PowerOff request. + func (client VirtualMachinesClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMName string, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query",*skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query",false) + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PowerOffSender sends the PowerOff request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (future VirtualMachinesPowerOffFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PowerOffResponder handles the response to the PowerOff request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Reapply the operation to reapply a virtual machine's state. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Reapply(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesReapplyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Reapply") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReapplyPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reapply", nil , "Failure preparing request") + return + } + + result, err = client.ReapplySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reapply", result.Response(), "Failure sending request") + return + } + + return +} + + // ReapplyPreparer prepares the Reapply request. + func (client VirtualMachinesClient) ReapplyPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReapplySender sends the Reapply request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ReapplySender(req *http.Request) (future VirtualMachinesReapplyFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReapplyResponder handles the response to the Reapply request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ReapplyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Redeploy shuts down the virtual machine, moves it to a new node, and powers it back on. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil , "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + + // RedeployPreparer prepares the Redeploy request. + func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RedeploySender sends the Redeploy request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) RedeploySender(req *http.Request) (future VirtualMachinesRedeployFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RedeployResponder handles the response to the Redeploy request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Reimage reimages the virtual machine which has an ephemeral OS disk back to its initial state. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // parameters - parameters supplied to the Reimage Virtual Machine operation. +func (client VirtualMachinesClient) Reimage(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (result VirtualMachinesReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", nil , "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + + // ReimagePreparer prepares the Reimage request. + func (client VirtualMachinesClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters *VirtualMachineReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReimageSender sends the Reimage request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) ReimageSender(req *http.Request) (future VirtualMachinesReimageFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReimageResponder handles the response to the Reimage request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Restart the operation to restart a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Restart(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil , "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + + // RestartPreparer prepares the Restart request. + func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RestartSender sends the Restart request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) RestartSender(req *http.Request) (future VirtualMachinesRestartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RestartResponder handles the response to the Restart request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// RetrieveBootDiagnosticsData the operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // sasURIExpirationTimeInMinutes - expiration duration in minutes for the SAS URIs with a value between 1 to + // 1440 minutes.

    NOTE: If not specified, SAS URIs will be generated with a default expiration duration + // of 120 minutes. +func (client VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, VMName string, sasURIExpirationTimeInMinutes *int32) (result RetrieveBootDiagnosticsDataResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.RetrieveBootDiagnosticsData") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RetrieveBootDiagnosticsDataPreparer(ctx, resourceGroupName, VMName, sasURIExpirationTimeInMinutes) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RetrieveBootDiagnosticsData", nil , "Failure preparing request") + return + } + + resp, err := client.RetrieveBootDiagnosticsDataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RetrieveBootDiagnosticsData", resp, "Failure sending request") + return + } + + result, err = client.RetrieveBootDiagnosticsDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "RetrieveBootDiagnosticsData", resp, "Failure responding to request") + } + + return +} + + // RetrieveBootDiagnosticsDataPreparer prepares the RetrieveBootDiagnosticsData request. + func (client VirtualMachinesClient) RetrieveBootDiagnosticsDataPreparer(ctx context.Context, resourceGroupName string, VMName string, sasURIExpirationTimeInMinutes *int32) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if sasURIExpirationTimeInMinutes != nil { + queryParameters["sasUriExpirationTimeInMinutes"] = autorest.Encode("query",*sasURIExpirationTimeInMinutes) + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RetrieveBootDiagnosticsDataSender sends the RetrieveBootDiagnosticsData request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) RetrieveBootDiagnosticsDataSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // RetrieveBootDiagnosticsDataResponder handles the response to the RetrieveBootDiagnosticsData request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) RetrieveBootDiagnosticsDataResponder(resp *http.Response) (result RetrieveBootDiagnosticsDataResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// SimulateEviction the operation to simulate the eviction of spot virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) SimulateEviction(ctx context.Context, resourceGroupName string, VMName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.SimulateEviction") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SimulateEvictionPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "SimulateEviction", nil , "Failure preparing request") + return + } + + resp, err := client.SimulateEvictionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "SimulateEviction", resp, "Failure sending request") + return + } + + result, err = client.SimulateEvictionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "SimulateEviction", resp, "Failure responding to request") + } + + return +} + + // SimulateEvictionPreparer prepares the SimulateEviction request. + func (client VirtualMachinesClient) SimulateEvictionPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // SimulateEvictionSender sends the SimulateEviction request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) SimulateEvictionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // SimulateEvictionResponder handles the response to the SimulateEviction request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) SimulateEvictionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Start the operation to start a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. +func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil , "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + + // StartPreparer prepares the Start request. + func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // StartSender sends the Start request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // StartResponder handles the response to the Start request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Update the operation to update a virtual machine. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMName - the name of the virtual machine. + // parameters - parameters supplied to the Update Virtual Machine operation. +func (client VirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (result VirtualMachinesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachinesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmName": autorest.Encode("path",VMName), + } + + const APIVersion = "2020-06-01" + 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.Compute/virtualMachines/{vmName}",pathParameters), +autorest.WithJSON(parameters), +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 VirtualMachinesClient) UpdateSender(req *http.Request) (future VirtualMachinesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetextensions.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetextensions.go new file mode 100644 index 000000000000..4319cc719a14 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetextensions.go @@ -0,0 +1,479 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineScaleSetExtensionsClient is the compute Client +type VirtualMachineScaleSetExtensionsClient struct { + BaseClient +} +// NewVirtualMachineScaleSetExtensionsClient creates an instance of the VirtualMachineScaleSetExtensionsClient client. +func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string) VirtualMachineScaleSetExtensionsClient { + return NewVirtualMachineScaleSetExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetExtensionsClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetExtensionsClient 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 NewVirtualMachineScaleSetExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetExtensionsClient { + return VirtualMachineScaleSetExtensionsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate the operation to create or update an extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set where the extension should be create or updated. + // vmssExtensionName - the name of the VM scale set extension. + // extensionParameters - parameters supplied to the Create VM scale set Extension operation. +func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (result VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + "vmssExtensionName": autorest.Encode("path",vmssExtensionName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + extensionParameters.Type = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete the operation to delete the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set where the extension should be deleted. + // vmssExtensionName - the name of the VM scale set extension. +func (client VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (result VirtualMachineScaleSetExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachineScaleSetExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + "vmssExtensionName": autorest.Encode("path",vmssExtensionName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get the operation to get the extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set containing the extension. + // vmssExtensionName - the name of the VM scale set extension. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result VirtualMachineScaleSetExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineScaleSetExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + "vmssExtensionName": autorest.Encode("path",vmssExtensionName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}",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 VirtualMachineScaleSetExtensionsClient) 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 VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List gets a list of all extensions in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set containing the extension. +func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.List") + defer func() { + sc := -1 + if result.vmsselr.Response.Response != nil { + sc = result.vmsselr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmsselr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.vmsselr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure responding to request") + } + if result.vmsselr.hasNextLink() && result.vmsselr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineScaleSetExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions",pathParameters), +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 VirtualMachineScaleSetExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetExtensionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetExtensionsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetExtensionListResult) (result VirtualMachineScaleSetExtensionListResult, err error) { + req, err := lastResults.virtualMachineScaleSetExtensionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.List") + 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.List(ctx, resourceGroupName, VMScaleSetName) + return + } + +// Update the operation to update an extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set where the extension should be updated. + // vmssExtensionName - the name of the VM scale set extension. + // extensionParameters - parameters supplied to the Update VM scale set Extension operation. +func (client VirtualMachineScaleSetExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate) (result VirtualMachineScaleSetExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetExtensionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachineScaleSetExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + "vmssExtensionName": autorest.Encode("path",vmssExtensionName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + extensionParameters.Name = nil + extensionParameters.Type = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPatch(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +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 VirtualMachineScaleSetExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetExtensionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetrollingupgrades.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetrollingupgrades.go new file mode 100644 index 000000000000..255081a9e07a --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetrollingupgrades.go @@ -0,0 +1,344 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineScaleSetRollingUpgradesClient is the compute Client +type VirtualMachineScaleSetRollingUpgradesClient struct { + BaseClient +} +// NewVirtualMachineScaleSetRollingUpgradesClient creates an instance of the +// VirtualMachineScaleSetRollingUpgradesClient client. +func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient { + return NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetRollingUpgradesClient 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 NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient { + return VirtualMachineScaleSetRollingUpgradesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// Cancel cancels the current virtual machine scale set rolling upgrade. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) Cancel(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetRollingUpgradesClient.Cancel") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CancelPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", nil , "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + + // CancelPreparer prepares the Cancel request. + func (client VirtualMachineScaleSetRollingUpgradesClient) CancelPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CancelSender sends the Cancel request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetRollingUpgradesClient) CancelSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CancelResponder handles the response to the Cancel request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetRollingUpgradesClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// GetLatest gets the status of the latest virtual machine scale set rolling upgrade. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result RollingUpgradeStatusInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetRollingUpgradesClient.GetLatest") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLatestPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", nil , "Failure preparing request") + return + } + + resp, err := client.GetLatestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure sending request") + return + } + + result, err = client.GetLatestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure responding to request") + } + + return +} + + // GetLatestPreparer prepares the GetLatest request. + func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GetLatestSender sends the GetLatest request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GetLatestResponder handles the response to the GetLatest request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestResponder(resp *http.Response) (result RollingUpgradeStatusInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// StartExtensionUpgrade starts a rolling upgrade to move all extensions for all virtual machine scale set instances to +// the latest available extension version. Instances which are already running the latest extension versions are not +// affected. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartExtensionUpgradePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", nil , "Failure preparing request") + return + } + + result, err = client.StartExtensionUpgradeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartExtensionUpgrade", result.Response(), "Failure sending request") + return + } + + return +} + + // StartExtensionUpgradePreparer prepares the StartExtensionUpgrade request. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // StartExtensionUpgradeSender sends the StartExtensionUpgrade request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // StartExtensionUpgradeResponder handles the response to the StartExtensionUpgrade request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// StartOSUpgrade starts a rolling upgrade to move all virtual machine scale set instances to the latest available +// Platform Image OS version. Instances which are already running the latest available OS version are not affected. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartOSUpgradePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", nil , "Failure preparing request") + return + } + + result, err = client.StartOSUpgradeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", result.Response(), "Failure sending request") + return + } + + return +} + + // StartOSUpgradePreparer prepares the StartOSUpgrade request. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // StartOSUpgradeSender sends the StartOSUpgrade request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // StartOSUpgradeResponder handles the response to the StartOSUpgrade request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesets.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesets.go new file mode 100644 index 000000000000..65d12cb336de --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesets.go @@ -0,0 +1,1961 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// VirtualMachineScaleSetsClient is the compute Client +type VirtualMachineScaleSetsClient struct { + BaseClient +} +// NewVirtualMachineScaleSetsClient creates an instance of the VirtualMachineScaleSetsClient client. +func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient { + return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the VirtualMachineScaleSetsClient 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 NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient { + return VirtualMachineScaleSetsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// ConvertToSinglePlacementGroup converts SinglePlacementGroup property to false for a existing virtual machine scale +// set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the virtual machine scale set to create or update. + // parameters - the input object for ConvertToSinglePlacementGroup API. +func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ConvertToSinglePlacementGroupPreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", nil , "Failure preparing request") + return + } + + resp, err := client.ConvertToSinglePlacementGroupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", resp, "Failure sending request") + return + } + + result, err = client.ConvertToSinglePlacementGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ConvertToSinglePlacementGroup", resp, "Failure responding to request") + } + + return +} + + // ConvertToSinglePlacementGroupPreparer prepares the ConvertToSinglePlacementGroup request. + func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ConvertToSinglePlacementGroupSender sends the ConvertToSinglePlacementGroup request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ConvertToSinglePlacementGroupResponder handles the response to the ConvertToSinglePlacementGroup request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return + } + +// CreateOrUpdate create or update a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set to create or update. + // parameters - the scale set object. +func (client VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSet) (result VirtualMachineScaleSetsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil }, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxBatchInstancePercent", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil }, + }}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil }, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyInstancePercent", Name: validation.InclusiveMinimum, Rule: int64(5), Chain: nil }, + }}, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil }, + {Target: "parameters.VirtualMachineScaleSetProperties.UpgradePolicy.RollingUpgradePolicy.MaxUnhealthyUpgradedInstancePercent", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil }, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSet) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Deallocate deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the +// compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil , "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + + // DeallocatePreparer prepares the Deallocate request. + func (client VirtualMachineScaleSetsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeallocateSender sends the Deallocate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetsDeallocateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeallocateResponder handles the response to the Deallocate request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Delete deletes a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachineScaleSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// DeleteInstances deletes virtual machines in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsDeleteInstancesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.DeleteInstances") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{ {Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "DeleteInstances", err.Error()) + } + + req, err := client.DeleteInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil , "Failure preparing request") + return + } + + result, err = client.DeleteInstancesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", result.Response(), "Failure sending request") + return + } + + return +} + + // DeleteInstancesPreparer prepares the DeleteInstances request. + func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete",pathParameters), +autorest.WithJSON(VMInstanceIDs), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteInstancesSender sends the DeleteInstances request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (future VirtualMachineScaleSetsDeleteInstancesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteInstancesResponder handles the response to the DeleteInstances request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalk manual platform update domain walk to update virtual machines in +// a service fabric virtual machine scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // platformUpdateDomain - the platform update domain for which a manual recovery walk is requested +func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, VMScaleSetName string, platformUpdateDomain int32) (result RecoveryWalkResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer(ctx, resourceGroupName, VMScaleSetName, platformUpdateDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", nil , "Failure preparing request") + return + } + + resp, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", resp, "Failure sending request") + return + } + + result, err = client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ForceRecoveryServiceFabricPlatformUpdateDomainWalk", resp, "Failure responding to request") + } + + return +} + + // ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer prepares the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. + func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, platformUpdateDomain int32) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + "platformUpdateDomain": autorest.Encode("query",platformUpdateDomain), + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender sends the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder handles the response to the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalkResponder(resp *http.Response) (result RecoveryWalkResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Get display information about a virtual machine scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineScaleSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}",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 VirtualMachineScaleSetsClient) 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 VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// GetInstanceView gets the status of a VM scale set instance. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.GetInstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil , "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + + // GetInstanceViewPreparer prepares the GetInstanceView request. + func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GetInstanceViewSender sends the GetInstanceView request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GetInstanceViewResponder handles the response to the GetInstanceView request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetInstanceView, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// GetOSUpgradeHistory gets list of OS upgrades on a VM scale set instance. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistory(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListOSUpgradeHistoryPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.GetOSUpgradeHistory") + defer func() { + sc := -1 + if result.vmsslouh.Response.Response != nil { + sc = result.vmsslouh.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getOSUpgradeHistoryNextResults + req, err := client.GetOSUpgradeHistoryPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", nil , "Failure preparing request") + return + } + + resp, err := client.GetOSUpgradeHistorySender(req) + if err != nil { + result.vmsslouh.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", resp, "Failure sending request") + return + } + + result.vmsslouh, err = client.GetOSUpgradeHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetOSUpgradeHistory", resp, "Failure responding to request") + } + if result.vmsslouh.hasNextLink() && result.vmsslouh.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // GetOSUpgradeHistoryPreparer prepares the GetOSUpgradeHistory request. + func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GetOSUpgradeHistorySender sends the GetOSUpgradeHistory request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GetOSUpgradeHistoryResponder handles the response to the GetOSUpgradeHistory request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryResponder(resp *http.Response) (result VirtualMachineScaleSetListOSUpgradeHistory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // getOSUpgradeHistoryNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetsClient) getOSUpgradeHistoryNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListOSUpgradeHistory) (result VirtualMachineScaleSetListOSUpgradeHistory, err error) { + req, err := lastResults.virtualMachineScaleSetListOSUpgradeHistoryPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetOSUpgradeHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", resp, "Failure sending next results request") + } + result, err = client.GetOSUpgradeHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "getOSUpgradeHistoryNextResults", resp, "Failure responding to next results request") + } + return + } + + // GetOSUpgradeHistoryComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetsClient) GetOSUpgradeHistoryComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListOSUpgradeHistoryIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.GetOSUpgradeHistory") + 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.GetOSUpgradeHistory(ctx, resourceGroupName, VMScaleSetName) + return + } + +// List gets a list of all VM scale sets under a resource group. + // Parameters: + // resourceGroupName - the name of the resource group. +func (client VirtualMachineScaleSetsClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.List") + defer func() { + sc := -1 + if result.vmsslr.Response.Response != nil { + sc = result.vmsslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmsslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request") + return + } + + result.vmsslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request") + } + if result.vmsslr.hasNextLink() && result.vmsslr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineScaleSetsClient) ListPreparer(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 = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets",pathParameters), +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 VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) { + req, err := lastResults.virtualMachineScaleSetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.List") + 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.List(ctx, resourceGroupName) + return + } + +// ListAll gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use +// nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all +// the VM Scale Sets. +func (client VirtualMachineScaleSetsClient) ListAll(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ListAll") + defer func() { + sc := -1 + if result.vmsslwlr.Response.Response != nil { + sc = result.vmsslwlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil , "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vmsslwlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request") + return + } + + result.vmsslwlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request") + } + if result.vmsslwlr.hasNextLink() && result.vmsslwlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListAllPreparer prepares the ListAll request. + func (client VirtualMachineScaleSetsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{} { + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListAllSender sends the ListAll request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListAllResponder handles the response to the ListAll request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response) (result VirtualMachineScaleSetListWithLinkResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listAllNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetsClient) listAllNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) { + req, err := lastResults.virtualMachineScaleSetListWithLinkResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListAllComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ListAll") + 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.ListAll(ctx) + return + } + +// ListSkus gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed +// for each SKU. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. +func (client VirtualMachineScaleSetsClient) ListSkus(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ListSkus") + defer func() { + sc := -1 + if result.vmsslsr.Response.Response != nil { + sc = result.vmsslsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx, resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil , "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.vmsslsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request") + return + } + + result.vmsslsr, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request") + } + if result.vmsslsr.hasNextLink() && result.vmsslsr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListSkusPreparer prepares the ListSkus request. + func (client VirtualMachineScaleSetsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ListSkusSender sends the ListSkus request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListSkusResponder handles the response to the ListSkus request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Response) (result VirtualMachineScaleSetListSkusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listSkusNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetsClient) listSkusNextResults(ctx context.Context, lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) { + req, err := lastResults.virtualMachineScaleSetListSkusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListSkusComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ListSkus") + 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.ListSkus(ctx, resourceGroupName, VMScaleSetName) + return + } + +// PerformMaintenance perform maintenance on one or more virtual machines in a VM scale set. Operation on instances +// which are not eligible for perform maintenance will be failed. Please refer to best practices for more details: +// https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PerformMaintenance", nil , "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + + // PerformMaintenancePreparer prepares the PerformMaintenance request. + func (client VirtualMachineScaleSetsClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PerformMaintenanceSender sends the PerformMaintenance request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachineScaleSetsPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// PowerOff power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and +// you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. + // skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates + // non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + // specified +func (client VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, skipShutdown *bool) (result VirtualMachineScaleSetsPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil , "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + + // PowerOffPreparer prepares the PowerOff request. + func (client VirtualMachineScaleSetsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query",*skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query",false) + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PowerOffSender sends the PowerOff request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetsPowerOffFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PowerOffResponder handles the response to the PowerOff request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Redeploy shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers +// them back on. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Redeploy", nil , "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + + // RedeployPreparer prepares the Redeploy request. + func (client VirtualMachineScaleSetsClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RedeploySender sends the Redeploy request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) RedeploySender(req *http.Request) (future VirtualMachineScaleSetsRedeployFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RedeployResponder handles the response to the Redeploy request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a +// ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial state. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMScaleSetReimageInput - parameters for Reimaging VM ScaleSet. +func (client VirtualMachineScaleSetsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMScaleSetReimageInput *VirtualMachineScaleSetReimageParameters) (result VirtualMachineScaleSetsReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, VMScaleSetReimageInput) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil , "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + + // ReimagePreparer prepares the Reimage request. + func (client VirtualMachineScaleSetsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMScaleSetReimageInput *VirtualMachineScaleSetReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMScaleSetReimageInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMScaleSetReimageInput)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReimageSender sends the Reimage request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetsReimageFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReimageResponder handles the response to the Reimage request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// ReimageAll reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation +// is only supported for managed disks. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.ReimageAll") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", nil , "Failure preparing request") + return + } + + result, err = client.ReimageAllSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", result.Response(), "Failure sending request") + return + } + + return +} + + // ReimageAllPreparer prepares the ReimageAll request. + func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReimageAllSender sends the ReimageAll request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetsReimageAllFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReimageAllResponder handles the response to the ReimageAll request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Restart restarts one or more virtual machines in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil , "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + + // RestartPreparer prepares the Restart request. + func (client VirtualMachineScaleSetsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RestartSender sends the Restart request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetsRestartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RestartResponder handles the response to the Restart request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// SetOrchestrationServiceState changes ServiceState property for a given service + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the virtual machine scale set to create or update. + // parameters - the input object for SetOrchestrationServiceState API. +func (client VirtualMachineScaleSetsClient) SetOrchestrationServiceState(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters OrchestrationServiceStateInput) (result VirtualMachineScaleSetsSetOrchestrationServiceStateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.SetOrchestrationServiceState") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SetOrchestrationServiceStatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "SetOrchestrationServiceState", nil , "Failure preparing request") + return + } + + result, err = client.SetOrchestrationServiceStateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "SetOrchestrationServiceState", result.Response(), "Failure sending request") + return + } + + return +} + + // SetOrchestrationServiceStatePreparer prepares the SetOrchestrationServiceState request. + func (client VirtualMachineScaleSetsClient) SetOrchestrationServiceStatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters OrchestrationServiceStateInput) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState",pathParameters), +autorest.WithJSON(parameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // SetOrchestrationServiceStateSender sends the SetOrchestrationServiceState request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) SetOrchestrationServiceStateSender(req *http.Request) (future VirtualMachineScaleSetsSetOrchestrationServiceStateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // SetOrchestrationServiceStateResponder handles the response to the SetOrchestrationServiceState request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) SetOrchestrationServiceStateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Start starts one or more virtual machines in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil , "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + + // StartPreparer prepares the Start request. + func (client VirtualMachineScaleSetsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // StartSender sends the Start request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetsStartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // StartResponder handles the response to the Start request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Update update a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set to create or update. + // parameters - the scale set object. +func (client VirtualMachineScaleSetsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSetUpdate) (result VirtualMachineScaleSetsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachineScaleSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters VirtualMachineScaleSetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + 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.Compute/virtualMachineScaleSets/{vmScaleSetName}",pathParameters), +autorest.WithJSON(parameters), +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 VirtualMachineScaleSetsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // VMInstanceIDs - a list of virtual machine instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetsClient.UpdateInstances") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{ {Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "UpdateInstances", err.Error()) + } + + req, err := client.UpdateInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil , "Failure preparing request") + return + } + + result, err = client.UpdateInstancesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdateInstancesPreparer prepares the UpdateInstances request. + func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade",pathParameters), +autorest.WithJSON(VMInstanceIDs), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // UpdateInstancesSender sends the UpdateInstances request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (future VirtualMachineScaleSetsUpdateInstancesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateInstancesResponder handles the response to the UpdateInstances request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetsClient) UpdateInstancesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvmextensions.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvmextensions.go new file mode 100644 index 000000000000..dc2bcf104af1 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvmextensions.go @@ -0,0 +1,454 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" +) + +// VirtualMachineScaleSetVMExtensionsClient is the compute Client +type VirtualMachineScaleSetVMExtensionsClient struct { + BaseClient +} +// NewVirtualMachineScaleSetVMExtensionsClient creates an instance of the VirtualMachineScaleSetVMExtensionsClient +// client. +func NewVirtualMachineScaleSetVMExtensionsClient(subscriptionID string) VirtualMachineScaleSetVMExtensionsClient { + return NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetVMExtensionsClient 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 NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMExtensionsClient { + return VirtualMachineScaleSetVMExtensionsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// CreateOrUpdate the operation to create or update the VMSS VM extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // VMExtensionName - the name of the virtual machine extension. + // extensionParameters - parameters supplied to the Create Virtual Machine Extension operation. +func (client VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension) (result VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "CreateOrUpdate", nil , "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + + // CreateOrUpdatePreparer prepares the CreateOrUpdate request. + func (client VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + extensionParameters.Name = nil + extensionParameters.Type = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetVMExtensionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSetVMExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Delete the operation to delete the VMSS VM extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // VMExtensionName - the name of the virtual machine extension. +func (client VirtualMachineScaleSetVMExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string) (result VirtualMachineScaleSetVMExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMExtensionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMExtensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachineScaleSetVMExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetVMExtensionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get the operation to get the VMSS VM extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // VMExtensionName - the name of the virtual machine extension. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, expand string) (result VirtualMachineScaleSetVMExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineScaleSetVMExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}",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 VirtualMachineScaleSetVMExtensionsClient) 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 VirtualMachineScaleSetVMExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVMExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List the operation to get all extensions of an instance in Virtual Machine Scaleset. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand string) (result VirtualMachineScaleSetVMExtensionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMExtensionsClient.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, resourceGroupName, VMScaleSetName, instanceID, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "List", resp, "Failure responding to request") + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineScaleSetVMExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions",pathParameters), +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 VirtualMachineScaleSetVMExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMExtensionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// Update the operation to update the VMSS VM extension. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // VMExtensionName - the name of the virtual machine extension. + // extensionParameters - parameters supplied to the Update Virtual Machine Extension operation. +func (client VirtualMachineScaleSetVMExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate) (result VirtualMachineScaleSetVMExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMExtensionsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMExtensionName, extensionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachineScaleSetVMExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmExtensionName": autorest.Encode("path",VMExtensionName), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + extensionParameters.Name = nil + extensionParameters.Type = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPatch(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}",pathParameters), +autorest.WithJSON(extensionParameters), +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 VirtualMachineScaleSetVMExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetVMExtensionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSetVMExtension, 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/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvms.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvms.go new file mode 100644 index 000000000000..e39f8792f44e --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinescalesetvms.go @@ -0,0 +1,1299 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// VirtualMachineScaleSetVMsClient is the compute Client +type VirtualMachineScaleSetVMsClient struct { + BaseClient +} +// NewVirtualMachineScaleSetVMsClient creates an instance of the VirtualMachineScaleSetVMsClient client. +func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient { + return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the VirtualMachineScaleSetVMsClient 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 NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient { + return VirtualMachineScaleSetVMsClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the +// compute resources it uses. You are not billed for the compute resources of this virtual machine once it is +// deallocated. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeallocateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Deallocate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil , "Failure preparing request") + return + } + + result, err = client.DeallocateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", result.Response(), "Failure sending request") + return + } + + return +} + + // DeallocatePreparer prepares the Deallocate request. + func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeallocateSender sends the Deallocate request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetVMsDeallocateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeallocateResponder handles the response to the Deallocate request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Delete deletes a virtual machine from a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil , "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + + // DeletePreparer prepares the Delete request. + func (client VirtualMachineScaleSetVMsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsDelete(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // DeleteSender sends the Delete request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetVMsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // DeleteResponder handles the response to the Delete request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Get gets a virtual machine from a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // expand - the expand expression to apply on the operation. +func (client VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand InstanceViewTypes) (result VirtualMachineScaleSetVM, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil , "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request") + } + + return +} + + // GetPreparer prepares the Get request. + func (client VirtualMachineScaleSetVMsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}",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 VirtualMachineScaleSetVMsClient) 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 VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// GetInstanceView gets the status of a virtual machine from a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.GetInstanceView") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil , "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + + // GetInstanceViewPreparer prepares the GetInstanceView request. + func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // GetInstanceViewSender sends the GetInstanceView request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // GetInstanceViewResponder handles the response to the GetInstanceView request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// List gets a list of all virtual machines in a VM scale sets. + // Parameters: + // resourceGroupName - the name of the resource group. + // virtualMachineScaleSetName - the name of the VM scale set. + // filter - the filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, + // 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + // selectParameter - the list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + // expand - the expand expression to apply to the operation. Allowed values are 'instanceView'. +func (client VirtualMachineScaleSetVMsClient) List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.List") + defer func() { + sc := -1 + if result.vmssvlr.Response.Response != nil { + sc = result.vmssvlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vmssvlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request") + return + } + + result.vmssvlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request") + } + if result.vmssvlr.hasNextLink() && result.vmssvlr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineScaleSetVMsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path",virtualMachineScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query",filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query",selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query",expand) + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines",pathParameters), +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 VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + + // listNextResults retrieves the next set of results, if any. + func (client VirtualMachineScaleSetVMsClient) listNextResults(ctx context.Context, lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) { + req, err := lastResults.virtualMachineScaleSetVMListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", nil , "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure responding to next results request") + } + return + } + + // ListComplete enumerates all values, automatically crossing page boundaries as required. + func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.List") + 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.List(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) + return + } + +// PerformMaintenance performs maintenance on a virtual machine in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPerformMaintenanceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.PerformMaintenance") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PerformMaintenance", nil , "Failure preparing request") + return + } + + result, err = client.PerformMaintenanceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PerformMaintenance", result.Response(), "Failure sending request") + return + } + + return +} + + // PerformMaintenancePreparer prepares the PerformMaintenance request. + func (client VirtualMachineScaleSetVMsClient) PerformMaintenancePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PerformMaintenanceSender sends the PerformMaintenance request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) PerformMaintenanceSender(req *http.Request) (future VirtualMachineScaleSetVMsPerformMaintenanceFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PerformMaintenanceResponder handles the response to the PerformMaintenance request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) PerformMaintenanceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// PowerOff power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are +// getting charged for the resources. Instead, use deallocate to release resources and avoid charges. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // skipShutdown - the parameter to request non-graceful VM shutdown. True value for this flag indicates + // non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not + // specified +func (client VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, skipShutdown *bool) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.PowerOff") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, skipShutdown) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil , "Failure preparing request") + return + } + + result, err = client.PowerOffSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", result.Response(), "Failure sending request") + return + } + + return +} + + // PowerOffPreparer prepares the PowerOff request. + func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, skipShutdown *bool) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if skipShutdown != nil { + queryParameters["skipShutdown"] = autorest.Encode("query",*skipShutdown) + } else { + queryParameters["skipShutdown"] = autorest.Encode("query",false) + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // PowerOffSender sends the PowerOff request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetVMsPowerOffFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // PowerOffResponder handles the response to the PowerOff request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Redeploy shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back +// on. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRedeployFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Redeploy") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Redeploy", nil , "Failure preparing request") + return + } + + result, err = client.RedeploySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Redeploy", result.Response(), "Failure sending request") + return + } + + return +} + + // RedeployPreparer prepares the Redeploy request. + func (client VirtualMachineScaleSetVMsClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RedeploySender sends the Redeploy request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) RedeploySender(req *http.Request) (future VirtualMachineScaleSetVMsRedeployFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RedeployResponder handles the response to the Redeploy request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // VMScaleSetVMReimageInput - parameters for the Reimaging Virtual machine in ScaleSet. +func (client VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMScaleSetVMReimageInput *VirtualMachineScaleSetVMReimageParameters) (result VirtualMachineScaleSetVMsReimageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Reimage") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, VMScaleSetVMReimageInput) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil , "Failure preparing request") + return + } + + result, err = client.ReimageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", result.Response(), "Failure sending request") + return + } + + return +} + + // ReimagePreparer prepares the Reimage request. + func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, VMScaleSetVMReimageInput *VirtualMachineScaleSetVMReimageParameters) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage",pathParameters), +autorest.WithQueryParameters(queryParameters)) + if VMScaleSetVMReimageInput != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMScaleSetVMReimageInput)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReimageSender sends the Reimage request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReimageResponder handles the response to the Reimage request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// ReimageAll allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This +// operation is only supported for managed disks. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.ReimageAll") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil , "Failure preparing request") + return + } + + result, err = client.ReimageAllSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", result.Response(), "Failure sending request") + return + } + + return +} + + // ReimageAllPreparer prepares the ReimageAll request. + func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // ReimageAllSender sends the ReimageAll request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageAllFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // ReimageAllResponder handles the response to the ReimageAll request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Restart restarts a virtual machine in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Restart") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil , "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + + // RestartPreparer prepares the Restart request. + func (client VirtualMachineScaleSetVMsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RestartSender sends the Restart request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetVMsRestartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // RestartResponder handles the response to the Restart request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// RetrieveBootDiagnosticsData the operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM +// scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. + // sasURIExpirationTimeInMinutes - expiration duration in minutes for the SAS URIs with a value between 1 to + // 1440 minutes.

    NOTE: If not specified, SAS URIs will be generated with a default expiration duration + // of 120 minutes. +func (client VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, sasURIExpirationTimeInMinutes *int32) (result RetrieveBootDiagnosticsDataResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RetrieveBootDiagnosticsDataPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, sasURIExpirationTimeInMinutes) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "RetrieveBootDiagnosticsData", nil , "Failure preparing request") + return + } + + resp, err := client.RetrieveBootDiagnosticsDataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "RetrieveBootDiagnosticsData", resp, "Failure sending request") + return + } + + result, err = client.RetrieveBootDiagnosticsDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "RetrieveBootDiagnosticsData", resp, "Failure responding to request") + } + + return +} + + // RetrieveBootDiagnosticsDataPreparer prepares the RetrieveBootDiagnosticsData request. + func (client VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsDataPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, sasURIExpirationTimeInMinutes *int32) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + if sasURIExpirationTimeInMinutes != nil { + queryParameters["sasUriExpirationTimeInMinutes"] = autorest.Encode("query",*sasURIExpirationTimeInMinutes) + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // RetrieveBootDiagnosticsDataSender sends the RetrieveBootDiagnosticsData request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsDataSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // RetrieveBootDiagnosticsDataResponder handles the response to the RetrieveBootDiagnosticsData request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsDataResponder(resp *http.Response) (result RetrieveBootDiagnosticsDataResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + +// SimulateEviction the operation to simulate the eviction of spot virtual machine in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.SimulateEviction") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SimulateEvictionPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "SimulateEviction", nil , "Failure preparing request") + return + } + + resp, err := client.SimulateEvictionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "SimulateEviction", resp, "Failure sending request") + return + } + + result, err = client.SimulateEvictionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "SimulateEviction", resp, "Failure responding to request") + } + + return +} + + // SimulateEvictionPreparer prepares the SimulateEviction request. + func (client VirtualMachineScaleSetVMsClient) SimulateEvictionPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // SimulateEvictionSender sends the SimulateEviction request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) SimulateEvictionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // SimulateEvictionResponder handles the response to the SimulateEviction request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) SimulateEvictionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return + } + +// Start starts a virtual machine in a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set. + // instanceID - the instance ID of the virtual machine. +func (client VirtualMachineScaleSetVMsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil , "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + + // StartPreparer prepares the Start request. + func (client VirtualMachineScaleSetVMsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsPost(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start",pathParameters), +autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) + } + + // StartSender sends the Start request. The method will close the + // http.Response Body if it receives an error. + func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetVMsStartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // StartResponder handles the response to the Start request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return + } + +// Update updates a virtual machine of a VM scale set. + // Parameters: + // resourceGroupName - the name of the resource group. + // VMScaleSetName - the name of the VM scale set where the extension should be create or updated. + // instanceID - the instance ID of the virtual machine. + // parameters - parameters supplied to the Update Virtual Machine Scale Sets VM operation. +func (client VirtualMachineScaleSetVMsClient) Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM) (result VirtualMachineScaleSetVMsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineScaleSetVMsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + { TargetValue: parameters, + Constraints: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil }, + }}, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false , + Chain: []validation.Constraint{ {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil }, + {Target: "parameters.VirtualMachineScaleSetVMProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil }, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineScaleSetVMsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Update", nil , "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + + // UpdatePreparer prepares the Update request. + func (client VirtualMachineScaleSetVMsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM) (*http.Request, error) { + pathParameters := map[string]interface{} { + "instanceId": autorest.Encode("path",instanceID), + "resourceGroupName": autorest.Encode("path",resourceGroupName), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path",VMScaleSetName), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + parameters.InstanceID = nil + parameters.Sku = nil + parameters.Resources = nil + parameters.Zones = nil + preparer := autorest.CreatePreparer( +autorest.AsContentType("application/json; charset=utf-8"), +autorest.AsPut(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}",pathParameters), +autorest.WithJSON(parameters), +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 VirtualMachineScaleSetVMsClient) UpdateSender(req *http.Request) (future VirtualMachineScaleSetVMsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return + } + + // UpdateResponder handles the response to the Update request. The method always + // closes the http.Response Body. + func (client VirtualMachineScaleSetVMsClient) UpdateResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } + diff --git a/profiles/2020-09-01/compute/mgmt/compute/virtualmachinesizes.go b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinesizes.go new file mode 100644 index 000000000000..1062b5ec0a32 --- /dev/null +++ b/profiles/2020-09-01/compute/mgmt/compute/virtualmachinesizes.go @@ -0,0 +1,124 @@ +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" + "context" + "github.com/Azure/go-autorest/tracing" + "github.com/Azure/go-autorest/autorest/validation" +) + +// VirtualMachineSizesClient is the compute Client +type VirtualMachineSizesClient struct { + BaseClient +} +// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client. +func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient { + return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient 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 NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient { + return VirtualMachineSizesClient{ NewWithBaseURI(baseURI, subscriptionID)} + } + +// List this API is deprecated. Use [Resources +// Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list) + // Parameters: + // location - the location upon which virtual-machine-sizes is queried. +func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn + "/VirtualMachineSizesClient.List") + 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: location, + Constraints: []validation.Constraint{ {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil }}}}); err != nil { + return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil , "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request") + } + + return +} + + // ListPreparer prepares the List request. + func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{} { + "location": autorest.Encode("path",location), + "subscriptionId": autorest.Encode("path",client.SubscriptionID), + } + + const APIVersion = "2020-06-01" + queryParameters := map[string]interface{} { + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( +autorest.AsGet(), +autorest.WithBaseURL(client.BaseURI), +autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes",pathParameters), +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 VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + } + + // ListResponder handles the response to the List request. The method always + // closes the http.Response Body. + func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return + } +