From b8de835a91ca4646d2a1f00d9d6829748a5d7647 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Wed, 11 Jul 2018 14:54:57 -0700 Subject: [PATCH 1/2] merge conflicts --- .../2018-04-01/compute/availabilitysets.go | 33 +- .../2018-04-01/compute/containerservices.go | 52 +- .../compute/mgmt/2018-04-01/compute/disks.go | 144 +- .../compute/mgmt/2018-04-01/compute/images.go | 72 +- .../mgmt/2018-04-01/compute/loganalytics.go | 40 +- .../compute/mgmt/2018-04-01/compute/models.go | 2283 ++++--------- .../mgmt/2018-04-01/compute/snapshots.go | 138 +- .../compute/mgmt/2018-04-01/compute/usage.go | 4 +- .../compute/virtualmachineextensionimages.go | 13 +- .../compute/virtualmachineextensions.go | 129 +- .../compute/virtualmachineimages.go | 34 +- .../compute/virtualmachineruncommands.go | 9 +- .../2018-04-01/compute/virtualmachines.go | 333 +- .../virtualmachinescalesetextensions.go | 59 +- .../virtualmachinescalesetrollingupgrades.go | 43 +- .../compute/virtualmachinescalesets.go | 392 ++- .../compute/virtualmachinescalesetvms.go | 236 +- .../2018-04-01/compute/virtualmachinesizes.go | 4 +- .../2018-01-01/network/applicationgateways.go | 137 +- .../network/applicationsecuritygroups.go | 51 +- .../network/availableendpointservices.go | 4 +- .../network/mgmt/2018-01-01/network/client.go | 7 +- .../2018-01-01/network/connectionmonitors.go | 120 +- .../network/defaultsecurityrules.go | 13 +- .../expressroutecircuitauthorizations.go | 57 +- .../network/expressroutecircuitpeerings.go | 61 +- .../network/expressroutecircuits.go | 148 +- .../2018-01-01/network/inboundnatrules.go | 57 +- .../network/interfaceipconfigurations.go | 12 +- .../network/interfaceloadbalancers.go | 5 +- .../mgmt/2018-01-01/network/interfaces.go | 155 +- .../loadbalancerbackendaddresspools.go | 12 +- .../loadbalancerfrontendipconfigurations.go | 12 +- .../network/loadbalancerloadbalancingrules.go | 12 +- .../network/loadbalancernetworkinterfaces.go | 5 +- .../2018-01-01/network/loadbalancerprobes.go | 12 +- .../mgmt/2018-01-01/network/loadbalancers.go | 72 +- .../network/localnetworkgateways.go | 72 +- .../network/mgmt/2018-01-01/network/models.go | 2944 +++-------------- .../mgmt/2018-01-01/network/packetcaptures.go | 99 +- .../2018-01-01/network/publicipaddresses.go | 101 +- .../2018-01-01/network/routefilterrules.go | 79 +- .../mgmt/2018-01-01/network/routefilters.go | 72 +- .../network/mgmt/2018-01-01/network/routes.go | 55 +- .../mgmt/2018-01-01/network/routetables.go | 72 +- .../mgmt/2018-01-01/network/securitygroups.go | 73 +- .../mgmt/2018-01-01/network/securityrules.go | 57 +- .../mgmt/2018-01-01/network/subnets.go | 57 +- .../network/mgmt/2018-01-01/network/usages.go | 4 +- .../virtualnetworkgatewayconnections.go | 126 +- .../network/virtualnetworkgateways.go | 242 +- .../network/virtualnetworkpeerings.go | 57 +- .../2018-01-01/network/virtualnetworks.go | 84 +- .../mgmt/2018-01-01/network/watchers.go | 260 +- .../2016-06-01/subscriptions/subscriptions.go | 8 +- .../resources/deploymentoperations.go | 14 +- .../mgmt/2018-02-01/resources/deployments.go | 87 +- .../mgmt/2018-02-01/resources/groups.go | 50 +- .../mgmt/2018-02-01/resources/models.go | 352 +- .../mgmt/2018-02-01/resources/providers.go | 24 +- .../mgmt/2018-02-01/resources/resources.go | 223 +- .../mgmt/2018-02-01/resources/tags.go | 18 +- .../mgmt/2017-10-01/storage/accounts.go | 106 +- .../storage/mgmt/2017-10-01/storage/models.go | 32 +- .../Azure/azure-sdk-for-go/storage/README.md | 10 +- .../Azure/azure-sdk-for-go/storage/blob.go | 18 +- .../azure-sdk-for-go/storage/blockblob.go | 2 +- .../Azure/azure-sdk-for-go/storage/client.go | 7 + .../azure-sdk-for-go/storage/container.go | 16 +- .../azure-sdk-for-go/storage/copyblob.go | 6 +- .../azure-sdk-for-go/storage/directory.go | 4 +- .../Azure/azure-sdk-for-go/storage/entity.go | 10 +- .../Azure/azure-sdk-for-go/storage/file.go | 8 +- .../storage/fileserviceclient.go | 12 +- .../azure-sdk-for-go/storage/leaseblob.go | 2 +- .../Azure/azure-sdk-for-go/storage/message.go | 6 +- .../azure-sdk-for-go/storage/pageblob.go | 4 +- .../Azure/azure-sdk-for-go/storage/queue.go | 14 +- .../Azure/azure-sdk-for-go/storage/share.go | 4 +- .../storage/storageservice.go | 2 +- .../Azure/azure-sdk-for-go/storage/table.go | 4 +- .../azure-sdk-for-go/storage/table_batch.go | 2 +- .../Azure/azure-sdk-for-go/version/version.go | 2 +- vendor/vendor.json | 72 +- 84 files changed, 4056 insertions(+), 6487 deletions(-) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/availabilitysets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/availabilitysets.go index 4cafe8d1e..1f0007ff5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/availabilitysets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/availabilitysets.go @@ -40,9 +40,10 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) } // CreateOrUpdate create or update an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set. -// parameters is parameters supplied to the Create Availability Set operation. +// 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) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) if err != nil { @@ -109,8 +110,9 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response } // Delete delete an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is the name of the 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 OperationStatusResponse, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName) if err != nil { @@ -175,8 +177,9 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul } // Get retrieves information about an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is the name of the 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) { req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName) if err != nil { @@ -241,8 +244,8 @@ func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result A } // List lists all availability sets in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName) if err != nil { @@ -307,8 +310,9 @@ func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result // ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an // existing availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is the name of the 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) { req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName) if err != nil { @@ -373,9 +377,10 @@ func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Resp } // Update update an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set. -// parameters is parameters supplied to the Update Availability Set operation. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go index 99f10b53a..b16788bfa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go @@ -42,10 +42,10 @@ func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and // agents. -// -// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service -// in the specified subscription and resource group. parameters is parameters supplied to the Create or Update a -// Container Service operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. +// parameters - parameters supplied to the Create or Update a Container Service operation. func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -119,15 +119,17 @@ func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -148,9 +150,9 @@ func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Respons // not delete other resources created as part of creating a container service, including storage accounts, VMs, and // availability sets. All the other resources created with the container service are part of the same resource group // and can be deleted individually. -// -// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service -// in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName) if err != nil { @@ -191,15 +193,17 @@ func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resour // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -218,9 +222,9 @@ func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (resu // Get gets the properties of the specified container service in the specified subscription and resource group. The // operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters // and agents. -// -// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service -// in the specified subscription and resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// containerServiceName - the name of the container service in the specified subscription and resource group. func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName) if err != nil { @@ -378,8 +382,8 @@ func (client ContainerServicesClient) ListComplete(ctx context.Context) (result // ListByResourceGroup gets a list of container services in the specified subscription and resource group. The // operation returns properties of each container service including state, orchestrator, number of masters and agents, // and FQDNs of masters and agents. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go index 32a8eff1a..cdc570377 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go @@ -41,11 +41,12 @@ func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClien } // CreateOrUpdate creates or updates a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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 is disk object supplied in the body of the Put disk -// operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: disk, @@ -109,15 +110,17 @@ func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGr // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -135,10 +138,11 @@ func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result D } // Delete deletes a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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. +// 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, diskName) if err != nil { @@ -179,36 +183,38 @@ func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + 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 OperationStatusResponse, err error) { +func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } // Get gets information about a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, diskName) if err != nil { @@ -273,11 +279,12 @@ func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err er } // GrantAccess grants access to a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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 is access data object supplied in the body -// of the get disk access operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: grantAccessData, @@ -326,15 +333,17 @@ func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroup // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -442,8 +451,8 @@ func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIter } // ListByResourceGroup lists all the disks under a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) @@ -535,10 +544,11 @@ func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resou } // RevokeAccess revokes access to a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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. +// 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) { req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName) if err != nil { @@ -579,37 +589,39 @@ func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGrou // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + 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 OperationStatusResponse, err error) { +func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } // Update updates (patches) a disk. -// -// resourceGroupName is the name of the resource group. diskName is 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 is disk object supplied in the body of the Patch disk -// operation. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk) if err != nil { @@ -652,15 +664,17 @@ func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/images.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/images.go index 5616d69ca..d50a784b7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/images.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/images.go @@ -40,9 +40,10 @@ func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesCli } // CreateOrUpdate create or update an image. -// -// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is -// parameters supplied to the Create Image operation. +// 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) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result } // Delete deletes an Image. -// -// resourceGroupName is the name of the resource group. imageName is the name of the 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, imageName) if err != nil { @@ -153,15 +157,17 @@ func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -179,9 +185,10 @@ func (client ImagesClient) DeleteResponder(resp *http.Response) (result Operatio } // Get gets an image. -// -// resourceGroupName is the name of the resource group. imageName is the name of the image. expand is the expand -// expression to apply on the operation. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand) if err != nil { @@ -340,8 +347,8 @@ func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListRe } // ListByResourceGroup gets the list of images under a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) @@ -433,9 +440,10 @@ func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, reso } // Update update an image. -// -// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is -// parameters supplied to the Update Image operation. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, imageName, parameters) if err != nil { @@ -478,15 +486,17 @@ func (client ImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go index 0be7ada9b..a309e61ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go @@ -42,9 +42,9 @@ func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) Log // ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to // show throttling activities. -// -// parameters is parameters supplied to the LogAnalytics getRequestRateByInterval Api. location is the location -// upon which virtual-machine-sizes is queried. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: location, @@ -92,15 +92,17 @@ func (client LogAnalyticsClient) ExportRequestRateByIntervalPreparer(ctx context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -119,9 +121,9 @@ func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http // ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time // window. -// -// parameters is parameters supplied to the LogAnalytics getThrottledRequests Api. location is the location upon -// which virtual-machine-sizes is queried. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: location, @@ -169,15 +171,17 @@ func (client LogAnalyticsClient) ExportThrottledRequestsPreparer(ctx context.Con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go index 4260c63dc..f4efc7509 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go @@ -540,6 +540,57 @@ func PossibleUpgradeModeValues() []UpgradeMode { return []UpgradeMode{Automatic, Manual, Rolling} } +// 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 @@ -916,84 +967,6 @@ func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { // AccessURI a disk access SAS uri. type AccessURI struct { autorest.Response `json:"-"` - // AccessURIOutput - Operation output data (raw JSON) - *AccessURIOutput `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessURI. -func (au AccessURI) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if au.AccessURIOutput != nil { - objectMap["properties"] = au.AccessURIOutput - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessURI struct. -func (au *AccessURI) 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 accessURIOutput AccessURIOutput - err = json.Unmarshal(*v, &accessURIOutput) - if err != nil { - return err - } - au.AccessURIOutput = &accessURIOutput - } - } - } - - return nil -} - -// AccessURIOutput azure properties, including output. -type AccessURIOutput struct { - // AccessURIRaw - Operation output data (raw JSON) - *AccessURIRaw `json:"output,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessURIOutput. -func (auo AccessURIOutput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if auo.AccessURIRaw != nil { - objectMap["output"] = auo.AccessURIRaw - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccessURIOutput struct. -func (auo *AccessURIOutput) 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 "output": - if v != nil { - var accessURIRaw AccessURIRaw - err = json.Unmarshal(*v, &accessURIRaw) - if err != nil { - return err - } - auo.AccessURIRaw = &accessURIRaw - } - } - } - - return nil -} - -// AccessURIRaw this object gets 'bubbled up' through flattening. -type AccessURIRaw struct { // AccessSAS - A SAS uri for accessing a disk. AccessSAS *string `json:"accessSAS,omitempty"` } @@ -1042,6 +1015,12 @@ type APIErrorBase struct { Message *string `json:"message,omitempty"` } +// AutoOSUpgradePolicy the configuration parameters used for performing automatic OS upgrade. +type AutoOSUpgradePolicy struct { + // DisableAutoRollback - Whether OS image rollback feature should be disabled. Default value is false. + DisableAutoRollback *bool `json:"disableAutoRollback,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 @@ -1192,13 +1171,7 @@ type AvailabilitySetProperties struct { } // AvailabilitySetUpdate 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 maintainance, 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. +// assigned to. Only tags may be updated. type AvailabilitySetUpdate struct { *AvailabilitySetProperties `json:"properties,omitempty"` // Sku - Sku of the availability set @@ -1570,12 +1543,11 @@ type ContainerServiceProperties struct { // operation. type ContainerServicesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ContainerServicesCreateOrUpdateFuture) Result(client ContainerServicesClient) (cs ContainerService, err error) { +func (future *ContainerServicesCreateOrUpdateFuture) Result(client ContainerServicesClient) (cs ContainerService, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1583,34 +1555,15 @@ func (future ContainerServicesCreateOrUpdateFuture) Result(client ContainerServi return } if !done { - return cs, azure.NewAsyncOpIncompleteError("compute.ContainerServicesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - cs, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.ContainerServicesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent { + cs, err = client.CreateOrUpdateResponder(cs.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", cs.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - cs, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1619,12 +1572,11 @@ func (future ContainerServicesCreateOrUpdateFuture) Result(client ContainerServi // operation. type ContainerServicesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ContainerServicesDeleteFuture) Result(client ContainerServicesClient) (ar autorest.Response, err error) { +func (future *ContainerServicesDeleteFuture) Result(client ContainerServicesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1632,35 +1584,10 @@ func (future ContainerServicesDeleteFuture) Result(client ContainerServicesClien return } if !done { - return ar, azure.NewAsyncOpIncompleteError("compute.ContainerServicesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.ContainerServicesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ContainerServicesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -2040,12 +1967,11 @@ type DiskProperties struct { // DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DisksCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2053,34 +1979,15 @@ func (future DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err return } if !done { - return d, azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -2088,12 +1995,11 @@ func (future DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err // DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DisksDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *DisksDeleteFuture) Result(client DisksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2101,47 +2007,21 @@ func (future DisksDeleteFuture) Result(client DisksClient) (osr OperationStatusR return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // DisksGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DisksGrantAccessFuture struct { azure.Future - req *http.Request } // 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) { +func (future *DisksGrantAccessFuture) Result(client DisksClient) (au AccessURI, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2149,34 +2029,15 @@ func (future DisksGrantAccessFuture) Result(client DisksClient) (au AccessURI, e return } if !done { - return au, azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture") - } - if future.PollingMethod() == azure.PollingLocation { - au, err = client.GrantAccessResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", resp, "Failure sending request") - return - } - au, err = client.GrantAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", resp, "Failure responding to request") } return } @@ -2192,12 +2053,11 @@ type DiskSku struct { // DisksRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DisksRevokeAccessFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *DisksRevokeAccessFuture) Result(client DisksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2205,47 +2065,21 @@ func (future DisksRevokeAccessFuture) Result(client DisksClient) (osr OperationS return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RevokeAccessResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RevokeAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // DisksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DisksUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *DisksUpdateFuture) Result(client DisksClient) (d Disk, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2253,34 +2087,15 @@ func (future DisksUpdateFuture) Result(client DisksClient) (d Disk, err error) { return } if !done { - return d, azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - d, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", d.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", resp, "Failure sending request") - return - } - d, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -2671,12 +2486,11 @@ type ImageReference struct { // ImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ImagesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2684,34 +2498,15 @@ func (future ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, e return } if !done { - return i, azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -2719,12 +2514,11 @@ func (future ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, e // ImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ImagesDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *ImagesDeleteFuture) Result(client ImagesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2732,34 +2526,15 @@ func (future ImagesDeleteFuture) Result(client ImagesClient) (osr OperationStatu return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", resp, "Failure responding to request") } return } @@ -2777,12 +2552,11 @@ type ImageStorageProfile struct { // ImagesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type ImagesUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *ImagesUpdateFuture) Result(client ImagesClient) (i Image, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -2790,40 +2564,20 @@ func (future ImagesUpdateFuture) Result(client ImagesClient) (i Image, err error return } if !done { - return i, azure.NewAsyncOpIncompleteError("compute.ImagesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.ImagesUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesUpdateFuture", "Result", resp, "Failure responding to request") } return } -// ImageUpdate 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. +// ImageUpdate the source user image virtual hard disk. Only tags may be updated. type ImageUpdate struct { *ImageProperties `json:"properties,omitempty"` // Tags - Resource tags @@ -3060,12 +2814,11 @@ type ListVirtualMachineImageResource struct { // long-running operation. type LogAnalyticsExportRequestRateByIntervalFuture struct { azure.Future - req *http.Request } // 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) { +func (future *LogAnalyticsExportRequestRateByIntervalFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3073,34 +2826,15 @@ func (future LogAnalyticsExportRequestRateByIntervalFuture) Result(client LogAna return } if !done { - return laor, azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportRequestRateByIntervalFuture") - } - if future.PollingMethod() == azure.PollingLocation { - laor, err = client.ExportRequestRateByIntervalResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportRequestRateByIntervalFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", laor.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", resp, "Failure sending request") - return - } - laor, err = client.ExportRequestRateByIntervalResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportRequestRateByIntervalFuture", "Result", resp, "Failure responding to request") } return } @@ -3109,12 +2843,11 @@ func (future LogAnalyticsExportRequestRateByIntervalFuture) Result(client LogAna // long-running operation. type LogAnalyticsExportThrottledRequestsFuture struct { azure.Future - req *http.Request } // 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) { +func (future *LogAnalyticsExportThrottledRequestsFuture) Result(client LogAnalyticsClient) (laor LogAnalyticsOperationResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3122,34 +2855,15 @@ func (future LogAnalyticsExportThrottledRequestsFuture) Result(client LogAnalyti return } if !done { - return laor, azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportThrottledRequestsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - laor, err = client.ExportThrottledRequestsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.LogAnalyticsExportThrottledRequestsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", laor.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", resp, "Failure sending request") - return - } - laor, err = client.ExportThrottledRequestsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.LogAnalyticsExportThrottledRequestsFuture", "Result", resp, "Failure responding to request") } return } @@ -3716,23 +3430,14 @@ func (page ResourceSkusResultPage) Values() []ResourceSku { return *page.rsr.Value } -// ResourceUpdate the Resource model definition. -type ResourceUpdate struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - Sku *DiskSku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceUpdate. -func (ru ResourceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ru.Tags != nil { - objectMap["tags"] = ru.Tags - } - if ru.Sku != nil { - objectMap["sku"] = ru.Sku - } - return json.Marshal(objectMap) +// RollbackStatusInfo information about rollback on failed VM instances after a OS Upgrade operation. +type RollbackStatusInfo struct { + // SuccessfullyRolledbackInstanceCount - The number of instances which have been successfully rolled back. + SuccessfullyRolledbackInstanceCount *int32 `json:"successfullyRolledbackInstanceCount,omitempty"` + // FailedRolledbackInstanceCount - The number of instances which failed to rollback. + FailedRolledbackInstanceCount *int32 `json:"failedRolledbackInstanceCount,omitempty"` + // RollbackError - Error details if OS rollback failed. + RollbackError *APIError `json:"rollbackError,omitempty"` } // RollingUpgradePolicy the configuration parameters used while performing a rolling upgrade. @@ -4424,12 +4129,11 @@ func (page SnapshotListPage) Values() []Snapshot { // operation. type SnapshotsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4437,34 +4141,15 @@ func (future SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Sn return } if !done { - return s, azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -4472,12 +4157,11 @@ func (future SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Sn // SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SnapshotsDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *SnapshotsDeleteFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4485,47 +4169,21 @@ func (future SnapshotsDeleteFuture) Result(client SnapshotsClient) (osr Operatio return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // SnapshotsGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SnapshotsGrantAccessFuture struct { azure.Future - req *http.Request } // 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) { +func (future *SnapshotsGrantAccessFuture) Result(client SnapshotsClient) (au AccessURI, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4533,34 +4191,15 @@ func (future SnapshotsGrantAccessFuture) Result(client SnapshotsClient) (au Acce return } if !done { - return au, azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture") - } - if future.PollingMethod() == azure.PollingLocation { - au, err = client.GrantAccessResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", resp, "Failure sending request") - return - } - au, err = client.GrantAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", resp, "Failure responding to request") } return } @@ -4577,12 +4216,11 @@ type SnapshotSku struct { // operation. type SnapshotsRevokeAccessFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *SnapshotsRevokeAccessFuture) Result(client SnapshotsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4590,47 +4228,21 @@ func (future SnapshotsRevokeAccessFuture) Result(client SnapshotsClient) (osr Op return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RevokeAccessResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RevokeAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SnapshotsUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *SnapshotsUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4638,34 +4250,15 @@ func (future SnapshotsUpdateFuture) Result(client SnapshotsClient) (s Snapshot, return } if !done { - return s, azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -4675,7 +4268,7 @@ type SnapshotUpdate struct { *DiskUpdateProperties `json:"properties,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - Sku *DiskSku `json:"sku,omitempty"` + Sku *SnapshotSku `json:"sku,omitempty"` } // MarshalJSON is the custom marshaler for SnapshotUpdate. @@ -4722,7 +4315,7 @@ func (su *SnapshotUpdate) UnmarshalJSON(body []byte) error { } case "sku": if v != nil { - var sku DiskSku + var sku SnapshotSku err = json.Unmarshal(*v, &sku) if err != nil { return err @@ -4810,6 +4403,42 @@ func (ur UpdateResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UpgradeOperationHistoricalStatusInfo virtual Machine Scale Set OS Upgrade History operation response. +type UpgradeOperationHistoricalStatusInfo struct { + // Properties - Information about the properties of the upgrade operation. + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty"` + // Type - Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` +} + +// UpgradeOperationHistoricalStatusInfoProperties describes each OS upgrade on the Virtual Machine Scale Set. +type UpgradeOperationHistoricalStatusInfoProperties struct { + // RunningStatus - Information about the overall status of the upgrade operation. + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty"` + // Progress - Counts of the VM's in each state. + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + // Error - Error Details for this upgrade if there are any. + Error *APIError `json:"error,omitempty"` + // StartedBy - Invoker of the Upgrade Operation. Possible values include: 'Unknown', 'User', 'Platform' + StartedBy UpgradeOperationInvoker `json:"startedBy,omitempty"` + // TargetImageReference - Image Reference details + TargetImageReference *ImageReference `json:"targetImageReference,omitempty"` + // RollbackInfo - 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 - Code indicating the current status of the upgrade. Possible values include: 'UpgradeStateRollingForward', 'UpgradeStateCancelled', 'UpgradeStateCompleted', 'UpgradeStateFaulted' + Code UpgradeState `json:"code,omitempty"` + // StartTime - Start time of the upgrade. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - 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: 'Automatic', 'Manual', 'Rolling' @@ -4818,6 +4447,8 @@ type UpgradePolicy struct { RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` // AutomaticOSUpgrade - Whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. AutomaticOSUpgrade *bool `json:"automaticOSUpgrade,omitempty"` + // AutoOSUpgradePolicy - Configuration parameters used for performing automatic OS Upgrade. + AutoOSUpgradePolicy *AutoOSUpgradePolicy `json:"autoOSUpgradePolicy,omitempty"` } // Usage describes Compute Resource Usage. @@ -5389,12 +5020,11 @@ type VirtualMachineExtensionProperties struct { // long-running operation. type VirtualMachineExtensionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachineExtensionsCreateOrUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5402,34 +5032,15 @@ func (future VirtualMachineExtensionsCreateOrUpdateFuture) Result(client Virtual return } if !done { - return vme, azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vme, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vme, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -5438,12 +5049,11 @@ func (future VirtualMachineExtensionsCreateOrUpdateFuture) Result(client Virtual // operation. type VirtualMachineExtensionsDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineExtensionsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5451,38 +5061,125 @@ func (future VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineE return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", resp, "Failure responding to request") } 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.Done(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"` + // 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 - The health status information for the VM. @@ -6171,12 +5868,11 @@ type VirtualMachineScaleSetExtensionProperties struct { // a long-running operation. type VirtualMachineScaleSetExtensionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachineScaleSetExtensionsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetExtensionsClient) (vmsse VirtualMachineScaleSetExtension, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6184,34 +5880,15 @@ func (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture) Result(client return } if !done { - return vmsse, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vmsse, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", vmsse.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vmsse, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -6220,12 +5897,11 @@ func (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture) Result(client // long-running operation. type VirtualMachineScaleSetExtensionsDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetExtensionsDeleteFuture) Result(client VirtualMachineScaleSetExtensionsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6233,34 +5909,15 @@ func (future VirtualMachineScaleSetExtensionsDeleteFuture) Result(client Virtual return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetExtensionsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsDeleteFuture", "Result", resp, "Failure responding to request") } return } @@ -6380,6 +6037,110 @@ type VirtualMachineScaleSetIPConfigurationProperties struct { LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) IsEmpty() bool { + return vmsslouh.Value == nil || len(*vmsslouh.Value) == 0 +} + +// virtualMachineScaleSetListOSUpgradeHistoryPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vmsslouh VirtualMachineScaleSetListOSUpgradeHistory) virtualMachineScaleSetListOSUpgradeHistoryPreparer() (*http.Request, error) { + if vmsslouh.NextLink == nil || len(to.String(vmsslouh.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vmsslouh.NextLink))) +} + +// VirtualMachineScaleSetListOSUpgradeHistoryPage contains a page of UpgradeOperationHistoricalStatusInfo values. +type VirtualMachineScaleSetListOSUpgradeHistoryPage struct { + fn func(VirtualMachineScaleSetListOSUpgradeHistory) (VirtualMachineScaleSetListOSUpgradeHistory, error) + vmsslouh VirtualMachineScaleSetListOSUpgradeHistory +} + +// 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. +func (page *VirtualMachineScaleSetListOSUpgradeHistoryPage) Next() error { + next, err := page.fn(page.vmsslouh) + if err != nil { + return err + } + page.vmsslouh = next + return nil +} + +// 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 +} + // VirtualMachineScaleSetListResult the List Virtual Machine operation response. type VirtualMachineScaleSetListResult struct { autorest.Response `json:"-"` @@ -6924,12 +6685,11 @@ type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { // long-running operation. type VirtualMachineScaleSetRollingUpgradesCancelFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetRollingUpgradesCancelFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6937,34 +6697,15 @@ func (future VirtualMachineScaleSetRollingUpgradesCancelFuture) Result(client Vi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesCancelFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.CancelResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesCancelFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.CancelResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesCancelFuture", "Result", resp, "Failure responding to request") } return } @@ -6973,12 +6714,11 @@ func (future VirtualMachineScaleSetRollingUpgradesCancelFuture) Result(client Vi // results of a long-running operation. type VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture) Result(client VirtualMachineScaleSetRollingUpgradesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6986,34 +6726,15 @@ func (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture) Result(c return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.StartOSUpgradeResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.StartOSUpgradeResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.StartOSUpgradeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture", "Result", resp, "Failure responding to request") } return } @@ -7022,12 +6743,11 @@ func (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture) Result(c // long-running operation. type VirtualMachineScaleSetsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7035,34 +6755,15 @@ func (future VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualM return } if !done { - return vmss, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vmss, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vmss, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -7071,12 +6772,11 @@ func (future VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualM // long-running operation. type VirtualMachineScaleSetsDeallocateFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7084,34 +6784,15 @@ func (future VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeallocateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeallocateResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", resp, "Failure responding to request") } return } @@ -7120,12 +6801,11 @@ func (future VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachi // operation. type VirtualMachineScaleSetsDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7133,34 +6813,15 @@ func (future VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineSc return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", resp, "Failure responding to request") } return } @@ -7169,12 +6830,11 @@ func (future VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineSc // long-running operation. type VirtualMachineScaleSetsDeleteInstancesFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsDeleteInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7182,34 +6842,15 @@ func (future VirtualMachineScaleSetsDeleteInstancesFuture) Result(client Virtual return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteInstancesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteInstancesResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteInstancesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", resp, "Failure responding to request") } return } @@ -7240,12 +6881,11 @@ type VirtualMachineScaleSetSkuCapacity struct { // long-running operation. type VirtualMachineScaleSetsPerformMaintenanceFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7253,34 +6893,15 @@ func (future VirtualMachineScaleSetsPerformMaintenanceFuture) Result(client Virt return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPerformMaintenanceFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PerformMaintenanceResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPerformMaintenanceFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PerformMaintenanceResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PerformMaintenanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPerformMaintenanceFuture", "Result", resp, "Failure responding to request") } return } @@ -7289,12 +6910,11 @@ func (future VirtualMachineScaleSetsPerformMaintenanceFuture) Result(client Virt // operation. type VirtualMachineScaleSetsPowerOffFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7302,34 +6922,15 @@ func (future VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachine return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PowerOffResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PowerOffResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", resp, "Failure responding to request") } return } @@ -7338,12 +6939,11 @@ func (future VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachine // operation. type VirtualMachineScaleSetsRedeployFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsRedeployFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7351,34 +6951,15 @@ func (future VirtualMachineScaleSetsRedeployFuture) Result(client VirtualMachine return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRedeployFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RedeployResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRedeployFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RedeployResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RedeployResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRedeployFuture", "Result", resp, "Failure responding to request") } return } @@ -7387,12 +6968,11 @@ func (future VirtualMachineScaleSetsRedeployFuture) Result(client VirtualMachine // long-running operation. type VirtualMachineScaleSetsReimageAllFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7400,34 +6980,15 @@ func (future VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.ReimageAllResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.ReimageAllResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.ReimageAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", resp, "Failure responding to request") } return } @@ -7436,12 +6997,11 @@ func (future VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachi // operation. type VirtualMachineScaleSetsReimageFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7449,34 +7009,15 @@ func (future VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineS return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.ReimageResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.ReimageResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.ReimageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", resp, "Failure responding to request") } return } @@ -7485,12 +7026,11 @@ func (future VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineS // operation. type VirtualMachineScaleSetsRestartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7498,34 +7038,15 @@ func (future VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineS return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RestartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RestartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", resp, "Failure responding to request") } return } @@ -7534,12 +7055,11 @@ func (future VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineS // operation. type VirtualMachineScaleSetsStartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7547,34 +7067,15 @@ func (future VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineSca return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.StartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", resp, "Failure responding to request") } return } @@ -7593,12 +7094,11 @@ type VirtualMachineScaleSetStorageProfile struct { // operation. type VirtualMachineScaleSetsUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachineScaleSetsUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7606,34 +7106,15 @@ func (future VirtualMachineScaleSetsUpdateFuture) Result(client VirtualMachineSc return } if !done { - return vmss, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vmss, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", resp, "Failure sending request") - return - } - vmss, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -7642,12 +7123,11 @@ func (future VirtualMachineScaleSetsUpdateFuture) Result(client VirtualMachineSc // long-running operation. type VirtualMachineScaleSetsUpdateInstancesFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetsUpdateInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7655,34 +7135,15 @@ func (future VirtualMachineScaleSetsUpdateInstancesFuture) Result(client Virtual return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.UpdateInstancesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.UpdateInstancesResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.UpdateInstancesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", resp, "Failure responding to request") } return } @@ -8417,6 +7878,8 @@ type VirtualMachineScaleSetVMProfile struct { 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' Priority VirtualMachinePriorityTypes `json:"priority,omitempty"` + // EvictionPolicy - Specifies the eviction policy for virtual machines in a low priority scale set.

