mirror of https://github.com/prometheus/prometheus
1000 lines
40 KiB
Go
1000 lines
40 KiB
Go
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 0.14.0.0
|
|
// 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"
|
|
"net/url"
|
|
)
|
|
|
|
// VirtualMachineScaleSetsClient is the the Compute Management Client.
|
|
type VirtualMachineScaleSetsClient struct {
|
|
ManagementClient
|
|
}
|
|
|
|
// 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.
|
|
func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient {
|
|
return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
}
|
|
|
|
// CreateOrUpdate the operation to create or update a virtual machine scale
|
|
// set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. name is parameters
|
|
// supplied to the Create Virtual Machine Scale Set operation. parameters is
|
|
// parameters supplied to the Create Virtual Machine Scale Set operation.
|
|
func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet) (result autorest.Response, err error) {
|
|
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.CreateOrUpdateSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.CreateOrUpdateResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"name": url.QueryEscape(name),
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsPut(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}"),
|
|
autorest.WithJSON(parameters),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
// closes the http.Response Body.
|
|
func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
err = autorest.Respond(
|
|
resp,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// Deallocate the operation to deallocate virtual machines in a virtual
|
|
// machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, err error) {
|
|
req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.DeallocateSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.DeallocateResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// DeallocatePreparer prepares the Deallocate request.
|
|
func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
preparer := autorest.CreatePreparer(
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
if vmInstanceIDs != nil {
|
|
preparer = autorest.DecoratePreparer(preparer,
|
|
autorest.WithJSON(vmInstanceIDs))
|
|
}
|
|
return preparer.Prepare(&http.Request{})
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// Delete the operation to delete a virtual machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set.
|
|
func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmScaleSetName string) (result autorest.Response, err error) {
|
|
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.DeleteSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.DeleteResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// DeletePreparer prepares the Delete request.
|
|
func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsDelete(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// DeleteInstances the operation to delete virtual machines in a virtual
|
|
// machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result autorest.Response, err error) {
|
|
req, err := client.DeleteInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.DeleteInstancesSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.DeleteInstancesResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// DeleteInstancesPreparer prepares the DeleteInstances request.
|
|
func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"),
|
|
autorest.WithJSON(vmInstanceIDs),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// Get the operation to get a virtual machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set.
|
|
func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSet, err error) {
|
|
req, err := client.GetPreparer(resourceGroupName, vmScaleSetName)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.GetSender(req)
|
|
if err != nil {
|
|
result.Response = autorest.Response{Response: resp}
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request")
|
|
}
|
|
|
|
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(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsGet(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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 autorest.SendWithSender(client, req)
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
autorest.ByUnmarshallingJSON(&result),
|
|
autorest.ByClosing())
|
|
result.Response = autorest.Response{Response: resp}
|
|
return
|
|
}
|
|
|
|
// GetInstanceView the operation to get a virtual machine scale set instance
|
|
// view.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set.
|
|
func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) {
|
|
req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.GetInstanceViewSender(req)
|
|
if err != nil {
|
|
result.Response = autorest.Response{Response: resp}
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request")
|
|
}
|
|
|
|
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(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsGet(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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 autorest.SendWithSender(client, req)
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
autorest.ByUnmarshallingJSON(&result),
|
|
autorest.ByClosing())
|
|
result.Response = autorest.Response{Response: resp}
|
|
return
|
|
}
|
|
|
|
// List the operation to list virtual machine scale sets under a resource
|
|
// group.
|
|
//
|
|
// resourceGroupName is the name of the resource group.
|
|
func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) {
|
|
req, err := client.ListPreparer(resourceGroupName)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.ListSender(req)
|
|
if err != nil {
|
|
result.Response = autorest.Response{Response: resp}
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.ListResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// ListPreparer prepares the List request.
|
|
func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsGet(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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 autorest.SendWithSender(client, req)
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
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(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) {
|
|
req, err := lastResults.VirtualMachineScaleSetListResultPreparer()
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", nil, "Failure preparing next results request 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", "List", resp, "Failure sending next results request request")
|
|
}
|
|
|
|
result, err = client.ListResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure responding to next results request request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// ListAll gets the list of Virtual Machine Scale Sets in the subscription.
|
|
// Use nextLink property in the response to get the next page of Virtual
|
|
// Machine Scale Sets. Do this till nextLink is not null to fetch all the
|
|
// Virtual Machine Scale Sets.
|
|
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
|
|
req, err := client.ListAllPreparer()
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.ListAllSender(req)
|
|
if err != nil {
|
|
result.Response = autorest.Response{Response: resp}
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.ListAllResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// ListAllPreparer prepares the ListAll request.
|
|
func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsGet(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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 autorest.SendWithSender(client, req)
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
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(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) {
|
|
req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer()
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing next results request 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", "ListAll", resp, "Failure sending next results request request")
|
|
}
|
|
|
|
result, err = client.ListAllResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to next results request request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// ListSkus the operation to list available skus for a virtual machine scale
|
|
// set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set.
|
|
func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) {
|
|
req, err := client.ListSkusPreparer(resourceGroupName, vmScaleSetName)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.ListSkusSender(req)
|
|
if err != nil {
|
|
result.Response = autorest.Response{Response: resp}
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.ListSkusResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// ListSkusPreparer prepares the ListSkus request.
|
|
func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsGet(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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 autorest.SendWithSender(client, req)
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
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(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) {
|
|
req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer()
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing next results request 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", "ListSkus", resp, "Failure sending next results request request")
|
|
}
|
|
|
|
result, err = client.ListSkusResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to next results request request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// PowerOff the operation to power off (stop) virtual machines in a virtual
|
|
// machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, err error) {
|
|
req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.PowerOffSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.PowerOffResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// PowerOffPreparer prepares the PowerOff request.
|
|
func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
preparer := autorest.CreatePreparer(
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
if vmInstanceIDs != nil {
|
|
preparer = autorest.DecoratePreparer(preparer,
|
|
autorest.WithJSON(vmInstanceIDs))
|
|
}
|
|
return preparer.Prepare(&http.Request{})
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// Restart the operation to restart virtual machines in a virtual machine
|
|
// scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, err error) {
|
|
req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.RestartSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.RestartResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// RestartPreparer prepares the Restart request.
|
|
func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
preparer := autorest.CreatePreparer(
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
if vmInstanceIDs != nil {
|
|
preparer = autorest.DecoratePreparer(preparer,
|
|
autorest.WithJSON(vmInstanceIDs))
|
|
}
|
|
return preparer.Prepare(&http.Request{})
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// Start the operation to start virtual machines in a virtual machine scale
|
|
// set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, err error) {
|
|
req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.StartSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.StartResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// StartPreparer prepares the Start request.
|
|
func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
preparer := autorest.CreatePreparer(
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
if vmInstanceIDs != nil {
|
|
preparer = autorest.DecoratePreparer(preparer,
|
|
autorest.WithJSON(vmInstanceIDs))
|
|
}
|
|
return preparer.Prepare(&http.Request{})
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|
|
|
|
// UpdateInstances the operation to manually upgrade virtual machines in a
|
|
// virtual machine scale set.
|
|
//
|
|
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
|
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
|
// virtual machine scale set instance IDs.
|
|
func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result autorest.Response, err error) {
|
|
req, err := client.UpdateInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
|
|
if err != nil {
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request")
|
|
}
|
|
|
|
resp, err := client.UpdateInstancesSender(req)
|
|
if err != nil {
|
|
result.Response = resp
|
|
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure sending request")
|
|
}
|
|
|
|
result, err = client.UpdateInstancesResponder(resp)
|
|
if err != nil {
|
|
err = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure responding to request")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UpdateInstancesPreparer prepares the UpdateInstances request.
|
|
func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
|
|
pathParameters := map[string]interface{}{
|
|
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
|
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
|
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
|
}
|
|
|
|
queryParameters := map[string]interface{}{
|
|
"api-version": APIVersion,
|
|
}
|
|
|
|
return autorest.Prepare(&http.Request{},
|
|
autorest.AsJSON(),
|
|
autorest.AsPost(),
|
|
autorest.WithBaseURL(client.BaseURI),
|
|
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"),
|
|
autorest.WithJSON(vmInstanceIDs),
|
|
autorest.WithPathParameters(pathParameters),
|
|
autorest.WithQueryParameters(queryParameters))
|
|
}
|
|
|
|
// 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) (*http.Response, error) {
|
|
return autorest.SendWithSender(client,
|
|
req,
|
|
azure.DoPollForAsynchronous(autorest.DefaultPollingDuration,
|
|
autorest.DefaultPollingDelay))
|
|
}
|
|
|
|
// 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,
|
|
client.ByInspecting(),
|
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
autorest.ByClosing())
|
|
result.Response = resp
|
|
return
|
|
}
|