Minimum api-version: 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete' + EvictionPolicy VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` } // VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual machine. @@ -8449,12 +7912,11 @@ type VirtualMachineScaleSetVMProperties struct { // long-running operation. type VirtualMachineScaleSetVMsDeallocateFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8462,34 +7924,15 @@ func (future VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMac return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeallocateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeallocateResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", resp, "Failure responding to request") } return } @@ -8498,12 +7941,11 @@ func (future VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMac // operation. type VirtualMachineScaleSetVMsDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8511,34 +7953,15 @@ func (future VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachine return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", resp, "Failure responding to request") } return } @@ -8547,12 +7970,11 @@ func (future VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachine // long-running operation. type VirtualMachineScaleSetVMsPerformMaintenanceFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsPerformMaintenanceFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8560,34 +7982,15 @@ func (future VirtualMachineScaleSetVMsPerformMaintenanceFuture) Result(client Vi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PerformMaintenanceResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PerformMaintenanceResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PerformMaintenanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPerformMaintenanceFuture", "Result", resp, "Failure responding to request") } return } @@ -8596,12 +7999,11 @@ func (future VirtualMachineScaleSetVMsPerformMaintenanceFuture) Result(client Vi // long-running operation. type VirtualMachineScaleSetVMsPowerOffFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8609,34 +8011,15 @@ func (future VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PowerOffResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PowerOffResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", resp, "Failure responding to request") } return } @@ -8645,12 +8028,11 @@ func (future VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachi // long-running operation. type VirtualMachineScaleSetVMsRedeployFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsRedeployFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8658,34 +8040,15 @@ func (future VirtualMachineScaleSetVMsRedeployFuture) Result(client VirtualMachi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRedeployFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RedeployResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRedeployFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RedeployResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RedeployResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRedeployFuture", "Result", resp, "Failure responding to request") } return } @@ -8694,12 +8057,11 @@ func (future VirtualMachineScaleSetVMsRedeployFuture) Result(client VirtualMachi // long-running operation. type VirtualMachineScaleSetVMsReimageAllFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8707,34 +8069,15 @@ func (future VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMac return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.ReimageAllResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.ReimageAllResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.ReimageAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", resp, "Failure responding to request") } return } @@ -8743,12 +8086,11 @@ func (future VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMac // long-running operation. type VirtualMachineScaleSetVMsReimageFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8756,34 +8098,15 @@ func (future VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachin return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.ReimageResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.ReimageResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.ReimageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", resp, "Failure responding to request") } return } @@ -8792,12 +8115,11 @@ func (future VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachin // long-running operation. type VirtualMachineScaleSetVMsRestartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8805,34 +8127,15 @@ func (future VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachin return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RestartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RestartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", resp, "Failure responding to request") } return } @@ -8841,12 +8144,11 @@ func (future VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachin // operation. type VirtualMachineScaleSetVMsStartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8854,34 +8156,15 @@ func (future VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineS return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.StartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", resp, "Failure responding to request") } return } @@ -8890,12 +8173,11 @@ func (future VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineS // operation. type VirtualMachineScaleSetVMsUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachineScaleSetVMsUpdateFuture) Result(client VirtualMachineScaleSetVMsClient) (vmssv VirtualMachineScaleSetVM, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8903,34 +8185,15 @@ func (future VirtualMachineScaleSetVMsUpdateFuture) Result(client VirtualMachine return } if !done { - return vmssv, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vmssv, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", vmssv.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", resp, "Failure sending request") - return - } - vmssv, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -8939,12 +8202,11 @@ func (future VirtualMachineScaleSetVMsUpdateFuture) Result(client VirtualMachine // operation. type VirtualMachinesCaptureFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8952,34 +8214,15 @@ func (future VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) return } if !done { - return vmcr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vmcr, err = client.CaptureResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", vmcr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", resp, "Failure sending request") - return - } - vmcr, err = client.CaptureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", resp, "Failure responding to request") } return } @@ -8988,12 +8231,11 @@ func (future VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) // long-running operation. type VirtualMachinesConvertToManagedDisksFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9001,34 +8243,15 @@ func (future VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMa return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.ConvertToManagedDisksResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.ConvertToManagedDisksResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.ConvertToManagedDisksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", resp, "Failure responding to request") } return } @@ -9037,12 +8260,11 @@ func (future VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMa // operation. type VirtualMachinesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9050,34 +8272,15 @@ func (future VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesC return } if !done { - return VM, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - VM, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - VM, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -9086,12 +8289,11 @@ func (future VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesC // operation. type VirtualMachinesDeallocateFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9099,34 +8301,15 @@ func (future VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClien return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeallocateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeallocateResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", resp, "Failure responding to request") } return } @@ -9135,12 +8318,11 @@ func (future VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClien // operation. type VirtualMachinesDeleteFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9148,34 +8330,15 @@ func (future VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) ( return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.DeleteResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", resp, "Failure responding to request") } return } @@ -9207,12 +8370,11 @@ type VirtualMachineSizeListResult struct { // long-running operation. type VirtualMachinesPerformMaintenanceFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesPerformMaintenanceFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9220,34 +8382,15 @@ func (future VirtualMachinesPerformMaintenanceFuture) Result(client VirtualMachi return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPerformMaintenanceFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PerformMaintenanceResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPerformMaintenanceFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PerformMaintenanceResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PerformMaintenanceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPerformMaintenanceFuture", "Result", resp, "Failure responding to request") } return } @@ -9256,12 +8399,11 @@ func (future VirtualMachinesPerformMaintenanceFuture) Result(client VirtualMachi // operation. type VirtualMachinesPowerOffFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9269,34 +8411,15 @@ func (future VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.PowerOffResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.PowerOffResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", resp, "Failure responding to request") } return } @@ -9305,12 +8428,11 @@ func (future VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) // operation. type VirtualMachinesRedeployFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9318,34 +8440,15 @@ func (future VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RedeployResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RedeployResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RedeployResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", resp, "Failure responding to request") } return } @@ -9354,12 +8457,11 @@ func (future VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) // operation. type VirtualMachinesRestartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9367,34 +8469,15 @@ func (future VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.RestartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.RestartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", resp, "Failure responding to request") } return } @@ -9403,12 +8486,11 @@ func (future VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) // operation. type VirtualMachinesRunCommandFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualMachinesRunCommandFuture) Result(client VirtualMachinesClient) (rcr RunCommandResult, err error) { +func (future *VirtualMachinesRunCommandFuture) Result(client VirtualMachinesClient) (rcr RunCommandResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9416,34 +8498,15 @@ func (future VirtualMachinesRunCommandFuture) Result(client VirtualMachinesClien return } if !done { - return rcr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRunCommandFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rcr, err = client.RunCommandResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRunCommandFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", resp, "Failure sending request") - return - } - rcr, err = client.RunCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRunCommandFuture", "Result", resp, "Failure responding to request") } return } @@ -9451,12 +8514,11 @@ func (future VirtualMachinesRunCommandFuture) Result(client VirtualMachinesClien // VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. type VirtualMachinesStartFuture struct { azure.Future - req *http.Request } // 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) (osr OperationStatusResponse, err error) { +func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9464,34 +8526,15 @@ func (future VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (o return } if !done { - return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - osr, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { + osr, err = client.StartResponder(osr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", osr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", resp, "Failure sending request") - return - } - osr, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", resp, "Failure responding to request") } return } @@ -9509,12 +8552,11 @@ type VirtualMachineStatusCodeCount struct { // operation. type VirtualMachinesUpdateFuture struct { azure.Future - req *http.Request } // 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) { +func (future *VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9522,39 +8564,20 @@ func (future VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) ( return } if !done { - return VM, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - VM, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", resp, "Failure sending request") - return - } - VM, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesUpdateFuture", "Result", resp, "Failure responding to request") } return } -// VirtualMachineUpdate describes a Virtual Machine. +// 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"` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go index 0f77e0d82..b87359354 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go @@ -41,11 +41,11 @@ func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) Snapsh } // CreateOrUpdate creates or updates a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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 is snapshot object supplied in the body of the -// Put disk operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: snapshot, @@ -109,15 +109,17 @@ func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resour // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -135,10 +137,10 @@ func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (resu } // Delete deletes a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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. +// 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName) if err != nil { @@ -179,36 +181,37 @@ func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupN // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + 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 OperationStatusResponse, err error) { +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } // Get gets information about a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName) if err != nil { @@ -273,11 +276,11 @@ func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot } // GrantAccess grants access to a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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 is access data object supplied in the body -// of the get snapshot access operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: grantAccessData, @@ -326,15 +329,17 @@ func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceG // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -442,8 +447,8 @@ func (client SnapshotsClient) ListComplete(ctx context.Context) (result Snapshot } // ListByResourceGroup lists snapshots under a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) @@ -535,10 +540,10 @@ func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, r } // RevokeAccess revokes access to a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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. +// 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) { req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName) if err != nil { @@ -579,37 +584,38 @@ func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resource // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + 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 OperationStatusResponse, err error) { +func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } // Update updates (patches) a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is 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 is snapshot object supplied in the body of the -// Patch snapshot operation. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) if err != nil { @@ -652,15 +658,17 @@ func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupN // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/usage.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/usage.go index 688781d48..e4bcd72b4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/usage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/usage.go @@ -42,8 +42,8 @@ func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClien // List gets, for the specified location, the current compute resource usage information as well as the limits for // compute resources under the subscription. -// -// location is the location for which resource usage is queried. +// Parameters: +// location - the location for which resource usage is queried. func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: location, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensionimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensionimages.go index 1573aa734..ca8bf91f7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensionimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensionimages.go @@ -41,8 +41,8 @@ func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscript } // Get gets a virtual machine extension image. -// -// location is the name of a supported Azure region. +// 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) { req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version) if err != nil { @@ -109,8 +109,8 @@ func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Respon } // ListTypes gets a list of virtual machine extension image types. -// -// location is the name of a supported Azure region. +// Parameters: +// location - the name of a supported Azure region. func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) { req, err := client.ListTypesPreparer(ctx, location, publisherName) if err != nil { @@ -175,8 +175,9 @@ func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http. } // ListVersions gets a list of virtual machine extension image versions. -// -// location is the name of a supported Azure region. filter is the filter to apply on the operation. +// 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) { req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensions.go index c5cbe664c..8c5d964fe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineextensions.go @@ -40,10 +40,11 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID } // CreateOrUpdate the operation to create or update the extension. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the -// extension should be create or updated. VMExtensionName is the name of the virtual machine extension. -// extensionParameters is parameters supplied to the Create Virtual Machine Extension operation. +// 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) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) if err != nil { @@ -87,15 +88,17 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +116,10 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http. } // Delete the operation to delete the extension. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the -// extension should be deleted. VMExtensionName is the name of the virtual machine 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName) if err != nil { @@ -157,15 +161,17 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -183,10 +189,11 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response } // Get the operation to get the extension. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine containing the -// extension. VMExtensionName is the name of the virtual machine extension. expand is the expand expression to -// apply on the operation. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand) if err != nil { @@ -253,3 +260,79 @@ func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) ( 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) { + 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 = "2017-12-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 = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineimages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineimages.go index e8643d065..946a3ab49 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineimages.go @@ -40,9 +40,12 @@ func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID str } // Get gets a virtual machine image. -// -// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid -// image publisher offer. skus is a valid image SKU. version is a valid image SKU version. +// 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) { req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version) if err != nil { @@ -110,9 +113,12 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu } // List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. -// -// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid -// image publisher offer. skus is a valid image SKU. filter is the filter to apply on the operation. +// 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. +// filter - the filter to apply on the operation. func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby) if err != nil { @@ -188,8 +194,9 @@ func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (res } // ListOffers gets a list of virtual machine image offers for the specified location and publisher. -// -// location is the name of a supported Azure region. publisherName is a valid image 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) { req, err := client.ListOffersPreparer(ctx, location, publisherName) if err != nil { @@ -254,8 +261,8 @@ func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response } // ListPublishers gets a list of virtual machine image publishers for the specified Azure location. -// -// location is the name of a supported Azure region. +// Parameters: +// location - the name of a supported Azure region. func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) { req, err := client.ListPublishersPreparer(ctx, location) if err != nil { @@ -319,9 +326,10 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp } // ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer. -// -// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid -// image publisher 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) { req, err := client.ListSkusPreparer(ctx, location, publisherName, offer) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go index 6c38888d6..26d2a3377 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go @@ -41,8 +41,9 @@ func NewVirtualMachineRunCommandsClientWithBaseURI(baseURI string, subscriptionI } // Get gets specific run command for a subscription in a location. -// -// location is the location upon which run commands is queried. commandID is the command id. +// Parameters: +// location - the location upon which run commands is queried. +// commandID - the command id. func (client VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string) (result RunCommandDocument, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: location, @@ -113,8 +114,8 @@ func (client VirtualMachineRunCommandsClient) GetResponder(resp *http.Response) } // List lists all available run commands for a subscription in a location. -// -// location is the location upon which run commands is queried. +// Parameters: +// location - the location upon which run commands is queried. func (client VirtualMachineRunCommandsClient) List(ctx context.Context, location string) (result RunCommandListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: location, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go index 1a34d205a..ab8234321 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go @@ -42,9 +42,10 @@ func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) // Capture captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create // similar VMs. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is -// parameters supplied to the Capture Virtual Machine operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -95,15 +96,17 @@ func (client VirtualMachinesClient) CapturePreparer(ctx context.Context, resourc // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -122,8 +125,9 @@ func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (resul // ConvertToManagedDisks converts virtual machine disks from blob-based to managed disks. Virtual machine must be // stop-deallocated before invoking this operation. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// 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) { req, err := client.ConvertToManagedDisksPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -164,15 +168,17 @@ func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(ctx context.Co // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -190,9 +196,10 @@ func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Re } // CreateOrUpdate the operation to create or update a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is -// parameters supplied to the Create Virtual Machine operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -256,15 +263,17 @@ func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -283,8 +292,9 @@ func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) // Deallocate shuts down the virtual machine and releases the compute resources. You are not billed for the compute // resources that this virtual machine uses. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// 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) { req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -325,15 +335,17 @@ func (client VirtualMachinesClient) DeallocatePreparer(ctx context.Context, reso // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -351,8 +363,9 @@ func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (re } // Delete the operation to delete a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -393,15 +406,17 @@ func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resource // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -419,8 +434,9 @@ func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result } // Generalize sets the state of the virtual machine to generalized. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// 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 OperationStatusResponse, err error) { req, err := client.GeneralizePreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -485,9 +501,10 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re } // Get retrieves information about the model view or the instance view of a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. expand is the -// expand expression to apply on the operation. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand) if err != nil { @@ -554,9 +571,81 @@ func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result Vi return } +// GetExtensions 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 VirtualMachinesClient) GetExtensions(ctx context.Context, resourceGroupName string, VMName string, expand string) (result VirtualMachineExtensionsListResult, err error) { + req, err := client.GetExtensionsPreparer(ctx, resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", nil, "Failure preparing request") + return + } + + resp, err := client.GetExtensionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", resp, "Failure sending request") + return + } + + result, err = client.GetExtensionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", resp, "Failure responding to request") + } + + return +} + +// GetExtensionsPreparer prepares the GetExtensions request. +func (client VirtualMachinesClient) GetExtensionsPreparer(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 = "2017-12-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)) +} + +// GetExtensionsSender sends the GetExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GetExtensionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetExtensionsResponder handles the response to the GetExtensions request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GetExtensionsResponder(resp *http.Response) (result VirtualMachineExtensionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + 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. -// -// resourceGroupName is the name of the resource group. VMName is the name of the 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) { req, err := client.InstanceViewPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -622,8 +711,8 @@ func (client VirtualMachinesClient) InstanceViewResponder(resp *http.Response) ( // 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. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -806,8 +895,9 @@ func (client VirtualMachinesClient) ListAllComplete(ctx context.Context) (result } // ListAvailableSizes lists all available virtual machine sizes to which the specified virtual machine can be resized. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// 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) { req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -872,8 +962,9 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo } // PerformMaintenance the operation to perform maintenance on a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the 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) { req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -914,15 +1005,17 @@ func (client VirtualMachinesClient) PerformMaintenancePreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -941,8 +1034,9 @@ func (client VirtualMachinesClient) PerformMaintenanceResponder(resp *http.Respo // 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. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. func (client VirtualMachinesClient) PowerOff(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesPowerOffFuture, err error) { req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -983,15 +1077,17 @@ func (client VirtualMachinesClient) PowerOffPreparer(ctx context.Context, resour // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1009,8 +1105,9 @@ func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (resu } // Redeploy the operation to redeploy a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. +// 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) { req, err := client.RedeployPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -1051,15 +1148,17 @@ func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resour // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1077,8 +1176,9 @@ func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (resu } // Restart the operation to restart a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the 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) { req, err := client.RestartPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -1119,15 +1219,17 @@ func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourc // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1145,9 +1247,10 @@ func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (resul } // RunCommand run command on the VM. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is -// parameters supplied to the Run command operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// VMName - the name of the virtual machine. +// parameters - parameters supplied to the Run command operation. func (client VirtualMachinesClient) RunCommand(ctx context.Context, resourceGroupName string, VMName string, parameters RunCommandInput) (result VirtualMachinesRunCommandFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -1196,15 +1299,17 @@ func (client VirtualMachinesClient) RunCommandPreparer(ctx context.Context, reso // RunCommandSender sends the RunCommand request. The method will close the // http.Response Body if it receives an error. func (client VirtualMachinesClient) RunCommandSender(req *http.Request) (future VirtualMachinesRunCommandFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1222,8 +1327,9 @@ func (client VirtualMachinesClient) RunCommandResponder(resp *http.Response) (re } // Start the operation to start a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the 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) { req, err := client.StartPreparer(ctx, resourceGroupName, VMName) if err != nil { @@ -1264,15 +1370,17 @@ func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceG // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1290,9 +1398,10 @@ func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result } // Update the operation to update a virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is -// parameters supplied to the Update Virtual Machine operation. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, parameters) if err != nil { @@ -1335,15 +1444,17 @@ func (client VirtualMachinesClient) UpdatePreparer(ctx context.Context, resource // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go index fd630e647..4ebd68c00 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go @@ -41,10 +41,11 @@ func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(baseURI string, subscr } // CreateOrUpdate the operation to create or update an extension. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set where the -// extension should be create or updated. vmssExtensionName is the name of the VM scale set extension. -// extensionParameters is parameters supplied to the Create VM scale set Extension operation. +// 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) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters) if err != nil { @@ -88,15 +89,17 @@ func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdatePreparer(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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -114,9 +117,10 @@ func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateResponder(res } // Delete the operation to delete the extension. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set where the -// extension should be deleted. vmssExtensionName is the name of the VM scale set 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName) if err != nil { @@ -158,15 +162,17 @@ func (client VirtualMachineScaleSetExtensionsClient) DeletePreparer(ctx context. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -184,10 +190,11 @@ func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http. } // Get the operation to get the extension. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing -// the extension. vmssExtensionName is the name of the VM scale set extension. expand is the expand expression to -// apply on the operation. +// 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) { req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand) if err != nil { @@ -256,9 +263,9 @@ func (client VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Res } // List gets a list of all extensions in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing -// the extension. +// 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) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go index 6e7b66cb0..aa23ddb93 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go @@ -42,8 +42,9 @@ func NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(baseURI string, s } // Cancel cancels the current virtual machine scale set rolling upgrade. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. +// 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) { req, err := client.CancelPreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -84,15 +85,17 @@ func (client VirtualMachineScaleSetRollingUpgradesClient) CancelPreparer(ctx con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -110,8 +113,9 @@ func (client VirtualMachineScaleSetRollingUpgradesClient) CancelResponder(resp * } // GetLatest gets the status of the latest virtual machine scale set rolling upgrade. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. +// 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) { req, err := client.GetLatestPreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -177,8 +181,9 @@ func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestResponder(res // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. +// 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) { req, err := client.StartOSUpgradePreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -219,15 +224,17 @@ func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradePreparer // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go index 4b157e34c..dc742f64f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go @@ -41,9 +41,10 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID } // CreateOrUpdate create or update a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set to create or -// update. parameters is the scale set object. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -109,15 +110,17 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(ctx context.C // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -136,9 +139,10 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) { req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -184,15 +188,17 @@ func (client VirtualMachineScaleSetsClient) DeallocatePreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -210,8 +216,9 @@ func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Respo } // Delete deletes a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -252,15 +259,17 @@ func (client VirtualMachineScaleSetsClient) DeletePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -278,9 +287,10 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) } // DeleteInstances deletes virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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 err := validation.Validate([]validation.Validation{ {TargetValue: VMInstanceIDs, @@ -329,15 +339,17 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(ctx context. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -356,9 +368,10 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http. // ForceRecoveryServiceFabricPlatformUpdateDomainWalk manual platform update domain walk to update virtual machines in // a service fabric virtual machine scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// platformUpdateDomain is the platform update domain for which a manual recovery walk is requested +// 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) { req, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalkPreparer(ctx, resourceGroupName, VMScaleSetName, platformUpdateDomain) if err != nil { @@ -424,8 +437,9 @@ func (client VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUp } // Get display information about a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM 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) { req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -490,8 +504,9 @@ func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (r } // GetInstanceView gets the status of a VM scale set instance. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. +// 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) { req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName) if err != nil { @@ -555,9 +570,104 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http. 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) { + 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") + } + + 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 = "2017-12-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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults VirtualMachineScaleSetListOSUpgradeHistory) (result VirtualMachineScaleSetListOSUpgradeHistory, err error) { + req, err := lastResults.virtualMachineScaleSetListOSUpgradeHistoryPreparer() + 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) { + result.page, err = client.GetOSUpgradeHistory(ctx, resourceGroupName, VMScaleSetName) + return +} + // List gets a list of all VM scale sets under a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client VirtualMachineScaleSetsClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -742,8 +852,9 @@ func (client VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context) // ListSkus gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed // for each SKU. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. +// 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) { result.fn = client.listSkusNextResults req, err := client.ListSkusPreparer(ctx, resourceGroupName, VMScaleSetName) @@ -836,9 +947,10 @@ func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context } // PerformMaintenance perform maintenance on one or more virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) PerformMaintenance(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPerformMaintenanceFuture, err error) { req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -884,15 +996,17 @@ func (client VirtualMachineScaleSetsClient) PerformMaintenancePreparer(ctx conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -911,9 +1025,10 @@ func (client VirtualMachineScaleSetsClient) PerformMaintenanceResponder(resp *ht // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPowerOffFuture, err error) { req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -959,15 +1074,17 @@ func (client VirtualMachineScaleSetsClient) PowerOffPreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -985,9 +1102,10 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons } // Redeploy redeploy one or more virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) Redeploy(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRedeployFuture, err error) { req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -1033,15 +1151,17 @@ func (client VirtualMachineScaleSetsClient) RedeployPreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1059,9 +1179,10 @@ func (client VirtualMachineScaleSetsClient) RedeployResponder(resp *http.Respons } // Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageFuture, err error) { req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -1107,15 +1228,17 @@ func (client VirtualMachineScaleSetsClient) ReimagePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1134,9 +1257,10 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageAllFuture, err error) { req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -1182,15 +1306,17 @@ func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1208,9 +1334,10 @@ func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Respo } // Restart restarts one or more virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) { req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -1256,15 +1383,17 @@ func (client VirtualMachineScaleSetsClient) RestartPreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1282,9 +1411,10 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response } // Start starts one or more virtual machines in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) { req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) if err != nil { @@ -1330,15 +1460,17 @@ func (client VirtualMachineScaleSetsClient) StartPreparer(ctx context.Context, r // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1356,9 +1488,10 @@ func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) } // Update update a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set to create or -// update. parameters is the scale set object. +// 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) { req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) if err != nil { @@ -1401,15 +1534,17 @@ func (client VirtualMachineScaleSetsClient) UpdatePreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1427,9 +1562,10 @@ func (client VirtualMachineScaleSetsClient) UpdateResponder(resp *http.Response) } // UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. -// VMInstanceIDs is a list of virtual machine instance IDs from the 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) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: VMInstanceIDs, @@ -1478,15 +1614,17 @@ func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(ctx context. // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go index a03124183..e8ec06789 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go @@ -43,9 +43,10 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -87,15 +88,17 @@ func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(ctx context.Con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +116,10 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res } // Delete deletes a virtual machine from a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -157,15 +161,17 @@ func (client VirtualMachineScaleSetVMsClient) DeletePreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -183,9 +189,10 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons } // Get gets a virtual machine from a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -251,9 +258,10 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) } // GetInstanceView gets the status of a virtual machine from a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -319,10 +327,12 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *htt } // List gets a list of all virtual machines in a VM scale sets. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the VM scale set. -// filter is the filter to apply to the operation. selectParameter is the list parameters. expand is the expand -// expression to apply to the operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the VM scale set. +// filter - the filter to apply to the operation. +// selectParameter - the list parameters. +// expand - the expand expression to apply to the operation. func (client VirtualMachineScaleSetVMsClient) List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) @@ -424,9 +434,10 @@ func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, } // PerformMaintenance performs maintenance on a virtual machine in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.PerformMaintenancePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -468,15 +479,17 @@ func (client VirtualMachineScaleSetVMsClient) PerformMaintenancePreparer(ctx con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -495,9 +508,10 @@ func (client VirtualMachineScaleSetVMsClient) PerformMaintenanceResponder(resp * // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) { req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -539,15 +553,17 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -565,9 +581,10 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo } // Redeploy redeploys a virtual machine in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.RedeployPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -609,15 +626,17 @@ func (client VirtualMachineScaleSetVMsClient) RedeployPreparer(ctx context.Conte // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -635,9 +654,10 @@ func (client VirtualMachineScaleSetVMsClient) RedeployResponder(resp *http.Respo } // Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageFuture, err error) { req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -679,15 +699,17 @@ func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(ctx context.Contex // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -706,9 +728,10 @@ func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Respon // 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. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -750,15 +773,17 @@ func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(ctx context.Con // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -776,9 +801,10 @@ func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Res } // Restart restarts a virtual machine in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -820,15 +846,17 @@ func (client VirtualMachineScaleSetVMsClient) RestartPreparer(ctx context.Contex // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -846,9 +874,10 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon } // Start starts a virtual machine in a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID -// is the instance ID of the virtual machine. +// 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) { req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) if err != nil { @@ -890,15 +919,17 @@ func (client VirtualMachineScaleSetVMsClient) StartPreparer(ctx context.Context, // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -916,10 +947,11 @@ func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response } // Update updates a virtual machine of a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set where the -// extension should be create or updated. instanceID is the instance ID of the virtual machine. parameters is -// parameters supplied to the Update Virtual Machine Scale Sets VM operation. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -984,15 +1016,17 @@ func (client VirtualMachineScaleSetVMsClient) UpdatePreparer(ctx context.Context // 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) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinesizes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinesizes.go index c091724bb..49f81e550 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinesizes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinesizes.go @@ -41,8 +41,8 @@ func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID stri } // List lists all available virtual machine sizes for a subscription in a location. -// -// location is the location upon which virtual-machine-sizes is queried. +// 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 err := validation.Validate([]validation.Validation{ {TargetValue: location, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go index 6423ad115..bee104bec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go @@ -41,9 +41,10 @@ func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID stri } // BackendHealth gets the backend health of the specified application gateway in a resource group. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. expand is expands BackendAddressPool and BackendHttpSettings referenced in backend health. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) { req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand) if err != nil { @@ -87,15 +88,17 @@ func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Contex // BackendHealthSender sends the BackendHealth request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (future ApplicationGatewaysBackendHealthFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +116,10 @@ func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Respon } // CreateOrUpdate creates or updates the specified application gateway. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. parameters is parameters supplied to the create or update application gateway operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// parameters - parameters supplied to the create or update application gateway operation. func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -174,15 +178,17 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -200,9 +206,9 @@ func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Respo } // Delete deletes the specified application gateway. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName) if err != nil { @@ -243,15 +249,17 @@ func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, reso // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -268,9 +276,9 @@ func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (re } // Get gets the specified application gateway. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName) if err != nil { @@ -335,8 +343,8 @@ func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (resul } // GetSslPredefinedPolicy gets Ssl predefined policy with the specified policy name. -// -// predefinedPolicyName is name of Ssl predefined policy. +// Parameters: +// predefinedPolicyName - name of Ssl predefined policy. func (client ApplicationGatewaysClient) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result ApplicationGatewaySslPredefinedPolicy, err error) { req, err := client.GetSslPredefinedPolicyPreparer(ctx, predefinedPolicyName) if err != nil { @@ -400,8 +408,8 @@ func (client ApplicationGatewaysClient) GetSslPredefinedPolicyResponder(resp *ht } // List lists all application gateways in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client ApplicationGatewaysClient) List(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -797,9 +805,9 @@ func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp * } // Start starts the specified application gateway. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) { req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName) if err != nil { @@ -840,15 +848,17 @@ func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resou // StartSender sends the Start request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -865,9 +875,9 @@ func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (res } // Stop stops the specified application gateway in a resource group. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) { req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName) if err != nil { @@ -908,15 +918,17 @@ func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resour // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -933,9 +945,10 @@ func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (resu } // UpdateTags updates the specified application gateway tags. -// -// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application -// gateway. parameters is parameters supplied to update application gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// parameters - parameters supplied to update application gateway tags. func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGatewaysUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters) if err != nil { @@ -978,15 +991,17 @@ func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (future ApplicationGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go index 48acb4e55..727b7b1c1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go @@ -40,9 +40,10 @@ func NewApplicationSecurityGroupsClientWithBaseURI(baseURI string, subscriptionI } // CreateOrUpdate creates or updates an application security group. -// -// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application -// security group. parameters is parameters supplied to the create or update ApplicationSecurityGroup operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. +// parameters - parameters supplied to the create or update ApplicationSecurityGroup operation. func (client ApplicationSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (result ApplicationSecurityGroupsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationSecurityGroupName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationSecurityGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,9 +114,9 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdateResponder(resp *http } // Delete deletes the specified application security group. -// -// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application -// security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. func (client ApplicationSecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroupsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, applicationSecurityGroupName) if err != nil { @@ -154,15 +157,17 @@ func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (future ApplicationSecurityGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -179,9 +184,9 @@ func (client ApplicationSecurityGroupsClient) DeleteResponder(resp *http.Respons } // Get gets information about the specified application security group. -// -// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application -// security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. func (client ApplicationSecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroup, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, applicationSecurityGroupName) if err != nil { @@ -246,8 +251,8 @@ func (client ApplicationSecurityGroupsClient) GetResponder(resp *http.Response) } // List gets all the application security groups in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client ApplicationSecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go index 23914cbf8..a386e084b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go @@ -40,8 +40,8 @@ func NewAvailableEndpointServicesClientWithBaseURI(baseURI string, subscriptionI } // List list what values of endpoint services are available for use. -// -// location is the location to check available endpoint services. +// Parameters: +// location - the location to check available endpoint services. func (client AvailableEndpointServicesClient) List(ctx context.Context, location string) (result EndpointServicesListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, location) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/client.go index a69c41e90..3e657b1ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/client.go @@ -54,9 +54,10 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { } // CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use. -// -// location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform -// to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +// Parameters: +// location - the location of the domain name. +// domainNameLabel - the domain name to be verified. It must conform to the following regular expression: +// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go index deae88d9d..d19cbad06 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go @@ -41,10 +41,11 @@ func NewConnectionMonitorsClientWithBaseURI(baseURI string, subscriptionID strin } // CreateOrUpdate create or update a connection monitor. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. parameters is -// parameters that define the operation to create a connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +// parameters - parameters that define the operation to create a connection monitor. func (client ConnectionMonitorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor) (result ConnectionMonitorsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -98,15 +99,17 @@ func (client ConnectionMonitorsClient) CreateOrUpdatePreparer(ctx context.Contex // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ConnectionMonitorsClient) CreateOrUpdateSender(req *http.Request) (future ConnectionMonitorsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -124,9 +127,10 @@ func (client ConnectionMonitorsClient) CreateOrUpdateResponder(resp *http.Respon } // Delete deletes the specified connection monitor. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. func (client ConnectionMonitorsClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) if err != nil { @@ -168,15 +172,17 @@ func (client ConnectionMonitorsClient) DeletePreparer(ctx context.Context, resou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ConnectionMonitorsClient) DeleteSender(req *http.Request) (future ConnectionMonitorsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -193,9 +199,10 @@ func (client ConnectionMonitorsClient) DeleteResponder(resp *http.Response) (res } // Get gets a connection monitor by name. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. func (client ConnectionMonitorsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorResult, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) if err != nil { @@ -261,9 +268,9 @@ func (client ConnectionMonitorsClient) GetResponder(resp *http.Response) (result } // List lists all connection monitors for the specified Network Watcher. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. func (client ConnectionMonitorsClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result ConnectionMonitorListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) if err != nil { @@ -328,9 +335,10 @@ func (client ConnectionMonitorsClient) ListResponder(resp *http.Response) (resul } // Query query a snapshot of the most recent connection states. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name given to the connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name given to the connection monitor. func (client ConnectionMonitorsClient) Query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsQueryFuture, err error) { req, err := client.QueryPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) if err != nil { @@ -372,15 +380,17 @@ func (client ConnectionMonitorsClient) QueryPreparer(ctx context.Context, resour // QuerySender sends the Query request. The method will close the // http.Response Body if it receives an error. func (client ConnectionMonitorsClient) QuerySender(req *http.Request) (future ConnectionMonitorsQueryFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -398,9 +408,10 @@ func (client ConnectionMonitorsClient) QueryResponder(resp *http.Response) (resu } // Start starts the specified connection monitor. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. func (client ConnectionMonitorsClient) Start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStartFuture, err error) { req, err := client.StartPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) if err != nil { @@ -442,15 +453,17 @@ func (client ConnectionMonitorsClient) StartPreparer(ctx context.Context, resour // StartSender sends the Start request. The method will close the // http.Response Body if it receives an error. func (client ConnectionMonitorsClient) StartSender(req *http.Request) (future ConnectionMonitorsStartFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -467,9 +480,10 @@ func (client ConnectionMonitorsClient) StartResponder(resp *http.Response) (resu } // Stop stops the specified connection monitor. -// -// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name -// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. func (client ConnectionMonitorsClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStopFuture, err error) { req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) if err != nil { @@ -511,15 +525,17 @@ func (client ConnectionMonitorsClient) StopPreparer(ctx context.Context, resourc // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client ConnectionMonitorsClient) StopSender(req *http.Request) (future ConnectionMonitorsStopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go index f6c84fdb9..a53a27b3e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go @@ -40,9 +40,10 @@ func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID str } // Get get the specified default network security rule. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. defaultSecurityRuleName is the name of the default security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// defaultSecurityRuleName - the name of the default security rule. func (client DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName) if err != nil { @@ -108,9 +109,9 @@ func (client DefaultSecurityRulesClient) GetResponder(resp *http.Response) (resu } // List gets all default security rules in a network security group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitauthorizations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitauthorizations.go index 74ef33cfb..35f9e2744 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitauthorizations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitauthorizations.go @@ -42,10 +42,12 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc } // CreateOrUpdate creates or updates an authorization in the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create -// or update express route circuit authorization operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. +// authorizationParameters - parameters supplied to the create or update express route circuit authorization +// operation. func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters) if err != nil { @@ -89,15 +91,17 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -115,9 +119,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(re } // Delete deletes the specified authorization from the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// authorizationName is the name of the authorization. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. func (client ExpressRouteCircuitAuthorizationsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, authorizationName) if err != nil { @@ -159,15 +164,17 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -184,9 +191,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http } // Get gets the specified authorization from the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// authorizationName is the name of the authorization. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. func (client ExpressRouteCircuitAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, authorizationName) if err != nil { @@ -252,8 +260,9 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Re } // List gets all authorizations in an express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. func (client ExpressRouteCircuitAuthorizationsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, circuitName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitpeerings.go index 2611bf16f..8a33a4337 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuitpeerings.go @@ -19,10 +19,11 @@ package network import ( "context" + "net/http" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" - "net/http" ) // ExpressRouteCircuitPeeringsClient is the network Client @@ -41,16 +42,17 @@ func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptio } // CreateOrUpdate creates or updates a peering in the specified express route circuits. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. peeringParameters is parameters supplied to the create or update express -// route circuit peering operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// peeringParameters - parameters supplied to the create or update express route circuit peering operation. func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: peeringParameters, Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMaximum, Rule: 4294967295, Chain: nil}, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, {Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, }}, }}}}}); err != nil { @@ -99,15 +101,17 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -125,9 +129,10 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *ht } // Delete deletes the specified peering from the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. func (client ExpressRouteCircuitPeeringsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeeringsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName) if err != nil { @@ -169,15 +174,17 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Conte // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -194,9 +201,10 @@ func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Respo } // Get gets the specified authorization from the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. func (client ExpressRouteCircuitPeeringsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName) if err != nil { @@ -262,8 +270,9 @@ func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response } // List gets all peerings in a specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. func (client ExpressRouteCircuitPeeringsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, circuitName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuits.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuits.go index 59aeb4a07..b48f75e10 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuits.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/expressroutecircuits.go @@ -40,9 +40,10 @@ func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID str } // CreateOrUpdate creates or updates an express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is -// parameters supplied to the create or update express route circuit operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// parameters - parameters supplied to the create or update express route circuit operation. func (client ExpressRouteCircuitsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuitsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Resp } // Delete deletes the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. func (client ExpressRouteCircuitsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName) if err != nil { @@ -153,15 +157,17 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -178,8 +184,9 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r } // Get gets information about the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name of express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of express route circuit. func (client ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, circuitName) if err != nil { @@ -244,9 +251,10 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu } // GetPeeringStats gets all stats from an express route circuit in a resource group. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. func (client ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { req, err := client.GetPeeringStatsPreparer(ctx, resourceGroupName, circuitName, peeringName) if err != nil { @@ -312,8 +320,9 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Res } // GetStats gets all the stats from an express route circuit in a resource group. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. func (client ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { req, err := client.GetStatsPreparer(ctx, resourceGroupName, circuitName) if err != nil { @@ -378,8 +387,8 @@ func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) } // List gets all the express route circuits in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client ExpressRouteCircuitsClient) List(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -561,9 +570,11 @@ func (client ExpressRouteCircuitsClient) ListAllComplete(ctx context.Context) (r } // ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. devicePath is the path of the device. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. func (client ExpressRouteCircuitsClient) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListArpTableFuture, err error) { req, err := client.ListArpTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) if err != nil { @@ -606,15 +617,17 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Contex // ListArpTableSender sends the ListArpTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -633,9 +646,11 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon // ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource // group. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. devicePath is the path of the device. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. func (client ExpressRouteCircuitsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableFuture, err error) { req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) if err != nil { @@ -678,15 +693,17 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Con // ListRoutesTableSender sends the ListRoutesTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -705,9 +722,11 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res // ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit // in a resource group. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. -// peeringName is the name of the peering. devicePath is the path of the device. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) if err != nil { @@ -750,15 +769,17 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx cont // ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -776,9 +797,10 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *h } // UpdateTags updates an express route circuit tags. -// -// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is -// parameters supplied to update express route circuit tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// parameters - parameters supplied to update express route circuit tags. func (client ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (result ExpressRouteCircuitsUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, circuitName, parameters) if err != nil { @@ -821,15 +843,17 @@ func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCircuitsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go index 4cfdbedd7..5e976c919 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go @@ -41,10 +41,11 @@ func NewInboundNatRulesClientWithBaseURI(baseURI string, subscriptionID string) } // CreateOrUpdate creates or updates a load balancer inbound nat rule. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// inboundNatRuleName is the name of the inbound nat rule. inboundNatRuleParameters is parameters supplied to the -// create or update inbound nat rule operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound nat rule. +// inboundNatRuleParameters - parameters supplied to the create or update inbound nat rule operation. func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (result InboundNatRulesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: inboundNatRuleParameters, @@ -107,15 +108,17 @@ func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (future InboundNatRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -133,9 +136,10 @@ func (client InboundNatRulesClient) CreateOrUpdateResponder(resp *http.Response) } // Delete deletes the specified load balancer inbound nat rule. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// inboundNatRuleName is the name of the inbound nat rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound nat rule. func (client InboundNatRulesClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result InboundNatRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName) if err != nil { @@ -177,15 +181,17 @@ func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resource // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client InboundNatRulesClient) DeleteSender(req *http.Request) (future InboundNatRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -202,9 +208,11 @@ func (client InboundNatRulesClient) DeleteResponder(resp *http.Response) (result } // Get gets the specified load balancer inbound nat rule. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// inboundNatRuleName is the name of the inbound nat rule. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound nat rule. +// expand - expands referenced resources. func (client InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result InboundNatRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, expand) if err != nil { @@ -273,8 +281,9 @@ func (client InboundNatRulesClient) GetResponder(resp *http.Response) (result In } // List gets all the inbound nat rules in a load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client InboundNatRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go index d0abe2515..86807b005 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go @@ -40,9 +40,10 @@ func NewInterfaceIPConfigurationsClientWithBaseURI(baseURI string, subscriptionI } // Get gets the specified network interface ip configuration. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. -// IPConfigurationName is the name of the ip configuration name. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the ip configuration name. func (client InterfaceIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result InterfaceIPConfiguration, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, IPConfigurationName) if err != nil { @@ -108,8 +109,9 @@ func (client InterfaceIPConfigurationsClient) GetResponder(resp *http.Response) } // List get all ip configurations in a network interface -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. func (client InterfaceIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go index 6114519d2..cda30b0f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go @@ -40,8 +40,9 @@ func NewInterfaceLoadBalancersClientWithBaseURI(baseURI string, subscriptionID s } // List list all load balancers in a network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. func (client InterfaceLoadBalancersClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaces.go index 1ea81ce09..6165ccc6d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaces.go @@ -40,9 +40,10 @@ func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) Inter } // CreateOrUpdate creates or updates a network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. -// parameters is parameters supplied to the create or update network interface operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// parameters - parameters supplied to the create or update network interface operation. func (client InterfacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface) (result InterfacesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkInterfaceName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (future InterfacesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (res } // Delete deletes the specified network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. func (client InterfacesClient) Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkInterfaceName) if err != nil { @@ -153,15 +157,17 @@ func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) DeleteSender(req *http.Request) (future InterfacesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -178,9 +184,10 @@ func (client InterfacesClient) DeleteResponder(resp *http.Response) (result auto } // Get gets information about the specified network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. -// expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. func (client InterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, expand) if err != nil { @@ -248,8 +255,9 @@ func (client InterfacesClient) GetResponder(resp *http.Response) (result Interfa } // GetEffectiveRouteTable gets all route tables applied to a network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. func (client InterfacesClient) GetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesGetEffectiveRouteTableFuture, err error) { req, err := client.GetEffectiveRouteTablePreparer(ctx, resourceGroupName, networkInterfaceName) if err != nil { @@ -290,15 +298,17 @@ func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Contex // GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (future InterfacesGetEffectiveRouteTableFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -317,11 +327,13 @@ func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Respon // GetVirtualMachineScaleSetIPConfiguration get the specified network interface ip configuration in a virtual machine // scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the -// network interface. IPConfigurationName is the name of the ip configuration. expand is expands referenced -// resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the ip configuration. +// expand - expands referenced resources. func (client InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result InterfaceIPConfiguration, err error) { req, err := client.GetVirtualMachineScaleSetIPConfigurationPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, expand) if err != nil { @@ -392,10 +404,12 @@ func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationResponder } // GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the -// network interface. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) if err != nil { @@ -465,8 +479,8 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponde } // List gets all network interfaces in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client InterfacesClient) List(ctx context.Context, resourceGroupName string) (result InterfaceListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -648,8 +662,9 @@ func (client InterfacesClient) ListAllComplete(ctx context.Context) (result Inte } // ListEffectiveNetworkSecurityGroups gets all network security groups applied to a network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(ctx, resourceGroupName, networkInterfaceName) if err != nil { @@ -690,15 +705,17 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx co // ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (future InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -717,10 +734,12 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp // ListVirtualMachineScaleSetIPConfigurations get the specified network interface ip configuration in a virtual machine // scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the -// network interface. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultPage, err error) { result.fn = client.listVirtualMachineScaleSetIPConfigurationsNextResults req, err := client.ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) @@ -818,9 +837,9 @@ func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsComplet } // ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultPage, err error) { result.fn = client.listVirtualMachineScaleSetNetworkInterfacesNextResults req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) @@ -914,9 +933,10 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComple // ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in // a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultPage, err error) { result.fn = client.listVirtualMachineScaleSetVMNetworkInterfacesNextResults req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) @@ -1010,9 +1030,10 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesComp } // UpdateTags updates a network interface tags. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. -// parameters is parameters supplied to update network interface tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// parameters - parameters supplied to update network interface tags. func (client InterfacesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject) (result InterfacesUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkInterfaceName, parameters) if err != nil { @@ -1055,15 +1076,17 @@ func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceG // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) UpdateTagsSender(req *http.Request) (future InterfacesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerbackendaddresspools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerbackendaddresspools.go index 5da0822f6..b7b82f3bf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerbackendaddresspools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerbackendaddresspools.go @@ -41,9 +41,10 @@ func NewLoadBalancerBackendAddressPoolsClientWithBaseURI(baseURI string, subscri } // Get gets load balancer backend address pool. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// backendAddressPoolName is the name of the backend address pool. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// backendAddressPoolName - the name of the backend address pool. func (client LoadBalancerBackendAddressPoolsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result BackendAddressPool, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName) if err != nil { @@ -109,8 +110,9 @@ func (client LoadBalancerBackendAddressPoolsClient) GetResponder(resp *http.Resp } // List gets all the load balancer backed address pools. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancerBackendAddressPoolsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerfrontendipconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerfrontendipconfigurations.go index cfc1a2d25..502c9379e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerfrontendipconfigurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerfrontendipconfigurations.go @@ -42,9 +42,10 @@ func NewLoadBalancerFrontendIPConfigurationsClientWithBaseURI(baseURI string, su } // Get gets load balancer frontend IP configuration. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// frontendIPConfigurationName is the name of the frontend IP configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// frontendIPConfigurationName - the name of the frontend IP configuration. func (client LoadBalancerFrontendIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result FrontendIPConfiguration, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, frontendIPConfigurationName) if err != nil { @@ -110,8 +111,9 @@ func (client LoadBalancerFrontendIPConfigurationsClient) GetResponder(resp *http } // List gets all the load balancer frontend IP configurations. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancerFrontendIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerloadbalancingrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerloadbalancingrules.go index f80ffddcc..c59288447 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerloadbalancingrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerloadbalancingrules.go @@ -41,9 +41,10 @@ func NewLoadBalancerLoadBalancingRulesClientWithBaseURI(baseURI string, subscrip } // Get gets the specified load balancer load balancing rule. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// loadBalancingRuleName is the name of the load balancing rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// loadBalancingRuleName - the name of the load balancing rule. func (client LoadBalancerLoadBalancingRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result LoadBalancingRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, loadBalancingRuleName) if err != nil { @@ -109,8 +110,9 @@ func (client LoadBalancerLoadBalancingRulesClient) GetResponder(resp *http.Respo } // List gets all the load balancing rules in a load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancerLoadBalancingRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancernetworkinterfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancernetworkinterfaces.go index 42d1f7939..19aff0ee3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancernetworkinterfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancernetworkinterfaces.go @@ -41,8 +41,9 @@ func NewLoadBalancerNetworkInterfacesClientWithBaseURI(baseURI string, subscript } // List gets associated load balancer network interfaces. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancerNetworkInterfacesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InterfaceListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerprobes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerprobes.go index 77e8a60ff..a4501d8fa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerprobes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancerprobes.go @@ -40,9 +40,10 @@ func NewLoadBalancerProbesClientWithBaseURI(baseURI string, subscriptionID strin } // Get gets load balancer probe. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// probeName is the name of the probe. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// probeName - the name of the probe. func (client LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, probeName) if err != nil { @@ -108,8 +109,9 @@ func (client LoadBalancerProbesClient) GetResponder(resp *http.Response) (result } // List gets all the load balancer probes. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancerProbesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancers.go index 02035242f..7513f9d14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/loadbalancers.go @@ -40,9 +40,10 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo } // CreateOrUpdate creates or updates a load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// parameters is parameters supplied to the create or update load balancer operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// parameters - parameters supplied to the create or update load balancer operation. func (client LoadBalancersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancersCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) ( } // Delete deletes the specified load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. func (client LoadBalancersClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName) if err != nil { @@ -153,15 +157,17 @@ func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) DeleteSender(req *http.Request) (future LoadBalancersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -178,9 +184,10 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a } // Get gets the specified load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. expand -// is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// expand - expands referenced resources. func (client LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, expand) if err != nil { @@ -248,8 +255,8 @@ func (client LoadBalancersClient) GetResponder(resp *http.Response) (result Load } // List gets all the load balancers in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client LoadBalancersClient) List(ctx context.Context, resourceGroupName string) (result LoadBalancerListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -431,9 +438,10 @@ func (client LoadBalancersClient) ListAllComplete(ctx context.Context) (result L } // UpdateTags updates a load balancer tags. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. -// parameters is parameters supplied to update load balancer tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// parameters - parameters supplied to update load balancer tags. func (client LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (result LoadBalancersUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, loadBalancerName, parameters) if err != nil { @@ -476,15 +484,17 @@ func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resour // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) UpdateTagsSender(req *http.Request) (future LoadBalancersUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/localnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/localnetworkgateways.go index 7c94475c4..e43ee6f27 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/localnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/localnetworkgateways.go @@ -41,9 +41,10 @@ func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID str } // CreateOrUpdate creates or updates a local network gateway in the specified resource group. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network -// gateway. parameters is parameters supplied to the create or update local network gateway operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +// parameters - parameters supplied to the create or update local network gateway operation. func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (result LocalNetworkGatewaysCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: localNetworkGatewayName, @@ -94,15 +95,17 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -120,9 +123,9 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Resp } // Delete deletes the specified local network gateway. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGatewaysDeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: localNetworkGatewayName, @@ -169,15 +172,17 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -194,9 +199,9 @@ func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (r } // Get gets the specified local network gateway in a resource group. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network -// gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: localNetworkGatewayName, @@ -267,8 +272,8 @@ func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (resu } // List gets all the local network gateways in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client LocalNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -360,9 +365,10 @@ func (client LocalNetworkGatewaysClient) ListComplete(ctx context.Context, resou } // UpdateTags updates a local network gateway tags. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network -// gateway. parameters is parameters supplied to update local network gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +// parameters - parameters supplied to update local network gateway tags. func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (result LocalNetworkGatewaysUpdateTagsFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: localNetworkGatewayName, @@ -411,15 +417,17 @@ func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future LocalNetworkGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/models.go index 2da829618..994808f03 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/models.go @@ -3202,12 +3202,11 @@ type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { // long-running operation. type ApplicationGatewaysBackendHealthFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { +func (future *ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3215,34 +3214,15 @@ func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGa return } if !done { - return agbh, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") - } - if future.PollingMethod() == azure.PollingLocation { - agbh, err = client.BackendHealthResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbh.Response.Response, err = future.GetResult(sender); err == nil && agbh.Response.Response.StatusCode != http.StatusNoContent { + agbh, err = client.BackendHealthResponder(agbh.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", agbh.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", resp, "Failure sending request") - return - } - agbh, err = client.BackendHealthResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", resp, "Failure responding to request") } return } @@ -3251,12 +3231,11 @@ func (future ApplicationGatewaysBackendHealthFuture) Result(client ApplicationGa // long-running operation. type ApplicationGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { +func (future *ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3264,34 +3243,15 @@ func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationG return } if !done { - return ag, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ag, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { + ag, err = client.CreateOrUpdateResponder(ag.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ag, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -3300,12 +3260,11 @@ func (future ApplicationGatewaysCreateOrUpdateFuture) Result(client ApplicationG // operation. type ApplicationGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3313,35 +3272,10 @@ func (future ApplicationGatewaysDeleteFuture) Result(client ApplicationGatewaysC return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3554,12 +3488,11 @@ type ApplicationGatewaySslPredefinedPolicyPropertiesFormat struct { // operation. type ApplicationGatewaysStartFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3567,35 +3500,10 @@ func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysCl return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3603,12 +3511,11 @@ func (future ApplicationGatewaysStartFuture) Result(client ApplicationGatewaysCl // operation. type ApplicationGatewaysStopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { +func (future *ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3616,35 +3523,10 @@ func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysCli return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -3652,12 +3534,11 @@ func (future ApplicationGatewaysStopFuture) Result(client ApplicationGatewaysCli // operation. type ApplicationGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { +func (future *ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -3665,34 +3546,15 @@ func (future ApplicationGatewaysUpdateTagsFuture) Result(client ApplicationGatew return } if !done { - return ag, azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ag, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { + ag, err = client.UpdateTagsResponder(ag.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", ag.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - ag, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -4064,12 +3926,11 @@ type ApplicationSecurityGroupPropertiesFormat struct { // long-running operation. type ApplicationSecurityGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4077,34 +3938,15 @@ func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client Applic return } if !done { - return asg, azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - asg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asg.Response.Response, err = future.GetResult(sender); err == nil && asg.Response.Response.StatusCode != http.StatusNoContent { + asg, err = client.CreateOrUpdateResponder(asg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", asg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - asg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -4113,12 +3955,11 @@ func (future ApplicationSecurityGroupsCreateOrUpdateFuture) Result(client Applic // operation. type ApplicationSecurityGroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { +func (future *ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -4126,35 +3967,10 @@ func (future ApplicationSecurityGroupsDeleteFuture) Result(client ApplicationSec return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -4999,12 +4815,11 @@ type ConnectionMonitorResultProperties struct { // long-running operation. type ConnectionMonitorsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConnectionMonitorsCreateOrUpdateFuture) Result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { +func (future *ConnectionMonitorsCreateOrUpdateFuture) Result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5012,34 +4827,15 @@ func (future ConnectionMonitorsCreateOrUpdateFuture) Result(client ConnectionMon return } if !done { - return cmr, azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - cmr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmr.Response.Response, err = future.GetResult(sender); err == nil && cmr.Response.Response.StatusCode != http.StatusNoContent { + cmr, err = client.CreateOrUpdateResponder(cmr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", cmr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - cmr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -5048,12 +4844,11 @@ func (future ConnectionMonitorsCreateOrUpdateFuture) Result(client ConnectionMon // operation. type ConnectionMonitorsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConnectionMonitorsDeleteFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { +func (future *ConnectionMonitorsDeleteFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5061,35 +4856,10 @@ func (future ConnectionMonitorsDeleteFuture) Result(client ConnectionMonitorsCli return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -5105,12 +4875,11 @@ type ConnectionMonitorSource struct { // operation. type ConnectionMonitorsQueryFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { +func (future *ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5118,34 +4887,15 @@ func (future ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsClie return } if !done { - return cmqr, azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") - } - if future.PollingMethod() == azure.PollingLocation { - cmqr, err = client.QueryResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmqr.Response.Response, err = future.GetResult(sender); err == nil && cmqr.Response.Response.StatusCode != http.StatusNoContent { + cmqr, err = client.QueryResponder(cmqr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", cmqr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", resp, "Failure sending request") - return - } - cmqr, err = client.QueryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", resp, "Failure responding to request") } return } @@ -5154,12 +4904,11 @@ func (future ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsClie // operation. type ConnectionMonitorsStartFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConnectionMonitorsStartFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { +func (future *ConnectionMonitorsStartFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5167,35 +4916,10 @@ func (future ConnectionMonitorsStartFuture) Result(client ConnectionMonitorsClie return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStartFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StartResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStartFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -5203,12 +4927,11 @@ func (future ConnectionMonitorsStartFuture) Result(client ConnectionMonitorsClie // operation. type ConnectionMonitorsStopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ConnectionMonitorsStopFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { +func (future *ConnectionMonitorsStopFuture) Result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5216,35 +4939,10 @@ func (future ConnectionMonitorsStopFuture) Result(client ConnectionMonitorsClien return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStopFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -5839,12 +5537,11 @@ func (erca *ExpressRouteCircuitAuthorization) UnmarshalJSON(body []byte) error { // of a long-running operation. type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5852,34 +5549,15 @@ func (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(clien return } if !done { - return erca, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erca, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent { + erca, err = client.CreateOrUpdateResponder(erca.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", erca.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - erca, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -5888,12 +5566,11 @@ func (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) Result(clien // long-running operation. type ExpressRouteCircuitAuthorizationsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitAuthorizationsDeleteFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) Result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5901,35 +5578,10 @@ func (future ExpressRouteCircuitAuthorizationsDeleteFuture) Result(client Expres return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -6278,12 +5930,11 @@ type ExpressRouteCircuitPeeringPropertiesFormat struct { // long-running operation. type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6291,34 +5942,15 @@ func (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client Expr return } if !done { - return ercp, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent { + ercp, err = client.CreateOrUpdateResponder(ercp.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", ercp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - ercp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -6327,12 +5959,11 @@ func (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture) Result(client Expr // long-running operation. type ExpressRouteCircuitPeeringsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitPeeringsDeleteFuture) Result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { +func (future *ExpressRouteCircuitPeeringsDeleteFuture) Result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6340,35 +5971,10 @@ func (future ExpressRouteCircuitPeeringsDeleteFuture) Result(client ExpressRoute return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -6437,12 +6043,11 @@ type ExpressRouteCircuitsArpTableListResult struct { // long-running operation. type ExpressRouteCircuitsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6450,34 +6055,15 @@ func (future ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRout return } if !done { - return erc, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erc, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.CreateOrUpdateResponder(erc.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - erc, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -6486,12 +6072,11 @@ func (future ExpressRouteCircuitsCreateOrUpdateFuture) Result(client ExpressRout // operation. type ExpressRouteCircuitsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsDeleteFuture) Result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { +func (future *ExpressRouteCircuitsDeleteFuture) Result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6499,35 +6084,10 @@ func (future ExpressRouteCircuitsDeleteFuture) Result(client ExpressRouteCircuit return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -6555,12 +6115,11 @@ type ExpressRouteCircuitSku struct { // long-running operation. type ExpressRouteCircuitsListArpTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { +func (future *ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6568,34 +6127,15 @@ func (future ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteC return } if !done { - return ercatlr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercatlr, err = client.ListArpTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { + ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", resp, "Failure sending request") - return - } - ercatlr, err = client.ListArpTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", resp, "Failure responding to request") } return } @@ -6604,12 +6144,11 @@ func (future ExpressRouteCircuitsListArpTableFuture) Result(client ExpressRouteC // long-running operation. type ExpressRouteCircuitsListRoutesTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { +func (future *ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6617,34 +6156,15 @@ func (future ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRou return } if !done { - return ercrtlr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercrtlr, err = client.ListRoutesTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { + ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", resp, "Failure sending request") - return - } - ercrtlr, err = client.ListRoutesTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", resp, "Failure responding to request") } return } @@ -6653,12 +6173,11 @@ func (future ExpressRouteCircuitsListRoutesTableFuture) Result(client ExpressRou // long-running operation. type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsListRoutesTableSummaryFuture) Result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) Result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6666,34 +6185,15 @@ func (future ExpressRouteCircuitsListRoutesTableSummaryFuture) Result(client Exp return } if !done { - return ercrtslr, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ercrtslr, err = client.ListRoutesTableSummaryResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtslr.Response.Response, err = future.GetResult(sender); err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent { + ercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", ercrtslr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", resp, "Failure sending request") - return - } - ercrtslr, err = client.ListRoutesTableSummaryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", resp, "Failure responding to request") } return } @@ -6735,12 +6235,11 @@ type ExpressRouteCircuitStats struct { // operation. type ExpressRouteCircuitsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ExpressRouteCircuitsUpdateTagsFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { +func (future *ExpressRouteCircuitsUpdateTagsFuture) Result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6748,34 +6247,15 @@ func (future ExpressRouteCircuitsUpdateTagsFuture) Result(client ExpressRouteCir return } if !done { - return erc, azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erc, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.UpdateTagsResponder(erc.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", erc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - erc, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -7544,12 +7024,11 @@ type InboundNatRulePropertiesFormat struct { // operation. type InboundNatRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesClient) (inr InboundNatRule, err error) { +func (future *InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesClient) (inr InboundNatRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7557,34 +7036,15 @@ func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesC return } if !done { - return inr, azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - inr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if inr.Response.Response, err = future.GetResult(sender); err == nil && inr.Response.Response.StatusCode != http.StatusNoContent { + inr, err = client.CreateOrUpdateResponder(inr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", inr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - inr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -7593,12 +7053,11 @@ func (future InboundNatRulesCreateOrUpdateFuture) Result(client InboundNatRulesC // operation. type InboundNatRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) (ar autorest.Response, err error) { +func (future *InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -7606,35 +7065,10 @@ func (future InboundNatRulesDeleteFuture) Result(client InboundNatRulesClient) ( return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -8227,12 +7661,11 @@ type InterfacePropertiesFormat struct { // operation. type InterfacesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i Interface, err error) { +func (future *InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i Interface, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8240,34 +7673,15 @@ func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i return } if !done { - return i, azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -8275,12 +7689,11 @@ func (future InterfacesCreateOrUpdateFuture) Result(client InterfacesClient) (i // InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type InterfacesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autorest.Response, err error) { +func (future *InterfacesDeleteFuture) Result(client InterfacesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8288,35 +7701,10 @@ func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autores return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -8324,12 +7712,11 @@ func (future InterfacesDeleteFuture) Result(client InterfacesClient) (ar autores // long-running operation. type InterfacesGetEffectiveRouteTableFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { +func (future *InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8337,34 +7724,15 @@ func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesCli return } if !done { - return erlr, azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") - } - if future.PollingMethod() == azure.PollingLocation { - erlr, err = client.GetEffectiveRouteTableResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erlr.Response.Response, err = future.GetResult(sender); err == nil && erlr.Response.Response.StatusCode != http.StatusNoContent { + erlr, err = client.GetEffectiveRouteTableResponder(erlr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", erlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", resp, "Failure sending request") - return - } - erlr, err = client.GetEffectiveRouteTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", resp, "Failure responding to request") } return } @@ -8373,12 +7741,11 @@ func (future InterfacesGetEffectiveRouteTableFuture) Result(client InterfacesCli // long-running operation. type InterfacesListEffectiveNetworkSecurityGroupsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8386,34 +7753,15 @@ func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client I return } if !done { - return ensglr, azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ensglr.Response.Response, err = future.GetResult(sender); err == nil && ensglr.Response.Response.StatusCode != http.StatusNoContent { + ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(ensglr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", ensglr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", resp, "Failure sending request") - return - } - ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", resp, "Failure responding to request") } return } @@ -8421,12 +7769,11 @@ func (future InterfacesListEffectiveNetworkSecurityGroupsFuture) Result(client I // InterfacesUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running operation. type InterfacesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Interface, err error) { +func (future *InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Interface, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -8434,34 +7781,15 @@ func (future InterfacesUpdateTagsFuture) Result(client InterfacesClient) (i Inte return } if !done { - return i, azure.NewAsyncOpIncompleteError("network.InterfacesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - i, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.InterfacesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.UpdateTagsResponder(i.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", i.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - i, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -9289,12 +8617,11 @@ type LoadBalancerPropertiesFormat struct { // operation. type LoadBalancersCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { +func (future *LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9302,34 +8629,15 @@ func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClien return } if !done { - return lb, azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lb, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { + lb, err = client.CreateOrUpdateResponder(lb.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - lb, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -9337,12 +8645,11 @@ func (future LoadBalancersCreateOrUpdateFuture) Result(client LoadBalancersClien // LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type LoadBalancersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar autorest.Response, err error) { +func (future *LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9350,35 +8657,10 @@ func (future LoadBalancersDeleteFuture) Result(client LoadBalancersClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -9392,12 +8674,11 @@ type LoadBalancerSku struct { // operation. type LoadBalancersUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { +func (future *LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) (lb LoadBalancer, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9405,34 +8686,15 @@ func (future LoadBalancersUpdateTagsFuture) Result(client LoadBalancersClient) ( return } if !done { - return lb, azure.NewAsyncOpIncompleteError("network.LoadBalancersUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lb, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { + lb, err = client.UpdateTagsResponder(lb.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", lb.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - lb, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -9789,12 +9051,11 @@ type LocalNetworkGatewayPropertiesFormat struct { // long-running operation. type LocalNetworkGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9802,34 +9063,15 @@ func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetwor return } if !done { - return lng, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lng, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { + lng, err = client.CreateOrUpdateResponder(lng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - lng, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -9838,12 +9080,11 @@ func (future LocalNetworkGatewaysCreateOrUpdateFuture) Result(client LocalNetwor // operation. type LocalNetworkGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { +func (future *LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9851,35 +9092,10 @@ func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGateway return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -9887,12 +9103,11 @@ func (future LocalNetworkGatewaysDeleteFuture) Result(client LocalNetworkGateway // operation. type LocalNetworkGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { +func (future *LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -9900,34 +9115,15 @@ func (future LocalNetworkGatewaysUpdateTagsFuture) Result(client LocalNetworkGat return } if !done { - return lng, azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - lng, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { + lng, err = client.UpdateTagsResponder(lng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", lng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - lng, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -10545,12 +9741,11 @@ type PacketCaptureResultProperties struct { // PacketCapturesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { +func (future *PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10558,34 +9753,15 @@ func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pc return } if !done { - return pcr, azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pcr, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcr.Response.Response, err = future.GetResult(sender); err == nil && pcr.Response.Response.StatusCode != http.StatusNoContent { + pcr, err = client.CreateResponder(pcr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", pcr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", resp, "Failure sending request") - return - } - pcr, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", resp, "Failure responding to request") } return } @@ -10593,12 +9769,11 @@ func (future PacketCapturesCreateFuture) Result(client PacketCapturesClient) (pc // PacketCapturesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { +func (future *PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10606,35 +9781,10 @@ func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -10642,12 +9792,11 @@ func (future PacketCapturesDeleteFuture) Result(client PacketCapturesClient) (ar // operation. type PacketCapturesGetStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { +func (future *PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10655,34 +9804,15 @@ func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) return } if !done { - return pcqsr, azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pcqsr, err = client.GetStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcqsr.Response.Response, err = future.GetResult(sender); err == nil && pcqsr.Response.Response.StatusCode != http.StatusNoContent { + pcqsr, err = client.GetStatusResponder(pcqsr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", pcqsr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", resp, "Failure sending request") - return - } - pcqsr, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -10690,12 +9820,11 @@ func (future PacketCapturesGetStatusFuture) Result(client PacketCapturesClient) // PacketCapturesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PacketCapturesStopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { +func (future *PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -10703,35 +9832,10 @@ func (future PacketCapturesStopFuture) Result(client PacketCapturesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.StopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -11199,12 +10303,11 @@ type PublicIPAddressDNSSettings struct { // operation. type PublicIPAddressesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { +func (future *PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11212,34 +10315,15 @@ func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddres return } if !done { - return pia, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pia, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { + pia, err = client.CreateOrUpdateResponder(pia.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - pia, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -11248,12 +10332,11 @@ func (future PublicIPAddressesCreateOrUpdateFuture) Result(client PublicIPAddres // operation. type PublicIPAddressesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClient) (ar autorest.Response, err error) { +func (future *PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11261,35 +10344,10 @@ func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClien return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -11297,12 +10355,11 @@ func (future PublicIPAddressesDeleteFuture) Result(client PublicIPAddressesClien // operation. type PublicIPAddressesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { +func (future *PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -11310,34 +10367,15 @@ func (future PublicIPAddressesUpdateTagsFuture) Result(client PublicIPAddressesC return } if !done { - return pia, azure.NewAsyncOpIncompleteError("network.PublicIPAddressesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - pia, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { + pia, err = client.UpdateTagsResponder(pia.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", pia.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - pia, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -12142,12 +11180,11 @@ type RouteFilterRulePropertiesFormat struct { // operation. type RouteFilterRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { +func (future *RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12155,34 +11192,15 @@ func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRule return } if !done { - return rfr, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rfr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rfr.Response.Response, err = future.GetResult(sender); err == nil && rfr.Response.Response.StatusCode != http.StatusNoContent { + rfr, err = client.CreateOrUpdateResponder(rfr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rfr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12191,12 +11209,11 @@ func (future RouteFilterRulesCreateOrUpdateFuture) Result(client RouteFilterRule // operation. type RouteFilterRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) (ar autorest.Response, err error) { +func (future *RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12204,35 +11221,10 @@ func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12240,12 +11232,11 @@ func (future RouteFilterRulesDeleteFuture) Result(client RouteFilterRulesClient) // operation. type RouteFilterRulesUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { +func (future *RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12253,34 +11244,15 @@ func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) return } if !done { - return rfr, azure.NewAsyncOpIncompleteError("network.RouteFilterRulesUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rfr, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rfr.Response.Response, err = future.GetResult(sender); err == nil && rfr.Response.Response.StatusCode != http.StatusNoContent { + rfr, err = client.UpdateResponder(rfr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", resp, "Failure sending request") - return - } - rfr, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12289,12 +11261,11 @@ func (future RouteFilterRulesUpdateFuture) Result(client RouteFilterRulesClient) // operation. type RouteFiltersCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { +func (future *RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12302,34 +11273,15 @@ func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) return } if !done { - return rf, azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rf, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rf.Response.Response, err = future.GetResult(sender); err == nil && rf.Response.Response.StatusCode != http.StatusNoContent { + rf, err = client.CreateOrUpdateResponder(rf.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rf, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12337,12 +11289,11 @@ func (future RouteFiltersCreateOrUpdateFuture) Result(client RouteFiltersClient) // RouteFiltersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteFiltersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar autorest.Response, err error) { +func (future *RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12350,47 +11301,21 @@ func (future RouteFiltersDeleteFuture) Result(client RouteFiltersClient) (ar aut return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // RouteFiltersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteFiltersUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { +func (future *RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf RouteFilter, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12398,34 +11323,15 @@ func (future RouteFiltersUpdateFuture) Result(client RouteFiltersClient) (rf Rou return } if !done { - return rf, azure.NewAsyncOpIncompleteError("network.RouteFiltersUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rf, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rf.Response.Response, err = future.GetResult(sender); err == nil && rf.Response.Response.StatusCode != http.StatusNoContent { + rf, err = client.UpdateResponder(rf.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", resp, "Failure sending request") - return - } - rf, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12547,12 +11453,11 @@ type RoutePropertiesFormat struct { // RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RoutesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, err error) { +func (future *RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12560,34 +11465,15 @@ func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, e return } if !done { - return r, azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - r, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateOrUpdateResponder(r.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - r, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12595,12 +11481,11 @@ func (future RoutesCreateOrUpdateFuture) Result(client RoutesClient) (r Route, e // RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RoutesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Response, err error) { +func (future *RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12608,35 +11493,10 @@ func (future RoutesDeleteFuture) Result(client RoutesClient) (ar autorest.Respon return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12882,12 +11742,11 @@ type RouteTablePropertiesFormat struct { // operation. type RouteTablesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { +func (future *RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12895,34 +11754,15 @@ func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) ( return } if !done { - return rt, azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rt, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.CreateOrUpdateResponder(rt.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - rt, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -12930,12 +11770,11 @@ func (future RouteTablesCreateOrUpdateFuture) Result(client RouteTablesClient) ( // RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type RouteTablesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autorest.Response, err error) { +func (future *RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12943,35 +11782,10 @@ func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autor return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -12979,12 +11793,11 @@ func (future RouteTablesDeleteFuture) Result(client RouteTablesClient) (ar autor // operation. type RouteTablesUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { +func (future *RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt RouteTable, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -12992,34 +11805,15 @@ func (future RouteTablesUpdateTagsFuture) Result(client RouteTablesClient) (rt R return } if !done { - return rt, azure.NewAsyncOpIncompleteError("network.RouteTablesUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - rt, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.RouteTablesUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.UpdateTagsResponder(rt.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", rt.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - rt, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -13277,12 +12071,11 @@ type SecurityGroupPropertiesFormat struct { // operation. type SecurityGroupsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { +func (future *SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13290,34 +12083,15 @@ func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsCli return } if !done { - return sg, azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { + sg, err = client.CreateOrUpdateResponder(sg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -13325,12 +12099,11 @@ func (future SecurityGroupsCreateOrUpdateFuture) Result(client SecurityGroupsCli // SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SecurityGroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar autorest.Response, err error) { +func (future *SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13338,35 +12111,10 @@ func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -13374,12 +12122,11 @@ func (future SecurityGroupsDeleteFuture) Result(client SecurityGroupsClient) (ar // operation. type SecurityGroupsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { +func (future *SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) (sg SecurityGroup, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13387,34 +12134,15 @@ func (future SecurityGroupsUpdateTagsFuture) Result(client SecurityGroupsClient) return } if !done { - return sg, azure.NewAsyncOpIncompleteError("network.SecurityGroupsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sg, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { + sg, err = client.UpdateTagsResponder(sg.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", sg.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - sg, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -13667,12 +12395,11 @@ type SecurityRulePropertiesFormat struct { // operation. type SecurityRulesCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClient) (sr SecurityRule, err error) { +func (future *SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClient) (sr SecurityRule, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13680,34 +12407,15 @@ func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClien return } if !done { - return sr, azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - sr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -13715,12 +12423,11 @@ func (future SecurityRulesCreateOrUpdateFuture) Result(client SecurityRulesClien // SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SecurityRulesDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar autorest.Response, err error) { +func (future *SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -13728,35 +12435,10 @@ func (future SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar a return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -13990,12 +12672,11 @@ type SubnetPropertiesFormat struct { // operation. type SubnetsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet, err error) { +func (future *SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14003,34 +12684,15 @@ func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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 { - return + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -14038,12 +12700,11 @@ func (future SubnetsCreateOrUpdateFuture) Result(client SubnetsClient) (s Subnet // SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type SubnetsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Response, err error) { +func (future *SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -14051,35 +12712,10 @@ func (future SubnetsDeleteFuture) Result(client SubnetsClient) (ar autorest.Resp return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -15116,12 +13752,11 @@ type VirtualNetworkGatewayConnectionPropertiesFormat struct { // a long-running operation. type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15129,34 +13764,15 @@ func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client return } if !done { - return vngc, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vngc, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { + vngc, err = client.CreateOrUpdateResponder(vngc.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vngc, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -15165,12 +13781,11 @@ func (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) Result(client // long-running operation. type VirtualNetworkGatewayConnectionsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) Result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15178,35 +13793,10 @@ func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client Virtual return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -15214,12 +13804,11 @@ func (future VirtualNetworkGatewayConnectionsDeleteFuture) Result(client Virtual // a long-running operation. type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15227,34 +13816,15 @@ func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client return } if !done { - return crsk, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") - } - if future.PollingMethod() == azure.PollingLocation { - crsk, err = client.ResetSharedKeyResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if crsk.Response.Response, err = future.GetResult(sender); err == nil && crsk.Response.Response.StatusCode != http.StatusNoContent { + crsk, err = client.ResetSharedKeyResponder(crsk.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", resp, "Failure sending request") - return - } - crsk, err = client.ResetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", resp, "Failure responding to request") } return } @@ -15263,12 +13833,11 @@ func (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture) Result(client // long-running operation. type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15276,34 +13845,15 @@ func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client V return } if !done { - return csk, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") - } - if future.PollingMethod() == azure.PollingLocation { - csk, err = client.SetSharedKeyResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent { + csk, err = client.SetSharedKeyResponder(csk.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", resp, "Failure sending request") - return - } - csk, err = client.SetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", resp, "Failure responding to request") } return } @@ -15312,12 +13862,11 @@ func (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture) Result(client V // long-running operation. type VirtualNetworkGatewayConnectionsUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngcle VirtualNetworkGatewayConnectionListEntity, err error) { +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client VirtualNetworkGatewayConnectionsClient) (vngcle VirtualNetworkGatewayConnectionListEntity, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15325,34 +13874,15 @@ func (future VirtualNetworkGatewayConnectionsUpdateTagsFuture) Result(client Vir return } if !done { - return vngcle, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vngcle, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngcle.Response.Response, err = future.GetResult(sender); err == nil && vngcle.Response.Response.StatusCode != http.StatusNoContent { + vngcle, err = client.UpdateTagsResponder(vngcle.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", vngcle.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vngcle, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -15687,12 +14217,11 @@ type VirtualNetworkGatewayPropertiesFormat struct { // long-running operation. type VirtualNetworkGatewaysCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15700,34 +14229,15 @@ func (future VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNe return } if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.CreateOrUpdateResponder(vng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vng, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -15736,12 +14246,11 @@ func (future VirtualNetworkGatewaysCreateOrUpdateFuture) Result(client VirtualNe // operation. type VirtualNetworkGatewaysDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15749,35 +14258,10 @@ func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGat return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -15785,12 +14269,11 @@ func (future VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGat // a long-running operation. type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15798,34 +14281,15 @@ func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GeneratevpnclientpackageResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.GeneratevpnclientpackageResponder(s.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GeneratevpnclientpackageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", resp, "Failure responding to request") } return } @@ -15834,12 +14298,11 @@ func (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client // long-running operation. type VirtualNetworkGatewaysGenerateVpnProfileFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15847,34 +14310,15 @@ func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client Virtu return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GenerateVpnProfileResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.GenerateVpnProfileResponder(s.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GenerateVpnProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", resp, "Failure responding to request") } return } @@ -15883,12 +14327,11 @@ func (future VirtualNetworkGatewaysGenerateVpnProfileFuture) Result(client Virtu // long-running operation. type VirtualNetworkGatewaysGetAdvertisedRoutesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15896,34 +14339,15 @@ func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client Virt return } if !done { - return grlr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - grlr, err = client.GetAdvertisedRoutesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", resp, "Failure sending request") - return - } - grlr, err = client.GetAdvertisedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", resp, "Failure responding to request") } return } @@ -15932,12 +14356,11 @@ func (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture) Result(client Virt // long-running operation. type VirtualNetworkGatewaysGetBgpPeerStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15945,34 +14368,15 @@ func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client Virtual return } if !done { - return bpslr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - bpslr, err = client.GetBgpPeerStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bpslr.Response.Response, err = future.GetResult(sender); err == nil && bpslr.Response.Response.StatusCode != http.StatusNoContent { + bpslr, err = client.GetBgpPeerStatusResponder(bpslr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", resp, "Failure sending request") - return - } - bpslr, err = client.GetBgpPeerStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -15981,12 +14385,11 @@ func (future VirtualNetworkGatewaysGetBgpPeerStatusFuture) Result(client Virtual // long-running operation. type VirtualNetworkGatewaysGetLearnedRoutesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -15994,34 +14397,15 @@ func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client Virtual return } if !done { - return grlr, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - grlr, err = client.GetLearnedRoutesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetLearnedRoutesResponder(grlr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", resp, "Failure sending request") - return - } - grlr, err = client.GetLearnedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", resp, "Failure responding to request") } return } @@ -16030,12 +14414,11 @@ func (future VirtualNetworkGatewaysGetLearnedRoutesFuture) Result(client Virtual // a long-running operation. type VirtualNetworkGatewaysGetVpnProfilePackageURLFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16043,34 +14426,15 @@ func (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) Result(client return } if !done { - return s, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") - } - if future.PollingMethod() == azure.PollingLocation { - s, err = client.GetVpnProfilePackageURLResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + 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.GetVpnProfilePackageURLResponder(s.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", resp, "Failure sending request") - return - } - s, err = client.GetVpnProfilePackageURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", resp, "Failure responding to request") } return } @@ -16089,12 +14453,11 @@ type VirtualNetworkGatewaySku struct { // operation. type VirtualNetworkGatewaysResetFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16102,34 +14465,15 @@ func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGate return } if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.ResetResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.ResetResponder(vng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", resp, "Failure sending request") - return - } - vng, err = client.ResetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", resp, "Failure responding to request") } return } @@ -16138,12 +14482,11 @@ func (future VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGate // long-running operation. type VirtualNetworkGatewaysUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { +func (future *VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16151,34 +14494,15 @@ func (future VirtualNetworkGatewaysUpdateTagsFuture) Result(client VirtualNetwor return } if !done { - return vng, azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vng, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.UpdateTagsResponder(vng.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vng, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -16596,12 +14920,11 @@ type VirtualNetworkPeeringPropertiesFormat struct { // long-running operation. type VirtualNetworkPeeringsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16609,34 +14932,15 @@ func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNe return } if !done { - return vnp, azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vnp, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { + vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vnp, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -16645,12 +14949,11 @@ func (future VirtualNetworkPeeringsCreateOrUpdateFuture) Result(client VirtualNe // operation. type VirtualNetworkPeeringsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { +func (future *VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16658,35 +14961,10 @@ func (future VirtualNetworkPeeringsDeleteFuture) Result(client VirtualNetworkPee return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -16714,12 +14992,11 @@ type VirtualNetworkPropertiesFormat struct { // operation. type VirtualNetworksCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { +func (future *VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16727,34 +15004,15 @@ func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksC return } if !done { - return vn, azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vn, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { + vn, err = client.CreateOrUpdateResponder(vn.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - vn, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -16763,12 +15021,11 @@ func (future VirtualNetworksCreateOrUpdateFuture) Result(client VirtualNetworksC // operation. type VirtualNetworksDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) (ar autorest.Response, err error) { +func (future *VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16776,35 +15033,10 @@ func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) ( return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -16812,12 +15044,11 @@ func (future VirtualNetworksDeleteFuture) Result(client VirtualNetworksClient) ( // operation. type VirtualNetworksUpdateTagsFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { +func (future *VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -16825,34 +15056,15 @@ func (future VirtualNetworksUpdateTagsFuture) Result(client VirtualNetworksClien return } if !done { - return vn, azure.NewAsyncOpIncompleteError("network.VirtualNetworksUpdateTagsFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vn, err = client.UpdateTagsResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksUpdateTagsFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { + vn, err = client.UpdateTagsResponder(vn.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", vn.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", resp, "Failure sending request") - return - } - vn, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksUpdateTagsFuture", "Result", resp, "Failure responding to request") } return } @@ -17234,12 +15446,11 @@ type WatcherPropertiesFormat struct { // operation. type WatchersCheckConnectivityFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci ConnectivityInformation, err error) { +func (future *WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci ConnectivityInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17247,34 +15458,15 @@ func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci return } if !done { - return ci, azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ci, err = client.CheckConnectivityResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { + ci, err = client.CheckConnectivityResponder(ci.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", ci.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", resp, "Failure sending request") - return - } - ci, err = client.CheckConnectivityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", resp, "Failure responding to request") } return } @@ -17282,12 +15474,11 @@ func (future WatchersCheckConnectivityFuture) Result(client WatchersClient) (ci // WatchersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Response, err error) { +func (future *WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17295,35 +15486,10 @@ func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Re return } if !done { - return ar, azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -17331,12 +15497,11 @@ func (future WatchersDeleteFuture) Result(client WatchersClient) (ar autorest.Re // long-running operation. type WatchersGetAzureReachabilityReportFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersClient) (arr AzureReachabilityReport, err error) { +func (future *WatchersGetAzureReachabilityReportFuture) Result(client WatchersClient) (arr AzureReachabilityReport, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17344,34 +15509,15 @@ func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersCli return } if !done { - return arr, azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") - } - if future.PollingMethod() == azure.PollingLocation { - arr, err = client.GetAzureReachabilityReportResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if arr.Response.Response, err = future.GetResult(sender); err == nil && arr.Response.Response.StatusCode != http.StatusNoContent { + arr, err = client.GetAzureReachabilityReportResponder(arr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", arr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", resp, "Failure sending request") - return - } - arr, err = client.GetAzureReachabilityReportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", resp, "Failure responding to request") } return } @@ -17380,12 +15526,11 @@ func (future WatchersGetAzureReachabilityReportFuture) Result(client WatchersCli // operation. type WatchersGetFlowLogStatusFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { +func (future *WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17393,34 +15538,15 @@ func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli return } if !done { - return fli, azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fli, err = client.GetFlowLogStatusResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.GetFlowLogStatusResponder(fli.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", fli.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", resp, "Failure sending request") - return - } - fli, err = client.GetFlowLogStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", resp, "Failure responding to request") } return } @@ -17428,12 +15554,11 @@ func (future WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli // WatchersGetNextHopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersGetNextHopFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHopResult, err error) { +func (future *WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHopResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17441,34 +15566,15 @@ func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHo return } if !done { - return nhr, azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") - } - if future.PollingMethod() == azure.PollingLocation { - nhr, err = client.GetNextHopResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if nhr.Response.Response, err = future.GetResult(sender); err == nil && nhr.Response.Response.StatusCode != http.StatusNoContent { + nhr, err = client.GetNextHopResponder(nhr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", nhr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", resp, "Failure sending request") - return - } - nhr, err = client.GetNextHopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", resp, "Failure responding to request") } return } @@ -17477,12 +15583,11 @@ func (future WatchersGetNextHopFuture) Result(client WatchersClient) (nhr NextHo // operation. type WatchersGetTroubleshootingFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { +func (future *WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17490,34 +15595,15 @@ func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr return } if !done { - return tr, azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") - } - if future.PollingMethod() == azure.PollingLocation { - tr, err = client.GetTroubleshootingResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResponder(tr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", tr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", resp, "Failure sending request") - return - } - tr, err = client.GetTroubleshootingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", resp, "Failure responding to request") } return } @@ -17526,12 +15612,11 @@ func (future WatchersGetTroubleshootingFuture) Result(client WatchersClient) (tr // long-running operation. type WatchersGetTroubleshootingResultFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { +func (future *WatchersGetTroubleshootingResultFuture) Result(client WatchersClient) (tr TroubleshootingResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17539,34 +15624,15 @@ func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClien return } if !done { - return tr, azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") - } - if future.PollingMethod() == azure.PollingLocation { - tr, err = client.GetTroubleshootingResultResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResultResponder(tr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", tr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", resp, "Failure sending request") - return - } - tr, err = client.GetTroubleshootingResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", resp, "Failure responding to request") } return } @@ -17575,12 +15641,11 @@ func (future WatchersGetTroubleshootingResultFuture) Result(client WatchersClien // operation. type WatchersGetVMSecurityRulesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { +func (future *WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17588,34 +15653,15 @@ func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sg return } if !done { - return sgvr, azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - sgvr, err = client.GetVMSecurityRulesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sgvr.Response.Response, err = future.GetResult(sender); err == nil && sgvr.Response.Response.StatusCode != http.StatusNoContent { + sgvr, err = client.GetVMSecurityRulesResponder(sgvr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", sgvr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", resp, "Failure sending request") - return - } - sgvr, err = client.GetVMSecurityRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", resp, "Failure responding to request") } return } @@ -17624,12 +15670,11 @@ func (future WatchersGetVMSecurityRulesFuture) Result(client WatchersClient) (sg // operation. type WatchersListAvailableProvidersFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) (apl AvailableProvidersList, err error) { +func (future *WatchersListAvailableProvidersFuture) Result(client WatchersClient) (apl AvailableProvidersList, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17637,34 +15682,15 @@ func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) return } if !done { - return apl, azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") - } - if future.PollingMethod() == azure.PollingLocation { - apl, err = client.ListAvailableProvidersResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apl.Response.Response, err = future.GetResult(sender); err == nil && apl.Response.Response.StatusCode != http.StatusNoContent { + apl, err = client.ListAvailableProvidersResponder(apl.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", apl.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", resp, "Failure sending request") - return - } - apl, err = client.ListAvailableProvidersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", resp, "Failure responding to request") } return } @@ -17673,12 +15699,11 @@ func (future WatchersListAvailableProvidersFuture) Result(client WatchersClient) // operation. type WatchersSetFlowLogConfigurationFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { +func (future *WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient) (fli FlowLogInformation, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17686,34 +15711,15 @@ func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient return } if !done { - return fli, azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") - } - if future.PollingMethod() == azure.PollingLocation { - fli, err = client.SetFlowLogConfigurationResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.SetFlowLogConfigurationResponder(fli.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", fli.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", resp, "Failure sending request") - return - } - fli, err = client.SetFlowLogConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", resp, "Failure responding to request") } return } @@ -17721,12 +15727,11 @@ func (future WatchersSetFlowLogConfigurationFuture) Result(client WatchersClient // WatchersVerifyIPFlowFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersVerifyIPFlowFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { +func (future *WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -17734,34 +15739,15 @@ func (future WatchersVerifyIPFlowFuture) Result(client WatchersClient) (vifr Ver return } if !done { - return vifr, azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") - } - if future.PollingMethod() == azure.PollingLocation { - vifr, err = client.VerifyIPFlowResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vifr.Response.Response, err = future.GetResult(sender); err == nil && vifr.Response.Response.StatusCode != http.StatusNoContent { + vifr, err = client.VerifyIPFlowResponder(vifr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", vifr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", resp, "Failure sending request") - return - } - vifr, err = client.VerifyIPFlowResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/packetcaptures.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/packetcaptures.go index d425c6d1c..eb9a1376f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/packetcaptures.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/packetcaptures.go @@ -41,10 +41,11 @@ func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) P } // Create create and start a packet capture on the specified VM. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// packetCaptureName is the name of the packet capture session. parameters is parameters that define the create -// packet capture operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. +// parameters - parameters that define the create packet capture operation. func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (result PacketCapturesCreateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -97,15 +98,17 @@ func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceG // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) CreateSender(req *http.Request) (future PacketCapturesCreateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -123,9 +126,10 @@ func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result } // Delete deletes the specified packet capture session. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// packetCaptureName is the name of the packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. func (client PacketCapturesClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) if err != nil { @@ -167,15 +171,17 @@ func (client PacketCapturesClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) DeleteSender(req *http.Request) (future PacketCapturesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -192,9 +198,10 @@ func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result } // Get gets a packet capture session by name. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// packetCaptureName is the name of the packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. func (client PacketCapturesClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) if err != nil { @@ -260,9 +267,10 @@ func (client PacketCapturesClient) GetResponder(resp *http.Response) (result Pac } // GetStatus query the status of a running packet capture session. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher -// resource. packetCaptureName is the name given to the packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the Network Watcher resource. +// packetCaptureName - the name given to the packet capture session. func (client PacketCapturesClient) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesGetStatusFuture, err error) { req, err := client.GetStatusPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) if err != nil { @@ -304,15 +312,17 @@ func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, resour // GetStatusSender sends the GetStatus request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) GetStatusSender(req *http.Request) (future PacketCapturesGetStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -330,9 +340,9 @@ func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (resu } // List lists all packet capture sessions within the specified resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher -// resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the Network Watcher resource. func (client PacketCapturesClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) if err != nil { @@ -397,9 +407,10 @@ func (client PacketCapturesClient) ListResponder(resp *http.Response) (result Pa } // Stop stops a specified packet capture session. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// packetCaptureName is the name of the packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. func (client PacketCapturesClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesStopFuture, err error) { req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) if err != nil { @@ -441,15 +452,17 @@ func (client PacketCapturesClient) StopPreparer(ctx context.Context, resourceGro // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client PacketCapturesClient) StopSender(req *http.Request) (future PacketCapturesStopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/publicipaddresses.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/publicipaddresses.go index caf07d247..956756f94 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/publicipaddresses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/publicipaddresses.go @@ -41,9 +41,10 @@ func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string } // CreateOrUpdate creates or updates a static or dynamic public IP address. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the public IP address. -// parameters is parameters supplied to the create or update public IP address operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +// parameters - parameters supplied to the create or update public IP address operation. func (client PublicIPAddressesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (result PublicIPAddressesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -97,15 +98,17 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPAddressesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -123,8 +126,9 @@ func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Respons } // Delete deletes the specified public IP address. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the subnet. func (client PublicIPAddressesClient) Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (result PublicIPAddressesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, publicIPAddressName) if err != nil { @@ -165,15 +169,17 @@ func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resour // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (future PublicIPAddressesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -190,9 +196,10 @@ func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (resu } // Get gets the specified public IP address in a specified resource group. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet. expand is -// expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the subnet. +// expand - expands referenced resources. func (client PublicIPAddressesClient) Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, publicIPAddressName, expand) if err != nil { @@ -260,11 +267,14 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result } // GetVirtualMachineScaleSetPublicIPAddress get the specified public IP address in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the -// network interface. IPConfigurationName is the name of the IP configuration. publicIPAddressName is the name of -// the public IP Address. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the IP configuration. +// publicIPAddressName - the name of the public IP Address. +// expand - expands referenced resources. func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) if err != nil { @@ -336,8 +346,8 @@ func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressRe } // List gets all public IP addresses in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client PublicIPAddressesClient) List(ctx context.Context, resourceGroupName string) (result PublicIPAddressListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -520,9 +530,9 @@ func (client PublicIPAddressesClient) ListAllComplete(ctx context.Context) (resu // ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine // scale set level. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultPage, err error) { result.fn = client.listVirtualMachineScaleSetPublicIPAddressesNextResults req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) @@ -616,10 +626,12 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse // ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP // configuration in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual -// machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the network -// interface name. IPConfigurationName is the IP configuration name. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the network interface name. +// IPConfigurationName - the IP configuration name. func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) { result.fn = client.listVirtualMachineScaleSetVMPublicIPAddressesNextResults req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) @@ -715,9 +727,10 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddres } // UpdateTags updates public IP address tags. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the public IP address. -// parameters is parameters supplied to update public IP address tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +// parameters - parameters supplied to update public IP address tags. func (client PublicIPAddressesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject) (result PublicIPAddressesUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, publicIPAddressName, parameters) if err != nil { @@ -760,15 +773,17 @@ func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, re // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) UpdateTagsSender(req *http.Request) (future PublicIPAddressesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilterrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilterrules.go index 0f69934c4..42afb6949 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilterrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilterrules.go @@ -41,10 +41,11 @@ func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string) } // CreateOrUpdate creates or updates a route in the specified route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName -// is the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the create or update -// route filter rule operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the route filter rule. +// routeFilterRuleParameters - parameters supplied to the create or update route filter rule operation. func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (result RouteFilterRulesCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: routeFilterRuleParameters, @@ -97,15 +98,17 @@ func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (future RouteFilterRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -123,9 +126,10 @@ func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response } // Delete deletes the specified rule from a route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName -// is the name of the rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the rule. func (client RouteFilterRulesClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName, ruleName) if err != nil { @@ -167,15 +171,17 @@ func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourc // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (future RouteFilterRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -192,9 +198,10 @@ func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (resul } // Get gets the specified rule from a route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName -// is the name of the rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the rule. func (client RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, ruleName) if err != nil { @@ -260,8 +267,9 @@ func (client RouteFilterRulesClient) GetResponder(resp *http.Response) (result R } // ListByRouteFilter gets all RouteFilterRules in a route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. func (client RouteFilterRulesClient) ListByRouteFilter(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResultPage, err error) { result.fn = client.listByRouteFilterNextResults req, err := client.ListByRouteFilterPreparer(ctx, resourceGroupName, routeFilterName) @@ -354,10 +362,11 @@ func (client RouteFilterRulesClient) ListByRouteFilterComplete(ctx context.Conte } // Update updates a route in the specified route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName -// is the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the update route -// filter rule operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the route filter rule. +// routeFilterRuleParameters - parameters supplied to the update route filter rule operation. func (client RouteFilterRulesClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule) (result RouteFilterRulesUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters) if err != nil { @@ -401,15 +410,17 @@ func (client RouteFilterRulesClient) UpdatePreparer(ctx context.Context, resourc // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (future RouteFilterRulesUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilters.go index de9d41c34..f2df3875e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routefilters.go @@ -40,9 +40,10 @@ func NewRouteFiltersClientWithBaseURI(baseURI string, subscriptionID string) Rou } // CreateOrUpdate creates or updates a route filter in a specified resource group. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. -// routeFilterParameters is parameters supplied to the create or update route filter operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// routeFilterParameters - parameters supplied to the create or update route filter operation. func (client RouteFiltersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter) (result RouteFiltersCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, routeFilterParameters) if err != nil { @@ -85,15 +86,17 @@ func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, res // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (future RouteFiltersCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client RouteFiltersClient) CreateOrUpdateResponder(resp *http.Response) (r } // Delete deletes the specified route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. func (client RouteFiltersClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFiltersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName) if err != nil { @@ -153,15 +157,17 @@ func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGro // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) DeleteSender(req *http.Request) (future RouteFiltersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -178,9 +184,10 @@ func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result au } // Get gets the specified route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. expand is -// expands referenced express route bgp peering resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// expand - expands referenced express route bgp peering resources. func (client RouteFiltersClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, expand) if err != nil { @@ -338,8 +345,8 @@ func (client RouteFiltersClient) ListComplete(ctx context.Context) (result Route } // ListByResourceGroup gets all route filters in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client RouteFiltersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RouteFilterListResultPage, err error) { result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) @@ -431,9 +438,10 @@ func (client RouteFiltersClient) ListByResourceGroupComplete(ctx context.Context } // Update updates a route filter in a specified resource group. -// -// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. -// routeFilterParameters is parameters supplied to the update route filter operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// routeFilterParameters - parameters supplied to the update route filter operation. func (client RouteFiltersClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter) (result RouteFiltersUpdateFuture, err error) { req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, routeFilterParameters) if err != nil { @@ -476,15 +484,17 @@ func (client RouteFiltersClient) UpdatePreparer(ctx context.Context, resourceGro // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client RouteFiltersClient) UpdateSender(req *http.Request) (future RouteFiltersUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routes.go index 25ddbb5e3..9a716de45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routes.go @@ -40,9 +40,11 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli } // CreateOrUpdate creates or updates a route in the specified route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is -// the name of the route. routeParameters is parameters supplied to the create or update route operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. +// routeParameters - parameters supplied to the create or update route operation. func (client RoutesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result RoutesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, routeName, routeParameters) if err != nil { @@ -86,15 +88,17 @@ func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (future RoutesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -112,9 +116,10 @@ func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result } // Delete deletes the specified route from a route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is -// the name of the route. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result RoutesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName, routeName) if err != nil { @@ -156,15 +161,17 @@ func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -181,9 +188,10 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest } // Get gets the specified route from a route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is -// the name of the route. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, routeName) if err != nil { @@ -249,8 +257,9 @@ func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err } // List gets all routes in a route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. func (client RoutesClient) List(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, routeTableName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routetables.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routetables.go index 371200926..21f30e9c9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routetables.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/routetables.go @@ -40,9 +40,10 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout } // CreateOrUpdate create or updates a route table in a specified resource group. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters -// is parameters supplied to the create or update route table operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// parameters - parameters supplied to the create or update route table operation. func (client RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTablesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, reso // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (future RouteTablesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,8 +114,9 @@ func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (re } // Delete deletes the specified route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. func (client RouteTablesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteTablesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName) if err != nil { @@ -153,15 +157,17 @@ func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGrou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) DeleteSender(req *http.Request) (future RouteTablesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -178,9 +184,10 @@ func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result aut } // Get gets the specified route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. expand is -// expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// expand - expands referenced resources. func (client RouteTablesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, expand) if err != nil { @@ -248,8 +255,8 @@ func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteT } // List gets all route tables in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client RouteTablesClient) List(ctx context.Context, resourceGroupName string) (result RouteTableListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -431,9 +438,10 @@ func (client RouteTablesClient) ListAllComplete(ctx context.Context) (result Rou } // UpdateTags updates a route table tags. -// -// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters -// is parameters supplied to update route table tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// parameters - parameters supplied to update route table tags. func (client RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (result RouteTablesUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeTableName, parameters) if err != nil { @@ -476,15 +484,17 @@ func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resource // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) UpdateTagsSender(req *http.Request) (future RouteTablesUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securitygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securitygroups.go index e51ec0c93..0c6d7f78e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securitygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securitygroups.go @@ -40,9 +40,10 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S } // CreateOrUpdate creates or updates a network security group in the specified resource group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. parameters is parameters supplied to the create or update network security group operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// parameters - parameters supplied to the create or update network security group operation. func (client SecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroupsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) if err != nil { @@ -85,15 +86,17 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future SecurityGroupsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -111,9 +114,9 @@ func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) } // Delete deletes the specified network security group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName) if err != nil { @@ -154,15 +157,17 @@ func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) DeleteSender(req *http.Request) (future SecurityGroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -179,9 +184,10 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result } // Get gets the specified network security group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// expand - expands referenced resources. func (client SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, expand) if err != nil { @@ -249,8 +255,8 @@ func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result Sec } // List gets all network security groups in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client SecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result SecurityGroupListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -432,9 +438,10 @@ func (client SecurityGroupsClient) ListAllComplete(ctx context.Context) (result } // UpdateTags updates a network security group tags. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. parameters is parameters supplied to update network security group tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// parameters - parameters supplied to update network security group tags. func (client SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (result SecurityGroupsUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) if err != nil { @@ -477,15 +484,17 @@ func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resou // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) UpdateTagsSender(req *http.Request) (future SecurityGroupsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securityrules.go index 50b60b9dc..942c34def 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/securityrules.go @@ -40,10 +40,11 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se } // CreateOrUpdate creates or updates a security rule in the specified network security group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. securityRuleName is the name of the security rule. securityRuleParameters is parameters supplied -// to the create or update network security rule operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. +// securityRuleParameters - parameters supplied to the create or update network security rule operation. func (client SecurityRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRulesCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters) if err != nil { @@ -87,15 +88,17 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (future SecurityRulesCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +116,10 @@ func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) ( } // Delete deletes the specified network security rule. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. securityRuleName is the name of the security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. func (client SecurityRulesClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRulesDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) if err != nil { @@ -157,15 +161,17 @@ func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) DeleteSender(req *http.Request) (future SecurityRulesDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -182,9 +188,10 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a } // Get get the specified network security rule. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. securityRuleName is the name of the security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. func (client SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) if err != nil { @@ -250,9 +257,9 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu } // List gets all security rules in a network security group. -// -// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network -// security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. func (client SecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/subnets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/subnets.go index fd7a17bc9..b288b8ba8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/subnets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/subnets.go @@ -40,10 +40,11 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC } // CreateOrUpdate creates or updates a subnet in the specified virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// subnetName is the name of the subnet. subnetParameters is parameters supplied to the create or update subnet -// operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// subnetParameters - parameters supplied to the create or update subnet operation. func (client SubnetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (result SubnetsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters) if err != nil { @@ -87,15 +88,17 @@ func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resource // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (future SubnetsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +116,10 @@ func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result } // Delete deletes the specified subnet. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// subnetName is the name of the subnet. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. func (client SubnetsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result SubnetsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName) if err != nil { @@ -157,15 +161,17 @@ func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) DeleteSender(req *http.Request) (future SubnetsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -182,9 +188,11 @@ func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autores } // Get gets the specified subnet by virtual network and resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// subnetName is the name of the subnet. expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// expand - expands referenced resources. func (client SubnetsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, expand) if err != nil { @@ -253,8 +261,9 @@ func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, er } // List gets all subnets in a virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. func (client SubnetsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result SubnetListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/usages.go index da22b0d62..96b8efdd2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/usages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/usages.go @@ -41,8 +41,8 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli } // List list network usages for a subscription. -// -// location is the location where resource usage is queried. +// Parameters: +// location - the location where resource usage is queried. func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: location, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgatewayconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgatewayconnections.go index ce5e4ba54..d7a1d50a6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgatewayconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgatewayconnections.go @@ -42,10 +42,10 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr } // CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the -// virtual network gateway connection. parameters is parameters supplied to the create or update virtual network -// gateway connection operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +// parameters - parameters supplied to the create or update virtual network gateway connection operation. func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -101,15 +101,17 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -127,9 +129,9 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(res } // Delete deletes the specified virtual network Gateway connection. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the -// virtual network gateway connection. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) if err != nil { @@ -170,15 +172,17 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -195,9 +199,9 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http. } // Get gets the specified virtual network gateway connection by resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the -// virtual network gateway connection. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) if err != nil { @@ -263,9 +267,9 @@ func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Res // GetSharedKey the Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified // virtual network gateway connection shared key through Network resource provider. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network -// gateway connection shared key name. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection shared key name. func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { req, err := client.GetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) if err != nil { @@ -331,8 +335,8 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp // List the List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections // created. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client VirtualNetworkGatewayConnectionsClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -426,10 +430,11 @@ func (client VirtualNetworkGatewayConnectionsClient) ListComplete(ctx context.Co // ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway // connection shared key for passed virtual network gateway connection in the specified resource group through Network // resource provider. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network -// gateway connection reset shared key Name. parameters is parameters supplied to the begin reset virtual network -// gateway connection shared key operation through network resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection reset shared key Name. +// parameters - parameters supplied to the begin reset virtual network gateway connection shared key operation +// through network resource provider. func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (result VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -481,15 +486,17 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx // ResetSharedKeySender sends the ResetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -509,10 +516,11 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(res // SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection // shared key for passed virtual network gateway connection in the specified resource group through Network resource // provider. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network -// gateway connection name. parameters is parameters supplied to the Begin Set Virtual Network Gateway connection -// Shared key operation throughNetwork resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection name. +// parameters - parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation +// throughNetwork resource provider. func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (result VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -561,15 +569,17 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx co // SetSharedKeySender sends the SetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -587,10 +597,10 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp } // UpdateTags updates a virtual network gateway connection tags. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the -// virtual network gateway connection. parameters is parameters supplied to update virtual network gateway -// connection tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +// parameters - parameters supplied to update virtual network gateway connection tags. func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) if err != nil { @@ -633,15 +643,17 @@ func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx cont // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgateways.go index e6f529514..aa314cddf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkgateways.go @@ -41,9 +41,10 @@ func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID s } // CreateOrUpdate creates or updates a virtual network gateway in the specified resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. parameters is parameters supplied to create or update virtual network gateway operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to create or update virtual network gateway operation. func (client VirtualNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -92,15 +93,17 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Co // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -118,9 +121,9 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Re } // Delete deletes the specified virtual network gateway. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayName) if err != nil { @@ -161,15 +164,17 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, r // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -187,10 +192,10 @@ func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) // Generatevpnclientpackage generates VPN client package for P2S client of the virtual network gateway in the specified // resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. parameters is parameters supplied to the generate virtual network gateway VPN client package -// operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to the generate virtual network gateway VPN client package operation. func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { req, err := client.GeneratevpnclientpackagePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) if err != nil { @@ -233,15 +238,17 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx // GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -260,10 +267,10 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(res // GenerateVpnProfile generates VPN profile for P2S client of the virtual network gateway in the specified resource // group. Used for IKEV2 and radius based authentication. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. parameters is parameters supplied to the generate virtual network gateway VPN client package -// operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to the generate virtual network gateway VPN client package operation. func (client VirtualNetworkGatewaysClient) GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) { req, err := client.GenerateVpnProfilePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) if err != nil { @@ -306,15 +313,17 @@ func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx contex // GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -332,9 +341,9 @@ func (client VirtualNetworkGatewaysClient) GenerateVpnProfileResponder(resp *htt } // Get gets the specified virtual network gateway by resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) if err != nil { @@ -400,9 +409,10 @@ func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (re // GetAdvertisedRoutes this operation retrieves a list of routes the virtual network gateway is advertising to the // specified peer. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. peer is the IP address of the peer +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// peer - the IP address of the peer func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) { req, err := client.GetAdvertisedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer) if err != nil { @@ -444,15 +454,17 @@ func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx conte // GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -470,9 +482,10 @@ func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *ht } // GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all BGP peers. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. peer is the IP address of the peer to retrieve the status of. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// peer - the IP address of the peer to retrieve the status of. func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) { req, err := client.GetBgpPeerStatusPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer) if err != nil { @@ -516,15 +529,17 @@ func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context. // GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (future VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -543,9 +558,9 @@ func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http. // GetLearnedRoutes this operation retrieves a list of routes the virtual network gateway has learned, including routes // learned from BGP peers. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) { req, err := client.GetLearnedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) if err != nil { @@ -586,15 +601,17 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context. // GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -613,9 +630,9 @@ func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http. // GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the // specified resource group. The profile needs to be generated first using generateVpnProfile. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { req, err := client.GetVpnProfilePackageURLPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) if err != nil { @@ -656,15 +673,17 @@ func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx c // GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -682,8 +701,8 @@ func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLResponder(resp } // List gets all virtual network gateways by resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client VirtualNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -775,9 +794,9 @@ func (client VirtualNetworkGatewaysClient) ListComplete(ctx context.Context, res } // ListConnections gets all the connections in a virtual network gateway. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultPage, err error) { result.fn = client.listConnectionsNextResults req, err := client.ListConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) @@ -870,10 +889,11 @@ func (client VirtualNetworkGatewaysClient) ListConnectionsComplete(ctx context.C } // Reset resets the primary of the virtual network gateway in the specified resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. gatewayVip is virtual network gateway vip address supplied to the begin reset of the -// active-active feature enabled gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// gatewayVip - virtual network gateway vip address supplied to the begin reset of the active-active feature +// enabled gateway. func (client VirtualNetworkGatewaysClient) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result VirtualNetworkGatewaysResetFuture, err error) { req, err := client.ResetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, gatewayVip) if err != nil { @@ -917,15 +937,17 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, re // ResetSender sends the Reset request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -943,9 +965,9 @@ func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) ( } // SupportedVpnDevices gets a xml format representation for supported vpn devices. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. func (client VirtualNetworkGatewaysClient) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result String, err error) { req, err := client.SupportedVpnDevicesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) if err != nil { @@ -1010,9 +1032,10 @@ func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesResponder(resp *ht } // UpdateTags updates a virtual network gateway tags. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayName is the name of the virtual -// network gateway. parameters is parameters supplied to update virtual network gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to update virtual network gateway tags. func (client VirtualNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (result VirtualNetworkGatewaysUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) if err != nil { @@ -1055,15 +1078,17 @@ func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Contex // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1081,10 +1106,11 @@ func (client VirtualNetworkGatewaysClient) UpdateTagsResponder(resp *http.Respon } // VpnDeviceConfigurationScript gets a xml format representation for vpn device configuration script. -// -// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the -// virtual network gateway connection for which the configuration script is generated. parameters is parameters -// supplied to the generate vpn device script operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection for which the +// configuration script is generated. +// parameters - parameters supplied to the generate vpn device script operation. func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (result String, err error) { req, err := client.VpnDeviceConfigurationScriptPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkpeerings.go index ee5dcd2db..8b6b0765d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworkpeerings.go @@ -40,10 +40,12 @@ func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID s } // CreateOrUpdate creates or updates a peering in the specified virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// virtualNetworkPeeringName is the name of the peering. virtualNetworkPeeringParameters is parameters supplied to -// the create or update virtual network peering operation. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the peering. +// virtualNetworkPeeringParameters - parameters supplied to the create or update virtual network peering +// operation. func (client VirtualNetworkPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering) (result VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters) if err != nil { @@ -87,15 +89,17 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Co // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -113,9 +117,10 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Re } // Delete deletes the specified virtual network peering. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// virtualNetworkPeeringName is the name of the virtual network peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the virtual network peering. func (client VirtualNetworkPeeringsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeeringsDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) if err != nil { @@ -157,15 +162,17 @@ func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, r // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (future VirtualNetworkPeeringsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -182,9 +189,10 @@ func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response) } // Get gets the specified virtual network peering. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// virtualNetworkPeeringName is the name of the virtual network peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the virtual network peering. func (client VirtualNetworkPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) if err != nil { @@ -250,8 +258,9 @@ func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (re } // List gets all virtual network peerings in a virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. func (client VirtualNetworkPeeringsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworks.go index 8f947161b..261bdb40d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/virtualnetworks.go @@ -40,9 +40,10 @@ func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) } // CheckIPAddressAvailability checks whether a private IP address is available for use. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// IPAddress is the private IP address to be verified. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// IPAddress - the private IP address to be verified. func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress) if err != nil { @@ -110,9 +111,10 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *ht } // CreateOrUpdate creates or updates a virtual network in the specified resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// parameters is parameters supplied to the create or update virtual network operation +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to the create or update virtual network operation func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, parameters) if err != nil { @@ -155,15 +157,17 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -181,8 +185,9 @@ func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) } // Delete deletes the specified virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworksDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName) if err != nil { @@ -223,15 +228,17 @@ func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resource // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -248,9 +255,10 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result } // Get gets the specified virtual network by resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// expand is expands referenced resources. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// expand - expands referenced resources. func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand) if err != nil { @@ -318,8 +326,8 @@ func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result Vi } // List gets all virtual networks in a resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, resourceGroupName) @@ -501,8 +509,9 @@ func (client VirtualNetworksClient) ListAllComplete(ctx context.Context) (result } // ListUsage lists usage stats. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. func (client VirtualNetworksClient) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultPage, err error) { result.fn = client.listUsageNextResults req, err := client.ListUsagePreparer(ctx, resourceGroupName, virtualNetworkName) @@ -595,9 +604,10 @@ func (client VirtualNetworksClient) ListUsageComplete(ctx context.Context, resou } // UpdateTags updates a virtual network tags. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. -// parameters is parameters supplied to update virtual network tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to update virtual network tags. func (client VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (result VirtualNetworksUpdateTagsFuture, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkName, parameters) if err != nil { @@ -640,15 +650,17 @@ func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, reso // UpdateTagsSender sends the UpdateTags request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) UpdateTagsSender(req *http.Request) (future VirtualNetworksUpdateTagsFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/watchers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/watchers.go index 1d5f6decb..877534e4e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/watchers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/watchers.go @@ -42,9 +42,10 @@ func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) Watcher // CheckConnectivity verifies the possibility of establishing a direct TCP connection from a virtual machine to a given // endpoint including another VM or an arbitrary remote server. -// -// resourceGroupName is the name of the network watcher resource group. networkWatcherName is the name of the -// network watcher resource. parameters is parameters that determine how the connectivity check will be performed. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that determine how the connectivity check will be performed. func (client WatchersClient) CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (result WatchersCheckConnectivityFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -95,15 +96,17 @@ func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, reso // CheckConnectivitySender sends the CheckConnectivity request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) CheckConnectivitySender(req *http.Request) (future WatchersCheckConnectivityFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -121,9 +124,10 @@ func (client WatchersClient) CheckConnectivityResponder(resp *http.Response) (re } // CreateOrUpdate creates or updates a network watcher in the specified resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters that define the network watcher resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the network watcher resource. func (client WatchersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, parameters) if err != nil { @@ -190,8 +194,9 @@ func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (resul } // Delete deletes the specified network watcher resource. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. func (client WatchersClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result WatchersDeleteFuture, err error) { req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName) if err != nil { @@ -232,15 +237,17 @@ func (client WatchersClient) DeletePreparer(ctx context.Context, resourceGroupNa // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) DeleteSender(req *http.Request) (future WatchersDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -257,8 +264,9 @@ func (client WatchersClient) DeleteResponder(resp *http.Response) (result autore } // Get gets the specified network watcher by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. func (client WatchersClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result Watcher, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName) if err != nil { @@ -324,9 +332,10 @@ func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, // GetAzureReachabilityReport gets the relative latency score for internet service providers from a specified location // to Azure regions. -// -// resourceGroupName is the name of the network watcher resource group. networkWatcherName is the name of the -// network watcher resource. parameters is parameters that determine Azure reachability report configuration. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that determine Azure reachability report configuration. func (client WatchersClient) GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (result WatchersGetAzureReachabilityReportFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -378,15 +387,17 @@ func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Cont // GetAzureReachabilityReportSender sends the GetAzureReachabilityReport request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetAzureReachabilityReportSender(req *http.Request) (future WatchersGetAzureReachabilityReportFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -404,10 +415,10 @@ func (client WatchersClient) GetAzureReachabilityReportResponder(resp *http.Resp } // GetFlowLogStatus queries status of flow log and traffic analytics (optional) on a specified resource. -// -// resourceGroupName is the name of the network watcher resource group. networkWatcherName is the name of the -// network watcher resource. parameters is parameters that define a resource to query flow log and traffic -// analytics (optional) status. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define a resource to query flow log and traffic analytics (optional) status. func (client WatchersClient) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (result WatchersGetFlowLogStatusFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -456,15 +467,17 @@ func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resou // GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (future WatchersGetFlowLogStatusFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -482,9 +495,10 @@ func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (res } // GetNextHop gets the next hop from the specified VM. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters that define the source and destination endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the source and destination endpoint. func (client WatchersClient) GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (result WatchersGetNextHopFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -535,15 +549,17 @@ func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGro // GetNextHopSender sends the GetNextHop request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetNextHopSender(req *http.Request) (future WatchersGetNextHopFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -561,9 +577,10 @@ func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result Ne } // GetTopology gets the current network topology by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters that define the representation of topology. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the representation of topology. func (client WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { req, err := client.GetTopologyPreparer(ctx, resourceGroupName, networkWatcherName, parameters) if err != nil { @@ -630,9 +647,10 @@ func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result T } // GetTroubleshooting initiate troubleshooting on a specified resource -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher -// resource. parameters is parameters that define the resource to troubleshoot. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the resource to troubleshoot. func (client WatchersClient) GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (result WatchersGetTroubleshootingFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -685,15 +703,17 @@ func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, res // GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (future WatchersGetTroubleshootingFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -711,9 +731,10 @@ func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (r } // GetTroubleshootingResult get the last completed troubleshooting result on a specified resource -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher -// resource. parameters is parameters that define the resource to query the troubleshooting result. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the resource to query the troubleshooting result. func (client WatchersClient) GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (result WatchersGetTroubleshootingResultFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -762,15 +783,17 @@ func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Contex // GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (future WatchersGetTroubleshootingResultFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -788,9 +811,10 @@ func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Respon } // GetVMSecurityRules gets the configured and effective security group rules on the specified VM. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters that define the VM to check security groups for. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the VM to check security groups for. func (client WatchersClient) GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (result WatchersGetVMSecurityRulesFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -839,15 +863,17 @@ func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, res // GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (future WatchersGetVMSecurityRulesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -865,8 +891,8 @@ func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (r } // List gets all network watchers by resource group. -// -// resourceGroupName is the name of the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. func (client WatchersClient) List(ctx context.Context, resourceGroupName string) (result WatcherListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName) if err != nil { @@ -992,9 +1018,10 @@ func (client WatchersClient) ListAllResponder(resp *http.Response) (result Watch } // ListAvailableProviders lists all available internet service providers for a specified Azure region. -// -// resourceGroupName is the name of the network watcher resource group. networkWatcherName is the name of the -// network watcher resource. parameters is parameters that scope the list of available providers. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that scope the list of available providers. func (client WatchersClient) ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (result WatchersListAvailableProvidersFuture, err error) { req, err := client.ListAvailableProvidersPreparer(ctx, resourceGroupName, networkWatcherName, parameters) if err != nil { @@ -1037,15 +1064,17 @@ func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, // ListAvailableProvidersSender sends the ListAvailableProviders request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) ListAvailableProvidersSender(req *http.Request) (future WatchersListAvailableProvidersFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1063,9 +1092,10 @@ func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response } // SetFlowLogConfiguration configures flow log and traffic analytics (optional) on a specified resource. -// -// resourceGroupName is the name of the network watcher resource group. networkWatcherName is the name of the -// network watcher resource. parameters is parameters that define the configuration of flow log. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the configuration of flow log. func (client WatchersClient) SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (result WatchersSetFlowLogConfigurationFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -1126,15 +1156,17 @@ func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context // SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (future WatchersSetFlowLogConfigurationFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1152,9 +1184,10 @@ func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Respons } // UpdateTags updates a network watcher tags. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters supplied to update network watcher tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters supplied to update network watcher tags. func (client WatchersClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (result Watcher, err error) { req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, parameters) if err != nil { @@ -1221,9 +1254,10 @@ func (client WatchersClient) UpdateTagsResponder(resp *http.Response) (result Wa } // VerifyIPFlow verify IP flow from the specified VM to a location given the currently configured NSG rules. -// -// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. -// parameters is parameters that define the IP flow to be verified. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the IP flow to be verified. func (client WatchersClient) VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (result WatchersVerifyIPFlowFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -1276,15 +1310,17 @@ func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceG // VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the // http.Response Body if it receives an error. func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (future WatchersVerifyIPFlowFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go index 33474add3..ecbd69126 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions/subscriptions.go @@ -42,8 +42,8 @@ func NewClientWithBaseURI(baseURI string) Client { } // Get gets details about a specified subscription. -// -// subscriptionID is the ID of the target subscription. +// Parameters: +// subscriptionID - the ID of the target subscription. func (client Client) Get(ctx context.Context, subscriptionID string) (result Subscription, err error) { req, err := client.GetPreparer(ctx, subscriptionID) if err != nil { @@ -193,8 +193,8 @@ func (client Client) ListComplete(ctx context.Context) (result ListResultIterato // ListLocations this operation provides all the locations that are available for resource providers; however, each // resource provider may support a subset of this list. -// -// subscriptionID is the ID of the target subscription. +// Parameters: +// subscriptionID - the ID of the target subscription. func (client Client) ListLocations(ctx context.Context, subscriptionID string) (result LocationListResult, err error) { req, err := client.ListLocationsPreparer(ctx, subscriptionID) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deploymentoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deploymentoperations.go index ce51ed3b2..4b0be23e8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deploymentoperations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deploymentoperations.go @@ -41,9 +41,10 @@ func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID str } // Get gets a deployments operation. -// -// resourceGroupName is the name of the resource group. The name is case insensitive. deploymentName is the name of -// the deployment. operationID is the ID of the operation to get. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment. +// operationID - the ID of the operation to get. func (client DeploymentOperationsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -121,9 +122,10 @@ func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (resu } // List gets all deployments operations for a deployment. -// -// resourceGroupName is the name of the resource group. The name is case insensitive. deploymentName is the name of -// the deployment with the operation to get. top is the number of results to return. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment with the operation to get. +// top - the number of results to return. func (client DeploymentOperationsClient) List(ctx context.Context, resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deployments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deployments.go index 290619838..886129be8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deployments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/deployments.go @@ -43,9 +43,9 @@ func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) Depl // Cancel you can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is // canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running // template deployment and leaves the resource group partially deployed. -// -// resourceGroupName is the name of the resource group. The name is case insensitive. deploymentName is the name of -// the deployment to cancel. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment to cancel. func (client DeploymentsClient) Cancel(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -121,9 +121,10 @@ func (client DeploymentsClient) CancelResponder(resp *http.Response) (result aut } // CheckExistence checks whether the deployment exists. -// -// resourceGroupName is the name of the resource group with the deployment to check. The name is case insensitive. -// deploymentName is the name of the deployment to check. +// Parameters: +// resourceGroupName - the name of the resource group with the deployment to check. The name is case +// insensitive. +// deploymentName - the name of the deployment to check. func (client DeploymentsClient) CheckExistence(ctx context.Context, resourceGroupName string, deploymentName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -199,10 +200,11 @@ func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (re } // CreateOrUpdate you can provide the template and parameters directly in the request or link to JSON files. -// -// resourceGroupName is the name of the resource group to deploy the resources to. The name is case insensitive. -// The resource group must already exist. deploymentName is the name of the deployment. parameters is additional -// parameters supplied to the operation. +// Parameters: +// resourceGroupName - the name of the resource group to deploy the resources to. The name is case insensitive. +// The resource group must already exist. +// deploymentName - the name of the deployment. +// parameters - additional parameters supplied to the operation. func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -264,15 +266,17 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, reso // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -296,9 +300,10 @@ func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (re // process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the // URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the // Location header returns an error-level status code. -// -// resourceGroupName is the name of the resource group with the deployment to delete. The name is case insensitive. -// deploymentName is the name of the deployment to delete. +// Parameters: +// resourceGroupName - the name of the resource group with the deployment to delete. The name is case +// insensitive. +// deploymentName - the name of the deployment to delete. func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -351,15 +356,17 @@ func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGrou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -376,9 +383,9 @@ func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result aut } // ExportTemplate exports the template used for specified deployment. -// -// resourceGroupName is the name of the resource group. The name is case insensitive. deploymentName is the name of -// the deployment from which to get the template. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment from which to get the template. func (client DeploymentsClient) ExportTemplate(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -455,9 +462,9 @@ func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (re } // Get gets a deployment. -// -// resourceGroupName is the name of the resource group. The name is case insensitive. deploymentName is the name of -// the deployment to get. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// deploymentName - the name of the deployment to get. func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -534,10 +541,12 @@ func (client DeploymentsClient) GetResponder(resp *http.Response) (result Deploy } // ListByResourceGroup get all the deployments for a resource group. -// -// resourceGroupName is the name of the resource group with the deployments to get. The name is case insensitive. -// filter is the filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. -// top is the number of results to get. If null is passed, returns all deployments. +// Parameters: +// resourceGroupName - the name of the resource group with the deployments to get. The name is case +// insensitive. +// filter - the filter to apply on the operation. For example, you can use $filter=provisioningState eq +// '{state}'. +// top - the number of results to get. If null is passed, returns all deployments. func (client DeploymentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DeploymentListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -644,9 +653,11 @@ func (client DeploymentsClient) ListByResourceGroupComplete(ctx context.Context, // Validate validates whether the specified template is syntactically correct and will be accepted by Azure Resource // Manager.. -// -// resourceGroupName is the name of the resource group the template will be deployed to. The name is case -// insensitive. deploymentName is the name of the deployment. parameters is parameters to validate. +// Parameters: +// resourceGroupName - the name of the resource group the template will be deployed to. The name is case +// insensitive. +// deploymentName - the name of the deployment. +// parameters - parameters to validate. func (client DeploymentsClient) Validate(ctx context.Context, resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/groups.go index d1fd7dda7..1b24ebcbf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/groups.go @@ -41,8 +41,8 @@ func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsCli } // CheckExistence checks whether a resource group exists. -// -// resourceGroupName is the name of the resource group to check. The name is case insensitive. +// Parameters: +// resourceGroupName - the name of the resource group to check. The name is case insensitive. func (client GroupsClient) CheckExistence(ctx context.Context, resourceGroupName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -113,9 +113,9 @@ func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result } // CreateOrUpdate creates or updates a resource group. -// -// resourceGroupName is the name of the resource group to create or update. parameters is parameters supplied to -// the create or update a resource group. +// Parameters: +// resourceGroupName - the name of the resource group to create or update. +// parameters - parameters supplied to the create or update a resource group. func (client GroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters Group) (result Group, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -192,8 +192,8 @@ func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result // Delete when you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes // all of its template deployments and currently stored operations. -// -// resourceGroupName is the name of the resource group to delete. The name is case insensitive. +// Parameters: +// resourceGroupName - the name of the resource group to delete. The name is case insensitive. func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string) (result GroupsDeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -241,15 +241,17 @@ func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -266,9 +268,9 @@ func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest } // ExportTemplate captures the specified resource group as a template. -// -// resourceGroupName is the name of the resource group to export as a template. parameters is parameters for -// exporting the template. +// Parameters: +// resourceGroupName - the name of the resource group to export as a template. +// parameters - parameters for exporting the template. func (client GroupsClient) ExportTemplate(ctx context.Context, resourceGroupName string, parameters ExportTemplateRequest) (result GroupExportResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -342,8 +344,8 @@ func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result } // Get gets a resource group. -// -// resourceGroupName is the name of the resource group to get. The name is case insensitive. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. func (client GroupsClient) Get(ctx context.Context, resourceGroupName string) (result Group, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -415,9 +417,9 @@ func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err } // List gets all the resource groups for a subscription. -// -// filter is the filter to apply on the operation. top is the number of results to return. If null is passed, -// returns all resource groups. +// Parameters: +// filter - the filter to apply on the operation. +// top - the number of results to return. If null is passed, returns all resource groups. func (client GroupsClient) List(ctx context.Context, filter string, top *int32) (result GroupListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, top) @@ -515,9 +517,9 @@ func (client GroupsClient) ListComplete(ctx context.Context, filter string, top // Update resource groups can be updated through a simple PATCH operation to a group address. The format of the request // is the same as that for creating a resource group. If a field is unspecified, the current value is retained. -// -// resourceGroupName is the name of the resource group to update. The name is case insensitive. parameters is -// parameters supplied to update a resource group. +// Parameters: +// resourceGroupName - the name of the resource group to update. The name is case insensitive. +// parameters - parameters supplied to update a resource group. func (client GroupsClient) Update(ctx context.Context, resourceGroupName string, parameters GroupPatchable) (result Group, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/models.go index 334f2866d..44e1b6102 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/models.go @@ -104,12 +104,11 @@ type BasicDependency struct { // CreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CreateOrUpdateByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { +func (future *CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -117,34 +116,15 @@ func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.CreateOrUpdateByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateByIDResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.CreateOrUpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateByIDFuture", "Result", resp, "Failure responding to request") } return } @@ -152,12 +132,11 @@ func (future CreateOrUpdateByIDFuture) Result(client Client) (gr GenericResource // CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type CreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future CreateOrUpdateFuture) Result(client Client) (gr GenericResource, err error) { +func (future *CreateOrUpdateFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -165,34 +144,15 @@ func (future CreateOrUpdateFuture) Result(client Client) (gr GenericResource, er return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.CreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.CreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -206,12 +166,11 @@ type DebugSetting struct { // DeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeleteByIDFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *DeleteByIDFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -219,47 +178,21 @@ func (future DeleteByIDFuture) Result(client Client) (ar autorest.Response, err return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeleteByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteByIDFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } // DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeleteFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *DeleteFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -267,35 +200,10 @@ func (future DeleteFuture) Result(client Client) (ar autorest.Response, err erro return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -628,12 +536,11 @@ type DeploymentPropertiesExtended struct { // operation. type DeploymentsCreateOrUpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) { +func (future *DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) (de DeploymentExtended, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -641,34 +548,15 @@ func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) ( return } if !done { - return de, azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - de, err = client.CreateOrUpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsCreateOrUpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateResponder(de.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", resp, "Failure sending request") - return - } - de, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsCreateOrUpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -676,12 +564,11 @@ func (future DeploymentsCreateOrUpdateFuture) Result(client DeploymentsClient) ( // DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type DeploymentsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { +func (future *DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -689,35 +576,10 @@ func (future DeploymentsDeleteFuture) Result(client DeploymentsClient) (ar autor return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.DeploymentsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -1009,12 +871,11 @@ type GroupProperties struct { // GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. type GroupsDeleteFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) { +func (future *GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1022,35 +883,10 @@ func (future GroupsDeleteFuture) Result(client GroupsClient) (ar autorest.Respon return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.DeleteResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.GroupsDeleteFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsDeleteFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -1195,12 +1031,11 @@ type MoveInfo struct { // MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running operation. type MoveResourcesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *MoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1208,35 +1043,10 @@ func (future MoveResourcesFuture) Result(client Client) (ar autorest.Response, e return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.MoveResourcesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.MoveResourcesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.MoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.MoveResourcesFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } @@ -1656,12 +1466,11 @@ type TemplateLink struct { // UpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation. type UpdateByIDFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { +func (future *UpdateByIDFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1669,34 +1478,15 @@ func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err er return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.UpdateByIDResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.UpdateByIDFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateByIDResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.UpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateByIDFuture", "Result", resp, "Failure responding to request") } return } @@ -1704,12 +1494,11 @@ func (future UpdateByIDFuture) Result(client Client) (gr GenericResource, err er // UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type UpdateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) { +func (future *UpdateFuture) Result(client Client) (gr GenericResource, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1717,34 +1506,15 @@ func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) return } if !done { - return gr, azure.NewAsyncOpIncompleteError("resources.UpdateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - gr, err = client.UpdateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.UpdateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.UpdateResponder(gr.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", gr.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", resp, "Failure sending request") - return - } - gr, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.UpdateFuture", "Result", resp, "Failure responding to request") } return } @@ -1753,12 +1523,11 @@ func (future UpdateFuture) Result(client Client) (gr GenericResource, err error) // operation. type ValidateMoveResourcesFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { +func (future *ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Response, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -1766,34 +1535,9 @@ func (future ValidateMoveResourcesFuture) Result(client Client) (ar autorest.Res return } if !done { - return ar, azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") - } - if future.PollingMethod() == azure.PollingLocation { - ar, err = client.ValidateMoveResourcesResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("resources.ValidateMoveResourcesFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", resp, "Failure sending request") - return - } - ar, err = client.ValidateMoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ValidateMoveResourcesFuture", "Result", resp, "Failure responding to request") - } + ar.Response = future.Response() return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/providers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/providers.go index a0edd14f7..db8a647f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/providers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/providers.go @@ -40,9 +40,10 @@ func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) Provid } // Get gets the specified resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider. expand is the $expand query parameter. For -// example, to include property aliases in response, use $expand=resourceTypes/aliases. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// expand - the $expand query parameter. For example, to include property aliases in response, use +// $expand=resourceTypes/aliases. func (client ProvidersClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result Provider, err error) { req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) if err != nil { @@ -109,10 +110,11 @@ func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider } // List gets all resource providers for a subscription. -// -// top is the number of results to return. If null is passed returns all deployments. expand is the properties to -// include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider -// metadata. To include property aliases in response, use $expand=resourceTypes/aliases. +// Parameters: +// top - the number of results to return. If null is passed returns all deployments. +// expand - the properties to include in the results. For example, use &$expand=metadata in the query string to +// retrieve resource provider metadata. To include property aliases in response, use +// $expand=resourceTypes/aliases. func (client ProvidersClient) List(ctx context.Context, top *int32, expand string) (result ProviderListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, top, expand) @@ -209,8 +211,8 @@ func (client ProvidersClient) ListComplete(ctx context.Context, top *int32, expa } // Register registers a subscription with a resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider to register. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to register. func (client ProvidersClient) Register(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { req, err := client.RegisterPreparer(ctx, resourceProviderNamespace) if err != nil { @@ -274,8 +276,8 @@ func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Pro } // Unregister unregisters a subscription from a resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider to unregister. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider to unregister. func (client ProvidersClient) Unregister(ctx context.Context, resourceProviderNamespace string) (result Provider, err error) { req, err := client.UnregisterPreparer(ctx, resourceProviderNamespace) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/resources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/resources.go index a993eead9..bc7e57190 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/resources.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/resources.go @@ -41,11 +41,13 @@ func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { } // CheckExistence checks whether a resource exists. -// -// resourceGroupName is the name of the resource group containing the resource to check. The name is case -// insensitive. resourceProviderNamespace is the resource provider of the resource to check. parentResourcePath is -// the parent resource identity. resourceType is the resource type. resourceName is the name of the resource to -// check whether it exists. +// Parameters: +// resourceGroupName - the name of the resource group containing the resource to check. The name is case +// insensitive. +// resourceProviderNamespace - the resource provider of the resource to check. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type. +// resourceName - the name of the resource to check whether it exists. func (client Client) CheckExistence(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -120,8 +122,8 @@ func (client Client) CheckExistenceResponder(resp *http.Response) (result autore } // CheckExistenceByID checks by ID whether a resource exists. -// -// resourceID is the fully qualified ID of the resource, including the resource name and resource type. Use the +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the // format, // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} func (client Client) CheckExistenceByID(ctx context.Context, resourceID string) (result autorest.Response, err error) { @@ -185,11 +187,13 @@ func (client Client) CheckExistenceByIDResponder(resp *http.Response) (result au } // CreateOrUpdate creates a resource. -// -// resourceGroupName is the name of the resource group for the resource. The name is case insensitive. -// resourceProviderNamespace is the namespace of the resource provider. parentResourcePath is the parent resource -// identity. resourceType is the resource type of the resource to create. resourceName is the name of the resource -// to create. parameters is parameters for creating or updating the resource. +// Parameters: +// resourceGroupName - the name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource to create. +// resourceName - the name of the resource to create. +// parameters - parameters for creating or updating the resource. func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource) (result CreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -246,15 +250,17 @@ func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupNa // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -272,11 +278,11 @@ func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Generi } // CreateOrUpdateByID create a resource by ID. -// -// resourceID is the fully qualified ID of the resource, including the resource name and resource type. Use the +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the // format, // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -// parameters is create or update resource parameters. +// parameters - create or update resource parameters. func (client Client) CreateOrUpdateByID(ctx context.Context, resourceID string, parameters GenericResource) (result CreateOrUpdateByIDFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -324,15 +330,17 @@ func (client Client) CreateOrUpdateByIDPreparer(ctx context.Context, resourceID // CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the // http.Response Body if it receives an error. func (client Client) CreateOrUpdateByIDSender(req *http.Request) (future CreateOrUpdateByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -350,10 +358,13 @@ func (client Client) CreateOrUpdateByIDResponder(resp *http.Response) (result Ge } // Delete deletes a resource. -// -// resourceGroupName is the name of the resource group that contains the resource to delete. The name is case -// insensitive. resourceProviderNamespace is the namespace of the resource provider. parentResourcePath is the -// parent resource identity. resourceType is the resource type. resourceName is the name of the resource to delete. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource to delete. The name is case +// insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type. +// resourceName - the name of the resource to delete. func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result DeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -405,15 +416,17 @@ func (client Client) DeletePreparer(ctx context.Context, resourceGroupName strin // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -430,8 +443,8 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo } // DeleteByID deletes a resource by ID. -// -// resourceID is the fully qualified ID of the resource, including the resource name and resource type. Use the +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the // format, // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} func (client Client) DeleteByID(ctx context.Context, resourceID string) (result DeleteByIDFuture, err error) { @@ -472,15 +485,17 @@ func (client Client) DeleteByIDPreparer(ctx context.Context, resourceID string) // DeleteByIDSender sends the DeleteByID request. The method will close the // http.Response Body if it receives an error. func (client Client) DeleteByIDSender(req *http.Request) (future DeleteByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -497,11 +512,13 @@ func (client Client) DeleteByIDResponder(resp *http.Response) (result autorest.R } // Get gets a resource. -// -// resourceGroupName is the name of the resource group containing the resource to get. The name is case -// insensitive. resourceProviderNamespace is the namespace of the resource provider. parentResourcePath is the -// parent resource identity. resourceType is the resource type of the resource. resourceName is the name of the -// resource to get. +// Parameters: +// resourceGroupName - the name of the resource group containing the resource to get. The name is case +// insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource. +// resourceName - the name of the resource to get. func (client Client) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -577,8 +594,8 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource, } // GetByID gets a resource by ID. -// -// resourceID is the fully qualified ID of the resource, including the resource name and resource type. Use the +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the // format, // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} func (client Client) GetByID(ctx context.Context, resourceID string) (result GenericResource, err error) { @@ -643,9 +660,10 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour } // List get all the resources in a subscription. -// -// filter is the filter to apply on the operation. expand is the $expand query parameter. top is the number of -// results to return. If null is passed, returns all resource groups. +// Parameters: +// filter - the filter to apply on the operation. +// expand - the $expand query parameter. +// top - the number of results to return. If null is passed, returns all resource groups. func (client Client) List(ctx context.Context, filter string, expand string, top *int32) (result ListResultPage, err error) { result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter, expand, top) @@ -745,10 +763,11 @@ func (client Client) ListComplete(ctx context.Context, filter string, expand str } // ListByResourceGroup get all the resources for a resource group. -// -// resourceGroupName is the resource group with the resources to get. filter is the filter to apply on the -// operation. expand is the $expand query parameter top is the number of results to return. If null is passed, -// returns all resources. +// Parameters: +// resourceGroupName - the resource group with the resources to get. +// filter - the filter to apply on the operation. +// expand - the $expand query parameter +// top - the number of results to return. If null is passed, returns all resources. func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, expand string, top *int32) (result ListResultPage, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -859,9 +878,9 @@ func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGr // MoveResources the resources to move must be in the same source resource group. The target resource group may be in a // different subscription. When moving resources, both the source group and the target group are locked for the // duration of the operation. Write and delete operations are blocked on the groups until the move completes. -// -// sourceResourceGroupName is the name of the resource group containing the resources to move. parameters is -// parameters for moving resources. +// Parameters: +// sourceResourceGroupName - the name of the resource group containing the resources to move. +// parameters - parameters for moving resources. func (client Client) MoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result MoveResourcesFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: sourceResourceGroupName, @@ -911,15 +930,17 @@ func (client Client) MoveResourcesPreparer(ctx context.Context, sourceResourceGr // MoveResourcesSender sends the MoveResources request. The method will close the // http.Response Body if it receives an error. func (client Client) MoveResourcesSender(req *http.Request) (future MoveResourcesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -936,11 +957,13 @@ func (client Client) MoveResourcesResponder(resp *http.Response) (result autores } // Update updates a resource. -// -// resourceGroupName is the name of the resource group for the resource. The name is case insensitive. -// resourceProviderNamespace is the namespace of the resource provider. parentResourcePath is the parent resource -// identity. resourceType is the resource type of the resource to update. resourceName is the name of the resource -// to update. parameters is parameters for updating the resource. +// Parameters: +// resourceGroupName - the name of the resource group for the resource. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource to update. +// resourceName - the name of the resource to update. +// parameters - parameters for updating the resource. func (client Client) Update(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource) (result UpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -994,15 +1017,17 @@ func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName strin // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1020,11 +1045,11 @@ func (client Client) UpdateResponder(resp *http.Response) (result GenericResourc } // UpdateByID updates a resource by ID. -// -// resourceID is the fully qualified ID of the resource, including the resource name and resource type. Use the +// Parameters: +// resourceID - the fully qualified ID of the resource, including the resource name and resource type. Use the // format, // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -// parameters is update resource parameters. +// parameters - update resource parameters. func (client Client) UpdateByID(ctx context.Context, resourceID string, parameters GenericResource) (result UpdateByIDFuture, err error) { req, err := client.UpdateByIDPreparer(ctx, resourceID, parameters) if err != nil { @@ -1065,15 +1090,17 @@ func (client Client) UpdateByIDPreparer(ctx context.Context, resourceID string, // UpdateByIDSender sends the UpdateByID request. The method will close the // http.Response Body if it receives an error. func (client Client) UpdateByIDSender(req *http.Request) (future UpdateByIDFuture, err error) { - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -1095,9 +1122,9 @@ func (client Client) UpdateByIDResponder(resp *http.Response) (result GenericRes // subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it // returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to // check the result of the long-running operation. -// -// sourceResourceGroupName is the name of the resource group containing the resources to validate for move. -// parameters is parameters for moving resources. +// Parameters: +// sourceResourceGroupName - the name of the resource group containing the resources to validate for move. +// parameters - parameters for moving resources. func (client Client) ValidateMoveResources(ctx context.Context, sourceResourceGroupName string, parameters MoveInfo) (result ValidateMoveResourcesFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: sourceResourceGroupName, @@ -1147,15 +1174,17 @@ func (client Client) ValidateMoveResourcesPreparer(ctx context.Context, sourceRe // ValidateMoveResourcesSender sends the ValidateMoveResources request. The method will close the // http.Response Body if it receives an error. func (client Client) ValidateMoveResourcesSender(req *http.Request) (future ValidateMoveResourcesFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusConflict)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusConflict)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/tags.go b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/tags.go index 74daf1e0f..539938125 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/tags.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources/tags.go @@ -41,8 +41,8 @@ func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient // CreateOrUpdate the tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure // have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. -// -// tagName is the name of the tag to create. +// Parameters: +// tagName - the name of the tag to create. func (client TagsClient) CreateOrUpdate(ctx context.Context, tagName string) (result TagDetails, err error) { req, err := client.CreateOrUpdatePreparer(ctx, tagName) if err != nil { @@ -106,8 +106,9 @@ func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result Ta } // CreateOrUpdateValue creates a tag value. The name of the tag must already exist. -// -// tagName is the name of the tag. tagValue is the value of the tag to create. +// Parameters: +// tagName - the name of the tag. +// tagValue - the value of the tag to create. func (client TagsClient) CreateOrUpdateValue(ctx context.Context, tagName string, tagValue string) (result TagValue, err error) { req, err := client.CreateOrUpdateValuePreparer(ctx, tagName, tagValue) if err != nil { @@ -172,8 +173,8 @@ func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (resu } // Delete you must remove all values from a resource tag before you can delete it. -// -// tagName is the name of the tag. +// Parameters: +// tagName - the name of the tag. func (client TagsClient) Delete(ctx context.Context, tagName string) (result autorest.Response, err error) { req, err := client.DeletePreparer(ctx, tagName) if err != nil { @@ -236,8 +237,9 @@ func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.R } // DeleteValue deletes a tag value. -// -// tagName is the name of the tag. tagValue is the value of the tag to delete. +// Parameters: +// tagName - the name of the tag. +// tagValue - the value of the tag to delete. func (client TagsClient) DeleteValue(ctx context.Context, tagName string, tagValue string) (result autorest.Response, err error) { req, err := client.DeleteValuePreparer(ctx, tagName, tagValue) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go index d5913cdef..56dc300ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/accounts.go @@ -41,9 +41,9 @@ func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) Account } // CheckNameAvailability checks that the storage account name is valid and is not already in use. -// -// accountName is the name of the storage account within the specified resource group. Storage account names must -// be between 3 and 24 characters in length and use numbers and lower-case letters only. +// Parameters: +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. func (client AccountsClient) CheckNameAvailability(ctx context.Context, accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: accountName, @@ -118,11 +118,12 @@ func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) // and a subsequent create request is issued with different properties, the account properties will be updated. If an // account is already created and a subsequent create or update request is issued with the exact same set of // properties, the request will succeed. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. parameters is -// the parameters to provide for the created account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide for the created account. func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountsCreateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -185,15 +186,17 @@ func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupNa // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. func (client AccountsClient) CreateSender(req *http.Request) (future AccountsCreateFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -211,10 +214,11 @@ func (client AccountsClient) CreateResponder(resp *http.Response) (result Accoun } // Delete deletes a storage account in Microsoft Azure. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -290,10 +294,11 @@ func (client AccountsClient) DeleteResponder(resp *http.Response) (result autore // GetProperties returns the properties for the specified storage account including but not limited to name, SKU name, // location, and account status. The ListKeys operation should be used to retrieve storage keys. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. func (client AccountsClient) GetProperties(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -432,11 +437,12 @@ func (client AccountsClient) ListResponder(resp *http.Response) (result AccountL } // ListAccountSAS list SAS credentials of a storage account. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. parameters is -// the parameters to provide to list SAS credentials for the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide to list SAS credentials for the storage account. func (client AccountsClient) ListAccountSAS(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters) (result ListAccountSasResponse, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -517,8 +523,8 @@ func (client AccountsClient) ListAccountSASResponder(resp *http.Response) (resul // ListByResourceGroup lists all the storage accounts available under the given resource group. Note that storage keys // are not returned; use the ListKeys operation for this. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResult, err error) { if err := validation.Validate([]validation.Validation{ @@ -591,10 +597,11 @@ func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) ( } // ListKeys lists the access keys for the specified storage account. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountListKeysResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -670,11 +677,12 @@ func (client AccountsClient) ListKeysResponder(resp *http.Response) (result Acco } // ListServiceSAS list service SAS credentials of a specific resource. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. parameters is -// the parameters to provide to list service SAS credentials. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide to list service SAS credentials. func (client AccountsClient) ListServiceSAS(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters) (result ListServiceSasResponse, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -756,11 +764,12 @@ func (client AccountsClient) ListServiceSASResponder(resp *http.Response) (resul } // RegenerateKey regenerates one of the access keys for the specified storage account. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. regenerateKey -// is specifies name of the key which should be regenerated -- key1 or key2. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// regenerateKey - specifies name of the key which should be regenerated -- key1 or key2. func (client AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -845,11 +854,12 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result // must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This // call does not change the storage keys for the account. If you want to change the storage account keys, use the // regenerate keys operation. The location and name of the storage account cannot be changed after creation. -// -// resourceGroupName is the name of the resource group within the user's subscription. The name is case -// insensitive. accountName is the name of the storage account within the specified resource group. Storage account -// names must be between 3 and 24 characters in length and use numbers and lower-case letters only. parameters is -// the parameters to provide for the updated account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide for the updated account. func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go index 9e31bb4e5..c215a75c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage/models.go @@ -755,12 +755,11 @@ type AccountSasParameters struct { // AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AccountsCreateFuture struct { azure.Future - req *http.Request } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future AccountsCreateFuture) Result(client AccountsClient) (a Account, err error) { +func (future *AccountsCreateFuture) Result(client AccountsClient) (a Account, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -768,34 +767,15 @@ func (future AccountsCreateFuture) Result(client AccountsClient) (a Account, err return } if !done { - return a, azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") - } - if future.PollingMethod() == azure.PollingLocation { - a, err = client.CreateResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", future.Response(), "Failure responding to request") - } + err = azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") return } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) if err != nil { - return + err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", resp, "Failure sending request") - return - } - a, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", resp, "Failure responding to request") } return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md b/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md index 49e48cdf1..459b45831 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md @@ -1,9 +1,13 @@ # Azure Storage SDK for Go (Preview) :exclamation: IMPORTANT: This package is in maintenance only and will be deprecated in the -future. Consider using the new package for blobs currently in preview at -[github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go). -New Table, Queue and File packages are also in development. +future. Please use one of the following packages instead. + +| Service | Import Path/Repo | +|---------|------------------| +| Storage - Blobs | [github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go) | +| Storage - Files | [github.com/Azure/azure-storage-file-go](https://github.com/Azure/azure-storage-file-go) | +| Storage - Queues | [github.com/Azure/azure-storage-queue-go](https://github.com/Azure/azure-storage-queue-go) | The `github.com/Azure/azure-sdk-for-go/storage` package is used to manage [Azure Storage](https://docs.microsoft.com/en-us/azure/storage/) data plane diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go index 24ee5db6f..1d2248625 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go @@ -140,7 +140,7 @@ func (b *Blob) Exists() (bool, error) { headers := b.Container.bsc.client.getStandardHeaders() resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusOK, nil } @@ -293,7 +293,7 @@ func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time if err != nil || resp == nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusCreated}); err != nil { return nil, err @@ -340,7 +340,7 @@ func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { return err @@ -463,7 +463,7 @@ func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusOK}) } @@ -501,7 +501,7 @@ func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusOK}) } @@ -538,7 +538,7 @@ func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusOK}); err != nil { return err @@ -574,7 +574,7 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusAccepted}) } @@ -585,7 +585,7 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error { func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) { resp, err := b.delete(options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusAccepted, nil } @@ -622,7 +622,7 @@ func pathForResource(container, name string) string { } func (b *Blob) respondCreation(resp *http.Response, bt BlobType) error { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) err := checkRespCode(resp, []int{http.StatusCreated}) if err != nil { return err diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go index 5d9467afd..c9c62d799 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go @@ -229,7 +229,7 @@ func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusCreated}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go index 651ba8722..2930824b2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go @@ -120,6 +120,7 @@ func (ds *DefaultSender) Send(c *Client, req *http.Request) (resp *http.Response if err != nil || !autorest.ResponseHasStatusCode(resp, ds.ValidStatusCodes...) { return resp, err } + drainRespBody(resp) autorest.DelayForBackoff(ds.RetryDuration, attempts, req.Cancel) ds.attempts = attempts } @@ -880,6 +881,12 @@ func readAndCloseBody(body io.ReadCloser) ([]byte, error) { return out, err } +// reads the response body then closes it +func drainRespBody(resp *http.Response) { + io.Copy(ioutil.Discard, resp.Body) + resp.Body.Close() +} + func serviceErrFromXML(body []byte, storageErr *AzureStorageServiceError) error { if err := xml.Unmarshal(body, storageErr); err != nil { storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body)) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go index bba44db74..056473d49 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go @@ -258,7 +258,7 @@ func (c *Container) Create(options *CreateContainerOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusCreated}) } @@ -267,7 +267,7 @@ func (c *Container) Create(options *CreateContainerOptions) error { func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) { resp, err := c.create(options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict { return resp.StatusCode == http.StatusCreated, nil } @@ -307,7 +307,7 @@ func (c *Container) Exists() (bool, error) { resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusOK, nil } @@ -349,7 +349,7 @@ func (c *Container) SetPermissions(permissions ContainerPermissions, options *Se if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusOK}) } @@ -431,7 +431,7 @@ func (c *Container) Delete(options *DeleteContainerOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusAccepted}) } @@ -444,7 +444,7 @@ func (c *Container) Delete(options *DeleteContainerOptions) error { func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) { resp, err := c.delete(options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusAccepted, nil } @@ -535,7 +535,7 @@ func (c *Container) SetMetadata(options *ContainerMetadataOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusOK}) } @@ -563,7 +563,7 @@ func (c *Container) GetMetadata(options *ContainerMetadataOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusOK}); err != nil { return err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go index 248dfb220..151e9a510 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go @@ -110,7 +110,7 @@ func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error if err != nil { return "", err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusAccepted, http.StatusCreated}); err != nil { return "", err @@ -152,7 +152,7 @@ func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } @@ -223,7 +223,7 @@ func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, if err != nil { return "", err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusAccepted}); err != nil { return "", err diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go index 237d10fd1..2e805e7df 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go @@ -107,7 +107,7 @@ func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error) params := prepareOptions(options) resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict { if resp.StatusCode == http.StatusCreated { d.updateEtagAndLastModified(resp.Header) @@ -135,7 +135,7 @@ func (d *Directory) Delete(options *FileRequestOptions) error { func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) { resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusAccepted, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go index 5af9b1ef3..fbbcb93ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go @@ -112,7 +112,7 @@ func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { return err @@ -154,7 +154,7 @@ func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if ml != EmptyPayload { if err = checkRespCode(resp, []int{http.StatusCreated}); err != nil { @@ -212,7 +212,7 @@ func (e *Entity) Delete(force bool, options *EntityOptions) error { } return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil { return err @@ -399,7 +399,7 @@ func (e *Entity) insertOr(verb string, options *EntityOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil { return err @@ -428,7 +428,7 @@ func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) er } return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil { return err diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go index 8afc2e233..06bbe4ba0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go @@ -187,7 +187,7 @@ func (f *File) Delete(options *FileRequestOptions) error { func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) { resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusAccepted, nil } @@ -212,7 +212,7 @@ func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, err } if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { - readAndCloseBody(resp.Body) + drainRespBody(resp) return nil, err } return resp.Body, nil @@ -242,7 +242,7 @@ func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOption } if err = checkRespCode(resp, []int{http.StatusOK, http.StatusPartialContent}); err != nil { - readAndCloseBody(resp.Body) + drainRespBody(resp) return fs, err } @@ -375,7 +375,7 @@ func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint, if err != nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return resp.Header, checkRespCode(resp, []int{http.StatusCreated}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go index 6467937d2..1db8e7da6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go @@ -194,7 +194,7 @@ func (f FileServiceClient) listContent(path string, params url.Values, extraHead } if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { - readAndCloseBody(resp.Body) + drainRespBody(resp) return nil, err } @@ -212,7 +212,7 @@ func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusOK, resp.Header, nil } @@ -226,7 +226,7 @@ func (f FileServiceClient) createResource(path string, res resourceType, urlPara if err != nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return resp.Header, checkRespCode(resp, expectedResponseCodes) } @@ -251,7 +251,7 @@ func (f FileServiceClient) getResourceHeaders(path string, comp compType, res re if err != nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { return nil, err @@ -279,7 +279,7 @@ func (f FileServiceClient) deleteResource(path string, res resourceType, options if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusAccepted}) } @@ -323,7 +323,7 @@ func (f FileServiceClient) setResourceHeaders(path string, comp compType, res re if err != nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return resp.Header, checkRespCode(resp, []int{http.StatusOK}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go index 22ddbcd65..5b4a65145 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go @@ -53,7 +53,7 @@ func (b *Blob) leaseCommonPut(headers map[string]string, expectedStatus int, opt if err != nil { return nil, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{expectedStatus}); err != nil { return nil, err diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go index ff13704ea..ce33dcb72 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go @@ -78,7 +78,7 @@ func (m *Message) Put(options *PutMessageOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) err = checkRespCode(resp, []int{http.StatusCreated}) if err != nil { return err @@ -128,7 +128,7 @@ func (m *Message) Update(options *UpdateMessageOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) m.PopReceipt = resp.Header.Get("x-ms-popreceipt") nextTimeStr := resp.Header.Get("x-ms-time-next-visible") @@ -160,7 +160,7 @@ func (m *Message) Delete(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go index 007e19e61..7ffd63821 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go @@ -121,7 +121,7 @@ func (b *Blob) modifyRange(blobRange BlobRange, bytes io.Reader, options *PutPag if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusCreated}) } @@ -160,7 +160,7 @@ func (b *Blob) GetPageRanges(options *GetPageRangesOptions) (GetPageRangesRespon if err != nil { return out, err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err = checkRespCode(resp, []int{http.StatusOK}); err != nil { return out, err diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go index 9a821c56a..55238ab15 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go @@ -91,7 +91,7 @@ func (q *Queue) Create(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusCreated}) } @@ -111,7 +111,7 @@ func (q *Queue) Delete(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } @@ -120,7 +120,7 @@ func (q *Queue) Exists() (bool, error) { uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}}) resp, err := q.qsc.client.exec(http.MethodGet, uri, q.qsc.client.getStandardHeaders(), nil, q.qsc.auth) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusOK, nil } @@ -148,7 +148,7 @@ func (q *Queue) SetMetadata(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } @@ -175,7 +175,7 @@ func (q *Queue) GetMetadata(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if err := checkRespCode(resp, []int{http.StatusOK}); err != nil { return err @@ -314,7 +314,7 @@ func (q *Queue) ClearMessages(options *QueueServiceOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } @@ -341,7 +341,7 @@ func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePe if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go index 0ded50107..cf75a2659 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go @@ -75,7 +75,7 @@ func (s *Share) CreateIfNotExists(options *FileRequestOptions) (bool, error) { params := prepareOptions(options) resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, params, extraheaders) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict { if resp.StatusCode == http.StatusCreated { s.updateEtagAndLastModified(resp.Header) @@ -103,7 +103,7 @@ func (s *Share) Delete(options *FileRequestOptions) error { func (s *Share) DeleteIfExists(options *FileRequestOptions) (bool, error) { resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare, options) if resp != nil { - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound { return resp.StatusCode == http.StatusAccepted, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go index a68ad0930..c338975ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go @@ -126,6 +126,6 @@ func (c Client) setServiceProperties(props ServiceProperties, service string, au if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusAccepted}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go index b96ca6e12..22d9b4f5c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go @@ -186,7 +186,7 @@ func (t *Table) Delete(timeout uint, options *TableOptions) error { if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } @@ -269,7 +269,7 @@ func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *T if err != nil { return err } - defer readAndCloseBody(resp.Body) + defer drainRespBody(resp) return checkRespCode(resp, []int{http.StatusNoContent}) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go index 6595fb70f..a2159e296 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go @@ -163,7 +163,7 @@ func (t *TableBatch) ExecuteBatch() error { if err != nil { return err } - defer readAndCloseBody(resp.resp.Body) + defer drainRespBody(resp.resp) if err = checkRespCode(resp.resp, []int{http.StatusAccepted}); err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go index 9ba20b8a8..0d0677e74 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go @@ -18,4 +18,4 @@ package version // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Number contains the semantic version of this SDK. -const Number = "v15.0.0" +const Number = "v17.3.1" diff --git a/vendor/vendor.json b/vendor/vendor.json index 0ae028187..c519a1e0e 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -9,58 +9,60 @@ "revisionTime": "2016-08-11T22:04:02Z" }, { - "checksumSHA1": "cJxhrzJRtddboU3S0TPyvEPBqsc=", + "checksumSHA1": "aspvORKGJoiAwyzot4bsHqt/17Y=", "path": "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "VDwUBYd9RVKy09Y17al0EQ7ivYI=", + "checksumSHA1": "jD1gZ3he4E6iYOZn7D24dKeLG8k=", "path": "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "woz67BK+/NdoZm4GzVYnJwzl61A=", + "checksumSHA1": "pJ2o3U5IZP9z5dKYl69maIBXUOY=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "1W8UIxg6Rycuzg41FQFu35vkCEU=", + "checksumSHA1": "hnlMpNzAV5mu4PHvyTuBc/BC8aA=", "path": "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "g9eP5AgV9yXRkY36M8h7aDW9oi8=", + "checksumSHA1": "qHMzicMTsihjgKyS/VB8oguXmmc=", "path": "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "3N5Et8QnWsHJYN+v/0J/VSQUkJ0=", + "checksumSHA1": "1fQaVn4mDau1rUfyWGitatAvXdM=", "path": "github.com/Azure/azure-sdk-for-go/storage", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z", - "version": "v15.0.0", - "versionExact": "v15.0.0" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { - "checksumSHA1": "Fb2OanEbwZVaGHYLf9Y4FAajsOM=", + "checksumSHA1": "BeO7/Ld5yP8m32hHNGQBSUvQjaw=", "path": "github.com/Azure/azure-sdk-for-go/version", - "revision": "56332fec5b308fbb6615fa1af6117394cdba186d", - "revisionTime": "2018-03-26T23:29:47Z" + "revision": "ef33a0a23b66ba5e81f699d03dc48b723c1bad50", + "revisionTime": "2018-06-15T22:13:27Z", + "version": "v17.3.1", + "versionExact": "v17.3.1" }, { "checksumSHA1": "+P6HOINDh/n2z4GqEkluzuGP5p0=", @@ -72,7 +74,7 @@ "versionExact": "v10.4.0" }, { - "checksumSHA1": "4Z3yO++uYspufDkuaIydTpT787c=", + "checksumSHA1": "HzA52MbMWnsR31CFrub5biN90/Q=", "path": "github.com/Azure/go-autorest/autorest/adal", "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", "revisionTime": "2018-03-26T17:06:54Z", @@ -107,7 +109,7 @@ "versionExact": "v8.0.0" }, { - "checksumSHA1": "5UH4IFIB/98iowPCzzVs4M4MXiQ=", + "checksumSHA1": "CdDkG+J8wqXQVQ0f0xal+eolB1w=", "path": "github.com/Azure/go-autorest/autorest/validation", "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", "revisionTime": "2018-03-26T17:06:54Z", From f60921ad4b4f9eceda11474c8f08ff81b9f51cb1 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Wed, 11 Jul 2018 14:17:56 -0700 Subject: [PATCH 2/2] azure: upgrade Azure/go-autorest to v10.12.0 --- .../Azure/go-autorest/autorest/adal/config.go | 8 +- .../Azure/go-autorest/autorest/adal/msi.go | 20 - .../go-autorest/autorest/adal/msi_windows.go | 25 - .../Azure/go-autorest/autorest/adal/token.go | 541 +++++++-- .../go-autorest/autorest/authorization.go | 22 +- .../Azure/go-autorest/autorest/autorest.go | 18 + .../Azure/go-autorest/autorest/azure/async.go | 1039 ++++++++++++----- .../Azure/go-autorest/autorest/azure/azure.go | 27 +- .../Azure/go-autorest/autorest/azure/rp.go | 12 +- .../Azure/go-autorest/autorest/date/date.go | 14 + .../Azure/go-autorest/autorest/date/time.go | 14 + .../go-autorest/autorest/date/timerfc1123.go | 14 + .../go-autorest/autorest/date/unixtime.go | 14 + .../go-autorest/autorest/date/utility.go | 14 + .../Azure/go-autorest/autorest/sender.go | 22 +- .../Azure/go-autorest/autorest/to/convert.go | 14 + .../Azure/go-autorest/autorest/utility.go | 10 + .../autorest/validation/validation.go | 23 +- .../Azure/go-autorest/autorest/version.go | 2 +- vendor/vendor.json | 60 +- 20 files changed, 1353 insertions(+), 560 deletions(-) delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/msi.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go index f570d540a..bee5e61dd 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -26,10 +26,10 @@ const ( // OAuthConfig represents the endpoints needed // in OAuth operations type OAuthConfig struct { - AuthorityEndpoint url.URL - AuthorizeEndpoint url.URL - TokenEndpoint url.URL - DeviceCodeEndpoint url.URL + AuthorityEndpoint url.URL `json:"authorityEndpoint"` + AuthorizeEndpoint url.URL `json:"authorizeEndpoint"` + TokenEndpoint url.URL `json:"tokenEndpoint"` + DeviceCodeEndpoint url.URL `json:"deviceCodeEndpoint"` } // IsZero returns true if the OAuthConfig object is zero-initialized. diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go b/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go deleted file mode 100644 index 5e02d52ac..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build !windows - -package adal - -// Copyright 2017 Microsoft Corporation -// -// 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. - -// msiPath is the path to the MSI Extension settings file (to discover the endpoint) -var msiPath = "/var/lib/waagent/ManagedIdentity-Settings" diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go b/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go deleted file mode 100644 index 261b56882..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build windows - -package adal - -// Copyright 2017 Microsoft Corporation -// -// 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. - -import ( - "os" - "strings" -) - -// msiPath is the path to the MSI Extension settings file (to discover the endpoint) -var msiPath = strings.Join([]string{os.Getenv("SystemDrive"), "WindowsAzure/Config/ManagedIdentity-Settings"}, "/") diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go index d98504122..eec4dced7 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -15,14 +15,18 @@ package adal // limitations under the License. import ( + "context" "crypto/rand" "crypto/rsa" "crypto/sha1" "crypto/x509" "encoding/base64" "encoding/json" + "errors" "fmt" "io/ioutil" + "math" + "net" "net/http" "net/url" "strconv" @@ -54,6 +58,12 @@ const ( // metadataHeader is the header required by MSI extension metadataHeader = "Metadata" + + // msiEndpoint is the well known endpoint for getting MSI authentications tokens + msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token" + + // the default number of attempts to refresh an MSI authentication token + defaultMaxMSIRefreshAttempts = 5 ) // OAuthTokenProvider is an interface which should be implemented by an access token retriever @@ -74,6 +84,13 @@ type Refresher interface { EnsureFresh() error } +// RefresherWithContext is an interface for token refresh functionality +type RefresherWithContext interface { + RefreshWithContext(ctx context.Context) error + RefreshExchangeWithContext(ctx context.Context, resource string) error + EnsureFreshWithContext(ctx context.Context) error +} + // TokenRefreshCallback is the type representing callbacks that will be called after // a successful token refresh type TokenRefreshCallback func(Token) error @@ -124,6 +141,12 @@ func (t *Token) OAuthToken() string { return t.AccessToken } +// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form +// that is submitted when acquiring an oAuth token. +type ServicePrincipalSecret interface { + SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +} + // ServicePrincipalNoSecret represents a secret type that contains no secret // meaning it is not valid for fetching a fresh token. This is used by Manual type ServicePrincipalNoSecret struct { @@ -135,15 +158,19 @@ func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePr return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") } -// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form -// that is submitted when acquiring an oAuth token. -type ServicePrincipalSecret interface { - SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +// MarshalJSON implements the json.Marshaler interface. +func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalNoSecret", + }) } // ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. type ServicePrincipalTokenSecret struct { - ClientSecret string + ClientSecret string `json:"value"` } // SetAuthenticationValues is a method of the interface ServicePrincipalSecret. @@ -153,49 +180,24 @@ func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *Ser return nil } +// MarshalJSON implements the json.Marshaler interface. +func (tokenSecret ServicePrincipalTokenSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalTokenSecret", + Value: tokenSecret.ClientSecret, + }) +} + // ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. type ServicePrincipalCertificateSecret struct { Certificate *x509.Certificate PrivateKey *rsa.PrivateKey } -// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. -type ServicePrincipalMSISecret struct { -} - -// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. -type ServicePrincipalUsernamePasswordSecret struct { - Username string - Password string -} - -// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. -type ServicePrincipalAuthorizationCodeSecret struct { - ClientSecret string - AuthorizationCode string - RedirectURI string -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("code", secret.AuthorizationCode) - v.Set("client_secret", secret.ClientSecret) - v.Set("redirect_uri", secret.RedirectURI) - return nil -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("username", secret.Username) - v.Set("password", secret.Password) - return nil -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - return nil -} - // SignJwt returns the JWT signed with the certificate's private key. func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { hasher := sha1.New() @@ -216,9 +218,9 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo token := jwt.New(jwt.SigningMethodRS256) token.Header["x5t"] = thumbprint token.Claims = jwt.MapClaims{ - "aud": spt.oauthConfig.TokenEndpoint.String(), - "iss": spt.clientID, - "sub": spt.clientID, + "aud": spt.inner.OauthConfig.TokenEndpoint.String(), + "iss": spt.inner.ClientID, + "sub": spt.inner.ClientID, "jti": base64.URLEncoding.EncodeToString(jti), "nbf": time.Now().Unix(), "exp": time.Now().Add(time.Hour * 24).Unix(), @@ -241,19 +243,151 @@ func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *Se return nil } +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalCertificateSecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalCertificateSecret is not supported") +} + +// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. +type ServicePrincipalMSISecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (msiSecret ServicePrincipalMSISecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalMSISecret is not supported") +} + +// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. +type ServicePrincipalUsernamePasswordSecret struct { + Username string `json:"username"` + Password string `json:"password"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("username", secret.Username) + v.Set("password", secret.Password) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalUsernamePasswordSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Username string `json:"username"` + Password string `json:"password"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalUsernamePasswordSecret", + Username: secret.Username, + Password: secret.Password, + }) +} + +// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. +type ServicePrincipalAuthorizationCodeSecret struct { + ClientSecret string `json:"value"` + AuthorizationCode string `json:"authCode"` + RedirectURI string `json:"redirect"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("code", secret.AuthorizationCode) + v.Set("client_secret", secret.ClientSecret) + v.Set("redirect_uri", secret.RedirectURI) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + AuthCode string `json:"authCode"` + Redirect string `json:"redirect"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalAuthorizationCodeSecret", + Value: secret.ClientSecret, + AuthCode: secret.AuthorizationCode, + Redirect: secret.RedirectURI, + }) +} + // ServicePrincipalToken encapsulates a Token created for a Service Principal. type ServicePrincipalToken struct { - token Token - secret ServicePrincipalSecret - oauthConfig OAuthConfig - clientID string - resource string - autoRefresh bool - refreshLock *sync.RWMutex - refreshWithin time.Duration - sender Sender - + inner servicePrincipalToken + refreshLock *sync.RWMutex + sender Sender refreshCallbacks []TokenRefreshCallback + // MaxMSIRefreshAttempts is the maximum number of attempts to refresh an MSI token. + MaxMSIRefreshAttempts int +} + +// MarshalTokenJSON returns the marshalled inner token. +func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { + return json.Marshal(spt.inner.Token) +} + +// SetRefreshCallbacks replaces any existing refresh callbacks with the specified callbacks. +func (spt *ServicePrincipalToken) SetRefreshCallbacks(callbacks []TokenRefreshCallback) { + spt.refreshCallbacks = callbacks +} + +// MarshalJSON implements the json.Marshaler interface. +func (spt ServicePrincipalToken) MarshalJSON() ([]byte, error) { + return json.Marshal(spt.inner) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { + // need to determine the token type + raw := map[string]interface{}{} + err := json.Unmarshal(data, &raw) + if err != nil { + return err + } + secret := raw["secret"].(map[string]interface{}) + switch secret["type"] { + case "ServicePrincipalNoSecret": + spt.inner.Secret = &ServicePrincipalNoSecret{} + case "ServicePrincipalTokenSecret": + spt.inner.Secret = &ServicePrincipalTokenSecret{} + case "ServicePrincipalCertificateSecret": + return errors.New("unmarshalling ServicePrincipalCertificateSecret is not supported") + case "ServicePrincipalMSISecret": + return errors.New("unmarshalling ServicePrincipalMSISecret is not supported") + case "ServicePrincipalUsernamePasswordSecret": + spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{} + case "ServicePrincipalAuthorizationCodeSecret": + spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{} + default: + return fmt.Errorf("unrecognized token type '%s'", secret["type"]) + } + err = json.Unmarshal(data, &spt.inner) + if err != nil { + return err + } + spt.refreshLock = &sync.RWMutex{} + spt.sender = &http.Client{} + return nil +} + +// internal type used for marshalling/unmarshalling +type servicePrincipalToken struct { + Token Token `json:"token"` + Secret ServicePrincipalSecret `json:"secret"` + OauthConfig OAuthConfig `json:"oauth"` + ClientID string `json:"clientID"` + Resource string `json:"resource"` + AutoRefresh bool `json:"autoRefresh"` + RefreshWithin time.Duration `json:"refreshWithin"` } func validateOAuthConfig(oac OAuthConfig) error { @@ -278,13 +412,15 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso return nil, fmt.Errorf("parameter 'secret' cannot be nil") } spt := &ServicePrincipalToken{ - oauthConfig: oauthConfig, - secret: secret, - clientID: id, - resource: resource, - autoRefresh: true, + inner: servicePrincipalToken{ + OauthConfig: oauthConfig, + Secret: secret, + ClientID: id, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, + }, refreshLock: &sync.RWMutex{}, - refreshWithin: defaultRefresh, sender: &http.Client{}, refreshCallbacks: callbacks, } @@ -315,7 +451,39 @@ func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID s return nil, err } - spt.token = token + spt.inner.Token = token + + return spt, nil +} + +// NewServicePrincipalTokenFromManualTokenSecret creates a ServicePrincipalToken using the supplied token and secret +func NewServicePrincipalTokenFromManualTokenSecret(oauthConfig OAuthConfig, clientID string, resource string, token Token, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if secret == nil { + return nil, fmt.Errorf("parameter 'secret' cannot be nil") + } + if token.IsZero() { + return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") + } + spt, err := NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + secret, + callbacks...) + if err != nil { + return nil, err + } + + spt.inner.Token = token return spt, nil } @@ -441,24 +609,7 @@ func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clie // GetMSIVMEndpoint gets the MSI endpoint on Virtual Machines. func GetMSIVMEndpoint() (string, error) { - return getMSIVMEndpoint(msiPath) -} - -func getMSIVMEndpoint(path string) (string, error) { - // Read MSI settings - bytes, err := ioutil.ReadFile(path) - if err != nil { - return "", err - } - msiSettings := struct { - URL string `json:"url"` - }{} - err = json.Unmarshal(bytes, &msiSettings) - if err != nil { - return "", err - } - - return msiSettings.URL, nil + return msiEndpoint, nil } // NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. @@ -491,24 +642,32 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI return nil, err } - oauthConfig, err := NewOAuthConfig(msiEndpointURL.String(), "") - if err != nil { - return nil, err + v := url.Values{} + v.Set("resource", resource) + v.Set("api-version", "2018-02-01") + if userAssignedID != nil { + v.Set("client_id", *userAssignedID) } + msiEndpointURL.RawQuery = v.Encode() spt := &ServicePrincipalToken{ - oauthConfig: *oauthConfig, - secret: &ServicePrincipalMSISecret{}, - resource: resource, - autoRefresh: true, - refreshLock: &sync.RWMutex{}, - refreshWithin: defaultRefresh, - sender: &http.Client{}, - refreshCallbacks: callbacks, + inner: servicePrincipalToken{ + OauthConfig: OAuthConfig{ + TokenEndpoint: *msiEndpointURL, + }, + Secret: &ServicePrincipalMSISecret{}, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, + }, + refreshLock: &sync.RWMutex{}, + sender: &http.Client{}, + refreshCallbacks: callbacks, + MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts, } if userAssignedID != nil { - spt.clientID = *userAssignedID + spt.inner.ClientID = *userAssignedID } return spt, nil @@ -537,12 +696,18 @@ func newTokenRefreshError(message string, resp *http.Response) TokenRefreshError // EnsureFresh will refresh the token if it will expire within the refresh window (as set by // RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. func (spt *ServicePrincipalToken) EnsureFresh() error { - if spt.autoRefresh && spt.token.WillExpireIn(spt.refreshWithin) { + return spt.EnsureFreshWithContext(context.Background()) +} + +// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by +// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. +func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { + if spt.inner.AutoRefresh && spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { // take the write lock then check to see if the token was already refreshed spt.refreshLock.Lock() defer spt.refreshLock.Unlock() - if spt.token.WillExpireIn(spt.refreshWithin) { - return spt.refreshInternal(spt.resource) + if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { + return spt.refreshInternal(ctx, spt.inner.Resource) } } return nil @@ -552,7 +717,7 @@ func (spt *ServicePrincipalToken) EnsureFresh() error { func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { if spt.refreshCallbacks != nil { for _, callback := range spt.refreshCallbacks { - err := callback(spt.token) + err := callback(spt.inner.Token) if err != nil { return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) } @@ -564,21 +729,33 @@ func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { // Refresh obtains a fresh token for the Service Principal. // This method is not safe for concurrent use and should be syncrhonized. func (spt *ServicePrincipalToken) Refresh() error { + return spt.RefreshWithContext(context.Background()) +} + +// RefreshWithContext obtains a fresh token for the Service Principal. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() - return spt.refreshInternal(spt.resource) + return spt.refreshInternal(ctx, spt.inner.Resource) } // RefreshExchange refreshes the token, but for a different resource. // This method is not safe for concurrent use and should be syncrhonized. func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { + return spt.RefreshExchangeWithContext(context.Background(), resource) +} + +// RefreshExchangeWithContext refreshes the token, but for a different resource. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() - return spt.refreshInternal(resource) + return spt.refreshInternal(ctx, resource) } func (spt *ServicePrincipalToken) getGrantType() string { - switch spt.secret.(type) { + switch spt.inner.Secret.(type) { case *ServicePrincipalUsernamePasswordSecret: return OAuthGrantTypeUserPass case *ServicePrincipalAuthorizationCodeSecret: @@ -588,37 +765,64 @@ func (spt *ServicePrincipalToken) getGrantType() string { } } -func (spt *ServicePrincipalToken) refreshInternal(resource string) error { - v := url.Values{} - v.Set("client_id", spt.clientID) - v.Set("resource", resource) - - if spt.token.RefreshToken != "" { - v.Set("grant_type", OAuthGrantTypeRefreshToken) - v.Set("refresh_token", spt.token.RefreshToken) - } else { - v.Set("grant_type", spt.getGrantType()) - err := spt.secret.SetAuthenticationValues(spt, &v) - if err != nil { - return err - } +func isIMDS(u url.URL) bool { + imds, err := url.Parse(msiEndpoint) + if err != nil { + return false } + return u.Host == imds.Host && u.Path == imds.Path +} - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), body) +func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource string) error { + req, err := http.NewRequest(http.MethodPost, spt.inner.OauthConfig.TokenEndpoint.String(), nil) if err != nil { return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) } + req = req.WithContext(ctx) + if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) { + v := url.Values{} + v.Set("client_id", spt.inner.ClientID) + v.Set("resource", resource) - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - if _, ok := spt.secret.(*ServicePrincipalMSISecret); ok { + if spt.inner.Token.RefreshToken != "" { + v.Set("grant_type", OAuthGrantTypeRefreshToken) + v.Set("refresh_token", spt.inner.Token.RefreshToken) + // web apps must specify client_secret when refreshing tokens + // see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#refreshing-the-access-tokens + if spt.getGrantType() == OAuthGrantTypeAuthorizationCode { + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } + } else { + v.Set("grant_type", spt.getGrantType()) + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } + + s := v.Encode() + body := ioutil.NopCloser(strings.NewReader(s)) + req.ContentLength = int64(len(s)) + req.Header.Set(contentType, mimeTypeFormPost) + req.Body = body + } + + if _, ok := spt.inner.Secret.(*ServicePrincipalMSISecret); ok { + req.Method = http.MethodGet req.Header.Set(metadataHeader, "true") } - resp, err := spt.sender.Do(req) + + var resp *http.Response + if isIMDS(spt.inner.OauthConfig.TokenEndpoint) { + resp, err = retryForIMDS(spt.sender, req, spt.MaxMSIRefreshAttempts) + } else { + resp, err = spt.sender.Do(req) + } if err != nil { - return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err) + return newTokenRefreshError(fmt.Sprintf("adal: Failed to execute the refresh request. Error = '%v'", err), nil) } defer resp.Body.Close() @@ -626,11 +830,15 @@ func (spt *ServicePrincipalToken) refreshInternal(resource string) error { if resp.StatusCode != http.StatusOK { if err != nil { - return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body", resp.StatusCode), resp) + return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body: %v", resp.StatusCode, err), resp) } return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Response body: %s", resp.StatusCode, string(rb)), resp) } + // for the following error cases don't return a TokenRefreshError. the operation succeeded + // but some transient failure happened during deserialization. by returning a generic error + // the retry logic will kick in (we don't retry on TokenRefreshError). + if err != nil { return fmt.Errorf("adal: Failed to read a new service principal token during refresh. Error = '%v'", err) } @@ -643,20 +851,99 @@ func (spt *ServicePrincipalToken) refreshInternal(resource string) error { return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)) } - spt.token = token + spt.inner.Token = token return spt.InvokeRefreshCallbacks(token) } +// retry logic specific to retrieving a token from the IMDS endpoint +func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) { + // copied from client.go due to circular dependency + retries := []int{ + http.StatusRequestTimeout, // 408 + http.StatusTooManyRequests, // 429 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } + // extra retry status codes specific to IMDS + retries = append(retries, + http.StatusNotFound, + http.StatusGone, + // all remaining 5xx + http.StatusNotImplemented, + http.StatusHTTPVersionNotSupported, + http.StatusVariantAlsoNegotiates, + http.StatusInsufficientStorage, + http.StatusLoopDetected, + http.StatusNotExtended, + http.StatusNetworkAuthenticationRequired) + + // see https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/how-to-use-vm-token#retry-guidance + + const maxDelay time.Duration = 60 * time.Second + + attempt := 0 + delay := time.Duration(0) + + for attempt < maxAttempts { + resp, err = sender.Do(req) + // retry on temporary network errors, e.g. transient network failures. + // if we don't receive a response then assume we can't connect to the + // endpoint so we're likely not running on an Azure VM so don't retry. + if (err != nil && !isTemporaryNetworkError(err)) || resp == nil || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) { + return + } + + // perform exponential backoff with a cap. + // must increment attempt before calculating delay. + attempt++ + // the base value of 2 is the "delta backoff" as specified in the guidance doc + delay += (time.Duration(math.Pow(2, float64(attempt))) * time.Second) + if delay > maxDelay { + delay = maxDelay + } + + select { + case <-time.After(delay): + // intentionally left blank + case <-req.Context().Done(): + err = req.Context().Err() + return + } + } + return +} + +// returns true if the specified error is a temporary network error or false if it's not. +// if the error doesn't implement the net.Error interface the return value is true. +func isTemporaryNetworkError(err error) bool { + if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { + return true + } + return false +} + +// returns true if slice ints contains the value n +func containsInt(ints []int, n int) bool { + for _, i := range ints { + if i == n { + return true + } + } + return false +} + // SetAutoRefresh enables or disables automatic refreshing of stale tokens. func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { - spt.autoRefresh = autoRefresh + spt.inner.AutoRefresh = autoRefresh } // SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will // refresh the token. func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { - spt.refreshWithin = d + spt.inner.RefreshWithin = d return } @@ -668,12 +955,12 @@ func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } func (spt *ServicePrincipalToken) OAuthToken() string { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() - return spt.token.OAuthToken() + return spt.inner.Token.OAuthToken() } // Token returns a copy of the current token. func (spt *ServicePrincipalToken) Token() Token { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() - return spt.token + return spt.inner.Token } diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go index c51eac0a7..77eff45bd 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization.go +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go @@ -113,17 +113,19 @@ func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) if err == nil { - refresher, ok := ba.tokenProvider.(adal.Refresher) - if ok { - err := refresher.EnsureFresh() - if err != nil { - var resp *http.Response - if tokError, ok := err.(adal.TokenRefreshError); ok { - resp = tokError.Response() - } - return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", resp, - "Failed to refresh the Token for request to %s", r.URL) + // the ordering is important here, prefer RefresherWithContext if available + if refresher, ok := ba.tokenProvider.(adal.RefresherWithContext); ok { + err = refresher.EnsureFreshWithContext(r.Context()) + } else if refresher, ok := ba.tokenProvider.(adal.Refresher); ok { + err = refresher.EnsureFresh() + } + if err != nil { + var resp *http.Response + if tokError, ok := err.(adal.TokenRefreshError); ok { + resp = tokError.Response() } + return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", resp, + "Failed to refresh the Token for request to %s", r.URL) } return Prepare(r, WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken()))) } diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go index f86b66a41..aafdf021f 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/autorest.go +++ b/vendor/github.com/Azure/go-autorest/autorest/autorest.go @@ -72,6 +72,7 @@ package autorest // limitations under the License. import ( + "context" "net/http" "time" ) @@ -130,3 +131,20 @@ func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Reque return req, nil } + +// NewPollingRequestWithContext allocates and returns a new http.Request with the specified context to poll for the passed response. +func NewPollingRequestWithContext(ctx context.Context, resp *http.Response) (*http.Request, error) { + location := GetLocation(resp) + if location == "" { + return nil, NewErrorWithResponse("autorest", "NewPollingRequestWithContext", resp, "Location header missing from response that requires polling") + } + + req, err := Prepare((&http.Request{}).WithContext(ctx), + AsGet(), + WithBaseURL(location)) + if err != nil { + return nil, NewErrorWithError(err, "autorest", "NewPollingRequestWithContext", nil, "Failure creating poll request to %s", location) + } + + return req, nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go index a18b61041..cda1e180a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -21,11 +21,11 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "time" "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" ) const ( @@ -44,84 +44,85 @@ var pollingCodes = [...]int{http.StatusNoContent, http.StatusAccepted, http.Stat // Future provides a mechanism to access the status and results of an asynchronous request. // Since futures are stateful they should be passed by value to avoid race conditions. type Future struct { - req *http.Request - resp *http.Response - ps pollingState + req *http.Request // legacy + pt pollingTracker } // NewFuture returns a new Future object initialized with the specified request. +// Deprecated: Please use NewFutureFromResponse instead. func NewFuture(req *http.Request) Future { return Future{req: req} } -// Response returns the last HTTP response or nil if there isn't one. +// NewFutureFromResponse returns a new Future object initialized +// with the initial response from an asynchronous operation. +func NewFutureFromResponse(resp *http.Response) (Future, error) { + pt, err := createPollingTracker(resp) + if err != nil { + return Future{}, err + } + return Future{pt: pt}, nil +} + +// Response returns the last HTTP response. func (f Future) Response() *http.Response { - return f.resp + if f.pt == nil { + return nil + } + return f.pt.latestResponse() } // Status returns the last status message of the operation. func (f Future) Status() string { - if f.ps.State == "" { - return "Unknown" + if f.pt == nil { + return "" } - return f.ps.State + return f.pt.pollingStatus() } // PollingMethod returns the method used to monitor the status of the asynchronous operation. func (f Future) PollingMethod() PollingMethodType { - return f.ps.PollingMethod + if f.pt == nil { + return PollingUnknown + } + return f.pt.pollingMethod() } // Done queries the service to see if the operation has completed. func (f *Future) Done(sender autorest.Sender) (bool, error) { - // exit early if this future has terminated - if f.ps.hasTerminated() { - return true, f.errorInfo() + // support for legacy Future implementation + if f.req != nil { + resp, err := sender.Do(f.req) + if err != nil { + return false, err + } + pt, err := createPollingTracker(resp) + if err != nil { + return false, err + } + f.pt = pt + f.req = nil } - resp, err := sender.Do(f.req) - f.resp = resp - if err != nil { + // end legacy + if f.pt == nil { + return false, autorest.NewError("Future", "Done", "future is not initialized") + } + if f.pt.hasTerminated() { + return true, f.pt.pollingError() + } + if err := f.pt.pollForStatus(sender); err != nil { return false, err } - - if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { - // check response body for error content - if resp.Body != nil { - type respErr struct { - ServiceError ServiceError `json:"error"` - } - re := respErr{} - - defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return false, err - } - err = json.Unmarshal(b, &re) - if err != nil { - return false, err - } - return false, re.ServiceError - } - - // try to return something meaningful - return false, ServiceError{ - Code: fmt.Sprintf("%v", resp.StatusCode), - Message: resp.Status, - } + if err := f.pt.checkForErrors(); err != nil { + return f.pt.hasTerminated(), err } - - err = updatePollingState(resp, &f.ps) - if err != nil { + if err := f.pt.updatePollingState(f.pt.provisioningStateApplicable()); err != nil { return false, err } - - if f.ps.hasTerminated() { - return true, f.errorInfo() + if err := f.pt.updateHeaders(); err != nil { + return false, err } - - f.req, err = newPollingRequest(f.ps) - return false, err + return f.pt.hasTerminated(), f.pt.pollingError() } // GetPollingDelay returns a duration the application should wait before checking @@ -129,11 +130,15 @@ func (f *Future) Done(sender autorest.Sender) (bool, error) { // the service via the Retry-After response header. If the header wasn't returned // then the function returns the zero-value time.Duration and false. func (f Future) GetPollingDelay() (time.Duration, bool) { - if f.resp == nil { + if f.pt == nil { + return 0, false + } + resp := f.pt.latestResponse() + if resp == nil { return 0, false } - retry := f.resp.Header.Get(autorest.HeaderRetryAfter) + retry := resp.Header.Get(autorest.HeaderRetryAfter) if retry == "" { return 0, false } @@ -150,14 +155,22 @@ func (f Future) GetPollingDelay() (time.Duration, bool) { // running operation has completed, the provided context is cancelled, or the client's // polling duration has been exceeded. It will retry failed polling attempts based on // the retry value defined in the client up to the maximum retry attempts. +// Deprecated: Please use WaitForCompletionRef() instead. func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) error { + return f.WaitForCompletionRef(ctx, client) +} + +// WaitForCompletionRef will return when one of the following conditions is met: the long +// running operation has completed, the provided context is cancelled, or the client's +// polling duration has been exceeded. It will retry failed polling attempts based on +// the retry value defined in the client up to the maximum retry attempts. +func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) error { ctx, cancel := context.WithTimeout(ctx, client.PollingDuration) defer cancel() - done, err := f.Done(client) for attempts := 0; !done; done, err = f.Done(client) { if attempts >= client.RetryAttempts { - return autorest.NewErrorWithError(err, "azure", "WaitForCompletion", f.resp, "the number of retries has been exceeded") + return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded") } // we want delayAttempt to be zero in the non-error case so // that DelayForBackoff doesn't perform exponential back-off @@ -181,162 +194,692 @@ func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) e // wait until the delay elapses or the context is cancelled delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, ctx.Done()) if !delayElapsed { - return autorest.NewErrorWithError(ctx.Err(), "azure", "WaitForCompletion", f.resp, "context has been cancelled") + return autorest.NewErrorWithError(ctx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled") } } return err } -// if the operation failed the polling state will contain -// error information and implements the error interface -func (f *Future) errorInfo() error { - if !f.ps.hasSucceeded() { - return f.ps - } - return nil -} - // MarshalJSON implements the json.Marshaler interface. func (f Future) MarshalJSON() ([]byte, error) { - return json.Marshal(&f.ps) + return json.Marshal(f.pt) } // UnmarshalJSON implements the json.Unmarshaler interface. func (f *Future) UnmarshalJSON(data []byte) error { - err := json.Unmarshal(data, &f.ps) + // unmarshal into JSON object to determine the tracker type + obj := map[string]interface{}{} + err := json.Unmarshal(data, &obj) if err != nil { return err } - f.req, err = newPollingRequest(f.ps) - return err + if obj["method"] == nil { + return autorest.NewError("Future", "UnmarshalJSON", "missing 'method' property") + } + method := obj["method"].(string) + switch strings.ToUpper(method) { + case http.MethodDelete: + f.pt = &pollingTrackerDelete{} + case http.MethodPatch: + f.pt = &pollingTrackerPatch{} + case http.MethodPost: + f.pt = &pollingTrackerPost{} + case http.MethodPut: + f.pt = &pollingTrackerPut{} + default: + return autorest.NewError("Future", "UnmarshalJSON", "unsupoorted method '%s'", method) + } + // now unmarshal into the tracker + return json.Unmarshal(data, &f.pt) } // PollingURL returns the URL used for retrieving the status of the long-running operation. -// For LROs that use the Location header the final URL value is used to retrieve the result. func (f Future) PollingURL() string { - return f.ps.URI + if f.pt == nil { + return "" + } + return f.pt.pollingURL() +} + +// GetResult should be called once polling has completed successfully. +// It makes the final GET call to retrieve the resultant payload. +func (f Future) GetResult(sender autorest.Sender) (*http.Response, error) { + if f.pt.finalGetURL() == "" { + // we can end up in this situation if the async operation returns a 200 + // with no polling URLs. in that case return the response which should + // contain the JSON payload (only do this for successful terminal cases). + if lr := f.pt.latestResponse(); lr != nil && f.pt.hasSucceeded() { + return lr, nil + } + return nil, autorest.NewError("Future", "GetResult", "missing URL for retrieving result") + } + req, err := http.NewRequest(http.MethodGet, f.pt.finalGetURL(), nil) + if err != nil { + return nil, err + } + return sender.Do(req) +} + +type pollingTracker interface { + // these methods can differ per tracker + + // checks the response headers and status code to determine the polling mechanism + updateHeaders() error + + // checks the response for tracker-specific error conditions + checkForErrors() error + + // returns true if provisioning state should be checked + provisioningStateApplicable() bool + + // methods common to all trackers + + // initializes the tracker's internal state, call this when the tracker is created + initializeState() error + + // makes an HTTP request to check the status of the LRO + pollForStatus(sender autorest.Sender) error + + // updates internal tracker state, call this after each call to pollForStatus + updatePollingState(provStateApl bool) error + + // returns the error response from the service, can be nil + pollingError() error + + // returns the polling method being used + pollingMethod() PollingMethodType + + // returns the state of the LRO as returned from the service + pollingStatus() string + + // returns the URL used for polling status + pollingURL() string + + // returns the URL used for the final GET to retrieve the resource + finalGetURL() string + + // returns true if the LRO is in a terminal state + hasTerminated() bool + + // returns true if the LRO is in a failed terminal state + hasFailed() bool + + // returns true if the LRO is in a successful terminal state + hasSucceeded() bool + + // returns the cached HTTP response after a call to pollForStatus(), can be nil + latestResponse() *http.Response +} + +type pollingTrackerBase struct { + // resp is the last response, either from the submission of the LRO or from polling + resp *http.Response + + // method is the HTTP verb, this is needed for deserialization + Method string `json:"method"` + + // rawBody is the raw JSON response body + rawBody map[string]interface{} + + // denotes if polling is using async-operation or location header + Pm PollingMethodType `json:"pollingMethod"` + + // the URL to poll for status + URI string `json:"pollingURI"` + + // the state of the LRO as returned from the service + State string `json:"lroState"` + + // the URL to GET for the final result + FinalGetURI string `json:"resultURI"` + + // used to hold an error object returned from the service + Err *ServiceError `json:"error,omitempty"` +} + +func (pt *pollingTrackerBase) initializeState() error { + // determine the initial polling state based on response body and/or HTTP status + // code. this is applicable to the initial LRO response, not polling responses! + pt.Method = pt.resp.Request.Method + if err := pt.updateRawBody(); err != nil { + return err + } + switch pt.resp.StatusCode { + case http.StatusOK: + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationSucceeded + } + case http.StatusCreated: + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationInProgress + } + case http.StatusAccepted: + pt.State = operationInProgress + case http.StatusNoContent: + pt.State = operationSucceeded + default: + pt.State = operationFailed + pt.updateErrorFromResponse() + } + return nil +} + +func (pt pollingTrackerBase) getProvisioningState() *string { + if pt.rawBody != nil && pt.rawBody["properties"] != nil { + p := pt.rawBody["properties"].(map[string]interface{}) + if ps := p["provisioningState"]; ps != nil { + s := ps.(string) + return &s + } + } + return nil +} + +func (pt *pollingTrackerBase) updateRawBody() error { + pt.rawBody = map[string]interface{}{} + if pt.resp.ContentLength != 0 { + defer pt.resp.Body.Close() + b, err := ioutil.ReadAll(pt.resp.Body) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body") + } + // put the body back so it's available to other callers + pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) + if err = json.Unmarshal(b, &pt.rawBody); err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to unmarshal response body") + } + } + return nil +} + +func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error { + req, err := http.NewRequest(http.MethodGet, pt.URI, nil) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request") + } + // attach the context from the original request if available (it will be absent for deserialized futures) + if pt.resp != nil { + req = req.WithContext(pt.resp.Request.Context()) + } + pt.resp, err = sender.Do(req) + if err != nil { + return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request") + } + if autorest.ResponseHasStatusCode(pt.resp, pollingCodes[:]...) { + // reset the service error on success case + pt.Err = nil + err = pt.updateRawBody() + } else { + // check response body for error content + pt.updateErrorFromResponse() + } + return err +} + +// attempts to unmarshal a ServiceError type from the response body. +// if that fails then make a best attempt at creating something meaningful. +func (pt *pollingTrackerBase) updateErrorFromResponse() { + var err error + if pt.resp.ContentLength != 0 { + type respErr struct { + ServiceError *ServiceError `json:"error"` + } + re := respErr{} + defer pt.resp.Body.Close() + var b []byte + b, err = ioutil.ReadAll(pt.resp.Body) + if err != nil { + goto Default + } + if err = json.Unmarshal(b, &re); err != nil { + goto Default + } + // unmarshalling the error didn't yield anything, try unwrapped error + if re.ServiceError == nil { + err = json.Unmarshal(b, &re.ServiceError) + if err != nil { + goto Default + } + } + if re.ServiceError != nil { + pt.Err = re.ServiceError + return + } + } +Default: + se := &ServiceError{ + Code: fmt.Sprintf("HTTP status code %v", pt.resp.StatusCode), + Message: pt.resp.Status, + } + if err != nil { + se.InnerError = make(map[string]interface{}) + se.InnerError["unmarshalError"] = err.Error() + } + pt.Err = se +} + +func (pt *pollingTrackerBase) updatePollingState(provStateApl bool) error { + if pt.Pm == PollingAsyncOperation && pt.rawBody["status"] != nil { + pt.State = pt.rawBody["status"].(string) + } else { + if pt.resp.StatusCode == http.StatusAccepted { + pt.State = operationInProgress + } else if provStateApl { + if ps := pt.getProvisioningState(); ps != nil { + pt.State = *ps + } else { + pt.State = operationSucceeded + } + } else { + return autorest.NewError("pollingTrackerBase", "updatePollingState", "the response from the async operation has an invalid status code") + } + } + // if the operation has failed update the error state + if pt.hasFailed() { + pt.updateErrorFromResponse() + } + return nil +} + +func (pt pollingTrackerBase) pollingError() error { + if pt.Err == nil { + return nil + } + return pt.Err +} + +func (pt pollingTrackerBase) pollingMethod() PollingMethodType { + return pt.Pm +} + +func (pt pollingTrackerBase) pollingStatus() string { + return pt.State +} + +func (pt pollingTrackerBase) pollingURL() string { + return pt.URI +} + +func (pt pollingTrackerBase) finalGetURL() string { + return pt.FinalGetURI +} + +func (pt pollingTrackerBase) hasTerminated() bool { + return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) || strings.EqualFold(pt.State, operationSucceeded) +} + +func (pt pollingTrackerBase) hasFailed() bool { + return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) +} + +func (pt pollingTrackerBase) hasSucceeded() bool { + return strings.EqualFold(pt.State, operationSucceeded) +} + +func (pt pollingTrackerBase) latestResponse() *http.Response { + return pt.resp +} + +// error checking common to all trackers +func (pt pollingTrackerBase) baseCheckForErrors() error { + // for Azure-AsyncOperations the response body cannot be nil or empty + if pt.Pm == PollingAsyncOperation { + if pt.resp.Body == nil || pt.resp.ContentLength == 0 { + return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "for Azure-AsyncOperation response body cannot be nil") + } + if pt.rawBody["status"] == nil { + return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "missing status property in Azure-AsyncOperation response body") + } + } + return nil +} + +// DELETE + +type pollingTrackerDelete struct { + pollingTrackerBase +} + +func (pt *pollingTrackerDelete) updateHeaders() error { + // for 201 the Location header is required + if pt.resp.StatusCode == http.StatusCreated { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerDelete", "updateHeaders", "missing Location header in 201 response") + } else { + pt.URI = lh + } + pt.Pm = PollingLocation + pt.FinalGetURI = pt.URI + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation + } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } + } + return nil +} + +func (pt pollingTrackerDelete) checkForErrors() error { + return pt.baseCheckForErrors() +} + +func (pt pollingTrackerDelete) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent +} + +// PATCH + +type pollingTrackerPatch struct { + pollingTrackerBase +} + +func (pt *pollingTrackerPatch) updateHeaders() error { + // by default we can use the original URL for polling and final GET + if pt.URI == "" { + pt.URI = pt.resp.Request.URL.String() + } + if pt.FinalGetURI == "" { + pt.FinalGetURI = pt.resp.Request.URL.String() + } + if pt.Pm == PollingUnknown { + pt.Pm = PollingRequestURI + } + // for 201 it's permissible for no headers to be returned + if pt.resp.StatusCode == http.StatusCreated { + if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + // note the absense of the "final GET" mechanism for PATCH + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + if ao == "" { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerPatch", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } else { + pt.URI = lh + pt.Pm = PollingLocation + } + } + } + return nil +} + +func (pt pollingTrackerPatch) checkForErrors() error { + return pt.baseCheckForErrors() +} + +func (pt pollingTrackerPatch) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated +} + +// POST + +type pollingTrackerPost struct { + pollingTrackerBase +} + +func (pt *pollingTrackerPost) updateHeaders() error { + // 201 requires Location header + if pt.resp.StatusCode == http.StatusCreated { + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "missing Location header in 201 response") + } else { + pt.URI = lh + pt.FinalGetURI = lh + pt.Pm = PollingLocation + } + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation + } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } + } + return nil +} + +func (pt pollingTrackerPost) checkForErrors() error { + return pt.baseCheckForErrors() +} + +func (pt pollingTrackerPost) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent +} + +// PUT + +type pollingTrackerPut struct { + pollingTrackerBase +} + +func (pt *pollingTrackerPut) updateHeaders() error { + // by default we can use the original URL for polling and final GET + if pt.URI == "" { + pt.URI = pt.resp.Request.URL.String() + } + if pt.FinalGetURI == "" { + pt.FinalGetURI = pt.resp.Request.URL.String() + } + if pt.Pm == PollingUnknown { + pt.Pm = PollingRequestURI + } + // for 201 it's permissible for no headers to be returned + if pt.resp.StatusCode == http.StatusCreated { + if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + } + // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary + if pt.resp.StatusCode == http.StatusAccepted { + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + } + // if the Location header is invalid and we already have a polling URL + // then we don't care if the Location header URL is malformed. + if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { + return err + } else if lh != "" { + if ao == "" { + pt.URI = lh + pt.Pm = PollingLocation + } + // when both headers are returned we use the value in the Location header for the final GET + pt.FinalGetURI = lh + } + // make sure a polling URL was found + if pt.URI == "" { + return autorest.NewError("pollingTrackerPut", "updateHeaders", "didn't get any suitable polling URLs in 202 response") + } + } + return nil +} + +func (pt pollingTrackerPut) checkForErrors() error { + err := pt.baseCheckForErrors() + if err != nil { + return err + } + // if there are no LRO headers then the body cannot be empty + ao, err := getURLFromAsyncOpHeader(pt.resp) + if err != nil { + return err + } + lh, err := getURLFromLocationHeader(pt.resp) + if err != nil { + return err + } + if ao == "" && lh == "" && len(pt.rawBody) == 0 { + return autorest.NewError("pollingTrackerPut", "checkForErrors", "the response did not contain a body") + } + return nil +} + +func (pt pollingTrackerPut) provisioningStateApplicable() bool { + return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated +} + +// creates a polling tracker based on the verb of the original request +func createPollingTracker(resp *http.Response) (pollingTracker, error) { + var pt pollingTracker + switch strings.ToUpper(resp.Request.Method) { + case http.MethodDelete: + pt = &pollingTrackerDelete{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPatch: + pt = &pollingTrackerPatch{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPost: + pt = &pollingTrackerPost{pollingTrackerBase: pollingTrackerBase{resp: resp}} + case http.MethodPut: + pt = &pollingTrackerPut{pollingTrackerBase: pollingTrackerBase{resp: resp}} + default: + return nil, autorest.NewError("azure", "createPollingTracker", "unsupported HTTP method %s", resp.Request.Method) + } + if err := pt.initializeState(); err != nil { + return pt, err + } + // this initializes the polling header values, we do this during creation in case the + // initial response send us invalid values; this way the API call will return a non-nil + // error (not doing this means the error shows up in Future.Done) + return pt, pt.updateHeaders() +} + +// gets the polling URL from the Azure-AsyncOperation header. +// ensures the URL is well-formed and absolute. +func getURLFromAsyncOpHeader(resp *http.Response) (string, error) { + s := resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) + if s == "" { + return "", nil + } + if !isValidURL(s) { + return "", autorest.NewError("azure", "getURLFromAsyncOpHeader", "invalid polling URL '%s'", s) + } + return s, nil +} + +// gets the polling URL from the Location header. +// ensures the URL is well-formed and absolute. +func getURLFromLocationHeader(resp *http.Response) (string, error) { + s := resp.Header.Get(http.CanonicalHeaderKey(autorest.HeaderLocation)) + if s == "" { + return "", nil + } + if !isValidURL(s) { + return "", autorest.NewError("azure", "getURLFromLocationHeader", "invalid polling URL '%s'", s) + } + return s, nil +} + +// verify that the URL is valid and absolute +func isValidURL(s string) bool { + u, err := url.Parse(s) + return err == nil && u.IsAbs() } // DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure // long-running operation. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by -// closing the optional channel on the http.Request. +// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled via +// the context associated with the http.Request. +// Deprecated: Prefer using Futures to allow for non-blocking async operations. func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - resp, err = s.Do(r) + return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) if err != nil { return resp, err } if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { return resp, nil } - - ps := pollingState{} - for err == nil { - err = updatePollingState(resp, &ps) - if err != nil { - break - } - if ps.hasTerminated() { - if !ps.hasSucceeded() { - err = ps - } - break - } - - r, err = newPollingRequest(ps) - if err != nil { - return resp, err - } - r.Cancel = resp.Request.Cancel - - delay = autorest.GetRetryAfter(resp, delay) - resp, err = autorest.SendWithSender(s, r, - autorest.AfterDelay(delay)) + future, err := NewFutureFromResponse(resp) + if err != nil { + return resp, err } - - return resp, err + // retry until either the LRO completes or we receive an error + var done bool + for done, err = future.Done(s); !done && err == nil; done, err = future.Done(s) { + // check for Retry-After delay, if not present use the specified polling delay + if pd, ok := future.GetPollingDelay(); ok { + delay = pd + } + // wait until the delay elapses or the context is cancelled + if delayElapsed := autorest.DelayForBackoff(delay, 0, r.Context().Done()); !delayElapsed { + return future.Response(), + autorest.NewErrorWithError(r.Context().Err(), "azure", "DoPollForAsynchronous", future.Response(), "context has been cancelled") + } + } + return future.Response(), err }) } } -func getAsyncOperation(resp *http.Response) string { - return resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) -} - -func hasSucceeded(state string) bool { - return strings.EqualFold(state, operationSucceeded) -} - -func hasTerminated(state string) bool { - return strings.EqualFold(state, operationCanceled) || strings.EqualFold(state, operationFailed) || strings.EqualFold(state, operationSucceeded) -} - -func hasFailed(state string) bool { - return strings.EqualFold(state, operationFailed) -} - -type provisioningTracker interface { - state() string - hasSucceeded() bool - hasTerminated() bool -} - -type operationResource struct { - // Note: - // The specification states services should return the "id" field. However some return it as - // "operationId". - ID string `json:"id"` - OperationID string `json:"operationId"` - Name string `json:"name"` - Status string `json:"status"` - Properties map[string]interface{} `json:"properties"` - OperationError ServiceError `json:"error"` - StartTime date.Time `json:"startTime"` - EndTime date.Time `json:"endTime"` - PercentComplete float64 `json:"percentComplete"` -} - -func (or operationResource) state() string { - return or.Status -} - -func (or operationResource) hasSucceeded() bool { - return hasSucceeded(or.state()) -} - -func (or operationResource) hasTerminated() bool { - return hasTerminated(or.state()) -} - -type provisioningProperties struct { - ProvisioningState string `json:"provisioningState"` -} - -type provisioningStatus struct { - Properties provisioningProperties `json:"properties,omitempty"` - ProvisioningError ServiceError `json:"error,omitempty"` -} - -func (ps provisioningStatus) state() string { - return ps.Properties.ProvisioningState -} - -func (ps provisioningStatus) hasSucceeded() bool { - return hasSucceeded(ps.state()) -} - -func (ps provisioningStatus) hasTerminated() bool { - return hasTerminated(ps.state()) -} - -func (ps provisioningStatus) hasProvisioningError() bool { - // code and message are required fields so only check them - return len(ps.ProvisioningError.Code) > 0 || - len(ps.ProvisioningError.Message) > 0 -} - // PollingMethodType defines a type used for enumerating polling mechanisms. type PollingMethodType string @@ -347,151 +890,13 @@ const ( // PollingLocation indicates the polling method uses the Location header. PollingLocation PollingMethodType = "Location" + // PollingRequestURI indicates the polling method uses the original request URI. + PollingRequestURI PollingMethodType = "RequestURI" + // PollingUnknown indicates an unknown polling method and is the default value. PollingUnknown PollingMethodType = "" ) -type pollingState struct { - PollingMethod PollingMethodType `json:"pollingMethod"` - URI string `json:"uri"` - State string `json:"state"` - ServiceError *ServiceError `json:"error,omitempty"` -} - -func (ps pollingState) hasSucceeded() bool { - return hasSucceeded(ps.State) -} - -func (ps pollingState) hasTerminated() bool { - return hasTerminated(ps.State) -} - -func (ps pollingState) hasFailed() bool { - return hasFailed(ps.State) -} - -func (ps pollingState) Error() string { - s := fmt.Sprintf("Long running operation terminated with status '%s'", ps.State) - if ps.ServiceError != nil { - s = fmt.Sprintf("%s: %+v", s, *ps.ServiceError) - } - return s -} - -// updatePollingState maps the operation status -- retrieved from either a provisioningState -// field, the status field of an OperationResource, or inferred from the HTTP status code -- -// into a well-known states. Since the process begins from the initial request, the state -// always comes from either a the provisioningState returned or is inferred from the HTTP -// status code. Subsequent requests will read an Azure OperationResource object if the -// service initially returned the Azure-AsyncOperation header. The responseFormat field notes -// the expected response format. -func updatePollingState(resp *http.Response, ps *pollingState) error { - // Determine the response shape - // -- The first response will always be a provisioningStatus response; only the polling requests, - // depending on the header returned, may be something otherwise. - var pt provisioningTracker - if ps.PollingMethod == PollingAsyncOperation { - pt = &operationResource{} - } else { - pt = &provisioningStatus{} - } - - // If this is the first request (that is, the polling response shape is unknown), determine how - // to poll and what to expect - if ps.PollingMethod == PollingUnknown { - req := resp.Request - if req == nil { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Original HTTP request is missing") - } - - // Prefer the Azure-AsyncOperation header - ps.URI = getAsyncOperation(resp) - if ps.URI != "" { - ps.PollingMethod = PollingAsyncOperation - } else { - ps.PollingMethod = PollingLocation - } - - // Else, use the Location header - if ps.URI == "" { - ps.URI = autorest.GetLocation(resp) - } - - // Lastly, requests against an existing resource, use the last request URI - if ps.URI == "" { - m := strings.ToUpper(req.Method) - if m == http.MethodPatch || m == http.MethodPut || m == http.MethodGet { - ps.URI = req.URL.String() - } - } - } - - // Read and interpret the response (saving the Body in case no polling is necessary) - b := &bytes.Buffer{} - err := autorest.Respond(resp, - autorest.ByCopying(b), - autorest.ByUnmarshallingJSON(pt), - autorest.ByClosing()) - resp.Body = ioutil.NopCloser(b) - if err != nil { - return err - } - - // Interpret the results - // -- Terminal states apply regardless - // -- Unknown states are per-service inprogress states - // -- Otherwise, infer state from HTTP status code - if pt.hasTerminated() { - ps.State = pt.state() - } else if pt.state() != "" { - ps.State = operationInProgress - } else { - switch resp.StatusCode { - case http.StatusAccepted: - ps.State = operationInProgress - - case http.StatusNoContent, http.StatusCreated, http.StatusOK: - ps.State = operationSucceeded - - default: - ps.State = operationFailed - } - } - - if strings.EqualFold(ps.State, operationInProgress) && ps.URI == "" { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", resp.Request.Method, resp.Request.URL) - } - - // For failed operation, check for error code and message in - // -- Operation resource - // -- Response - // -- Otherwise, Unknown - if ps.hasFailed() { - if or, ok := pt.(*operationResource); ok { - ps.ServiceError = &or.OperationError - } else if p, ok := pt.(*provisioningStatus); ok && p.hasProvisioningError() { - ps.ServiceError = &p.ProvisioningError - } else { - ps.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "None", - } - } - } - return nil -} - -func newPollingRequest(ps pollingState) (*http.Request, error) { - reqPoll, err := autorest.Prepare(&http.Request{}, - autorest.AsGet(), - autorest.WithBaseURL(ps.URI)) - if err != nil { - return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.URI) - } - - return reqPoll, nil -} - // AsyncOpIncompleteError is the type that's returned from a future that has not completed. type AsyncOpIncompleteError struct { // FutureType is the name of the type composed of a azure.Future. diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go index 18d029526..a702ffe75 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go @@ -279,16 +279,29 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { resp.Body = ioutil.NopCloser(&b) if decodeErr != nil { return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr) - } else if e.ServiceError == nil { + } + if e.ServiceError == nil { // Check if error is unwrapped ServiceError - if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil || e.ServiceError.Message == "" { - e.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "Unknown service error", - } + if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil { + return err } } - + if e.ServiceError.Message == "" { + // if we're here it means the returned error wasn't OData v4 compliant. + // try to unmarshal the body as raw JSON in hopes of getting something. + rawBody := map[string]interface{}{} + if err := json.Unmarshal(b.Bytes(), &rawBody); err != nil { + return err + } + e.ServiceError = &ServiceError{ + Code: "Unknown", + Message: "Unknown service error", + } + if len(rawBody) > 0 { + e.ServiceError.Details = []map[string]interface{}{rawBody} + } + } + e.Response = resp e.RequestID = ExtractRequestID(resp) if e.StatusCode == nil { e.StatusCode = resp.StatusCode diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go index 2c88d60ba..bd34f0ed5 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go @@ -64,7 +64,7 @@ func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { } } } - return resp, fmt.Errorf("failed request: %s", err) + return resp, err }) } } @@ -115,7 +115,7 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError if err != nil { return err } - req.Cancel = originalReq.Cancel + req = req.WithContext(originalReq.Context()) resp, err := autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...), @@ -154,7 +154,7 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError if err != nil { return err } - req.Cancel = originalReq.Cancel + req = req.WithContext(originalReq.Context()) resp, err := autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...), @@ -178,9 +178,9 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError break } - delayed := autorest.DelayWithRetryAfter(resp, originalReq.Cancel) - if !delayed { - autorest.DelayForBackoff(client.PollingDelay, 0, originalReq.Cancel) + delayed := autorest.DelayWithRetryAfter(resp, originalReq.Context().Done()) + if !delayed && !autorest.DelayForBackoff(client.PollingDelay, 0, originalReq.Context().Done()) { + return originalReq.Context().Err() } } if !(time.Since(now) < client.PollingDuration) { diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go index 80ca60e9b..c45710656 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/date.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/date.go @@ -5,6 +5,20 @@ time.Time types. And both convert to time.Time through a ToTime method. */ package date +// Copyright 2017 Microsoft Corporation +// +// 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. + import ( "fmt" "time" diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go index c1af62963..b453fad04 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/time.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/time.go @@ -1,5 +1,19 @@ package date +// Copyright 2017 Microsoft Corporation +// +// 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. + import ( "regexp" "time" diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go index 11995fb9f..48fb39ba9 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go @@ -1,5 +1,19 @@ package date +// Copyright 2017 Microsoft Corporation +// +// 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. + import ( "errors" "time" diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go index e085c77ee..7073959b2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go @@ -1,5 +1,19 @@ package date +// Copyright 2017 Microsoft Corporation +// +// 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. + import ( "bytes" "encoding/binary" diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go index 207b1a240..12addf0eb 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go @@ -1,5 +1,19 @@ package date +// Copyright 2017 Microsoft Corporation +// +// 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. + import ( "strings" "time" diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go index c5efd59a2..cacbd8157 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/sender.go +++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go @@ -86,7 +86,7 @@ func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*ht func AfterDelay(d time.Duration) SendDecorator { return func(s Sender) Sender { return SenderFunc(func(r *http.Request) (*http.Response, error) { - if !DelayForBackoff(d, 0, r.Cancel) { + if !DelayForBackoff(d, 0, r.Context().Done()) { return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay") } return s.Do(r) @@ -165,7 +165,7 @@ func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ... resp, err = s.Do(r) if err == nil && ResponseHasStatusCode(resp, codes...) { - r, err = NewPollingRequest(resp, r.Cancel) + r, err = NewPollingRequestWithContext(r.Context(), resp) for err == nil && ResponseHasStatusCode(resp, codes...) { Respond(resp, @@ -198,7 +198,9 @@ func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator { if err == nil { return resp, err } - DelayForBackoff(backoff, attempt, r.Cancel) + if !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return nil, r.Context().Err() + } } return resp, err }) @@ -221,14 +223,18 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se return resp, err } resp, err = s.Do(rr.Request()) + // if the error isn't temporary don't bother retrying + if err != nil && !IsTemporaryNetworkError(err) { + return nil, err + } // we want to retry if err is not nil (e.g. transient network failure). note that for failed authentication // resp and err will both have a value, so in this case we don't want to retry as it will never succeed. if err == nil && !ResponseHasStatusCode(resp, codes...) || IsTokenRefreshError(err) { return resp, err } - delayed := DelayWithRetryAfter(resp, r.Cancel) - if !delayed { - DelayForBackoff(backoff, attempt, r.Cancel) + delayed := DelayWithRetryAfter(resp, r.Context().Done()) + if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return nil, r.Context().Err() } // don't count a 429 against the number of attempts // so that we continue to retry until it succeeds @@ -277,7 +283,9 @@ func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator { if err == nil { return resp, err } - DelayForBackoff(backoff, attempt, r.Cancel) + if !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return nil, r.Context().Err() + } } return resp, err }) diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go index 7b180b866..fdda2ce1a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go @@ -3,6 +3,20 @@ Package to provides helpers to ease working with pointer values of marshalled st */ package to +// Copyright 2017 Microsoft Corporation +// +// 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. + // String returns a string value for the passed string pointer. It returns the empty string if the // pointer is nil. func String(s *string) string { diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go index afb3e4e16..bfddd90b5 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go @@ -20,6 +20,7 @@ import ( "encoding/xml" "fmt" "io" + "net" "net/http" "net/url" "reflect" @@ -216,3 +217,12 @@ func IsTokenRefreshError(err error) bool { } return false } + +// IsTemporaryNetworkError returns true if the specified error is a temporary network error or false +// if it's not. If the error doesn't implement the net.Error interface the return value is true. +func IsTemporaryNetworkError(err error) bool { + if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { + return true + } + return false +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go index d886e0b3f..ae987f8fa 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -136,29 +136,29 @@ func validatePtr(x reflect.Value, v Constraint) error { func validateInt(x reflect.Value, v Constraint) error { i := x.Int() - r, ok := v.Rule.(int) + r, ok := toInt64(v.Rule) if !ok { return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) } switch v.Name { case MultipleOf: - if i%int64(r) != 0 { + if i%r != 0 { return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) } case ExclusiveMinimum: - if i <= int64(r) { + if i <= r { return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) } case ExclusiveMaximum: - if i >= int64(r) { + if i >= r { return createError(x, v, fmt.Sprintf("value must be less than %v", r)) } case InclusiveMinimum: - if i < int64(r) { + if i < r { return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) } case InclusiveMaximum: - if i > int64(r) { + if i > r { return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) } default: @@ -388,6 +388,17 @@ func createError(x reflect.Value, v Constraint, err string) error { v.Target, v.Name, getInterfaceValue(x), err) } +func toInt64(v interface{}) (int64, bool) { + if i64, ok := v.(int64); ok { + return i64, true + } + // older generators emit max constants as int, so if int64 fails fall back to int + if i32, ok := v.(int); ok { + return int64(i32), true + } + return 0, false +} + // NewErrorWithValidationError appends package type and method name in // validation error. // diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go index f900ef8b5..e32cd68fe 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/version.go +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -16,5 +16,5 @@ package autorest // Version returns the semantic version (see http://semver.org). func Version() string { - return "v10.3.0" + return "v10.12.0" } diff --git a/vendor/vendor.json b/vendor/vendor.json index c519a1e0e..203593780 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -65,56 +65,56 @@ "versionExact": "v17.3.1" }, { - "checksumSHA1": "+P6HOINDh/n2z4GqEkluzuGP5p0=", + "checksumSHA1": "q3bhLdUVAz5dmDFvfKJJSTd/BaE=", "comment": "v7.0.7", "path": "github.com/Azure/go-autorest/autorest", - "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", - "revisionTime": "2018-03-26T17:06:54Z", - "version": "v10.4.0", - "versionExact": "v10.4.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { - "checksumSHA1": "HzA52MbMWnsR31CFrub5biN90/Q=", + "checksumSHA1": "Ygkay0Aq7zeg8A9DSRWI+flRcFk=", "path": "github.com/Azure/go-autorest/autorest/adal", - "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", - "revisionTime": "2018-03-26T17:06:54Z", - "version": "v10.4.0", - "versionExact": "v10.4.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { - "checksumSHA1": "bDFbLGwpCT8TRmqEKtPY/U1DAY8=", + "checksumSHA1": "O8hvZ5SZ6o/mGOTivIagc1uPdl4=", "comment": "v7.0.7", "path": "github.com/Azure/go-autorest/autorest/azure", - "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", - "revisionTime": "2018-03-26T17:06:54Z", - "version": "v10.4.0", - "versionExact": "v10.4.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { - "checksumSHA1": "LSF/pNrjhIxl6jiS6bKooBFCOxI=", + "checksumSHA1": "KcxXWvXhVIkfqdGR+TQqWyCbgZk=", "comment": "v7.0.7", "path": "github.com/Azure/go-autorest/autorest/date", - "revision": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d", - "revisionTime": "2017-04-28T17:52:31Z", - "version": "=v8.0.0", - "versionExact": "v8.0.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { - "checksumSHA1": "Ev8qCsbFjDlMlX0N2tYAhYQFpUc=", + "checksumSHA1": "8XiRKZWE6XGsb0eJfG4P98JwaXw=", "comment": "v7.0.7", "path": "github.com/Azure/go-autorest/autorest/to", - "revision": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d", - "revisionTime": "2017-04-28T17:52:31Z", - "version": "=v8.0.0", - "versionExact": "v8.0.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { - "checksumSHA1": "CdDkG+J8wqXQVQ0f0xal+eolB1w=", + "checksumSHA1": "SVU/fTZ9osBm+WPdd5y71RabAzE=", "path": "github.com/Azure/go-autorest/autorest/validation", - "revision": "ed4b7f5bf1ec0c9ede1fda2681d96771282f2862", - "revisionTime": "2018-03-26T17:06:54Z", - "version": "v10.4.0", - "versionExact": "v10.4.0" + "revision": "1f7cd6cfe0adea687ad44a512dfe76140f804318", + "revisionTime": "2018-06-28T21:22:21Z", + "version": "v10.12.0", + "versionExact": "v10.12.0" }, { "checksumSHA1": "TgrN0l/E16deTlLYNt8wf66urSU=",