Update Azure dependencies.

Add go-ntlmssp.

blah
This commit is contained in:
Christopher Boumenot 2016-04-21 16:48:57 -07:00 committed by Chris Bednarski
parent 52f934b328
commit 0abf0bbab0
180 changed files with 181236 additions and 2226 deletions

49
Godeps/Godeps.json generated
View file

@ -10,48 +10,57 @@
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/compute",
"Comment": "v1.2-334-g95361a2",
"Rev": "95361a2573b1fa92a00c5fc2707a80308483c6f9"
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/network",
"Comment": "v1.2-334-g95361a2",
"Rev": "95361a2573b1fa92a00c5fc2707a80308483c6f9"
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/resources/resources",
"Comment": "v1.2-334-g95361a2",
"Rev": "95361a2573b1fa92a00c5fc2707a80308483c6f9"
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions",
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/storage",
"Comment": "v1.2-334-g95361a2",
"Rev": "95361a2573b1fa92a00c5fc2707a80308483c6f9"
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/storage",
"Comment": "v1.2-334-g95361a2",
"Rev": "95361a2573b1fa92a00c5fc2707a80308483c6f9"
"Comment": "v2.1.1-beta",
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest",
"Comment": "v3.0.0-32-gbebca45",
"Rev": "bebca455f60b24bf6a2459e9e862ff42da86f5e0"
"Comment": "v7.0.4",
"Rev": "b01ec2b60f95678fa759f796bac3c6b9bceaead4"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/azure",
"Comment": "v3.0.0-32-gbebca45",
"Rev": "bebca455f60b24bf6a2459e9e862ff42da86f5e0"
"Comment": "v7.0.4",
"Rev": "b01ec2b60f95678fa759f796bac3c6b9bceaead4"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/date",
"Comment": "v3.0.0-32-gbebca45",
"Rev": "bebca455f60b24bf6a2459e9e862ff42da86f5e0"
"Comment": "v7.0.4",
"Rev": "b01ec2b60f95678fa759f796bac3c6b9bceaead4"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/to",
"Comment": "v3.0.0-32-gbebca45",
"Rev": "bebca455f60b24bf6a2459e9e862ff42da86f5e0"
"Comment": "v7.0.4",
"Rev": "b01ec2b60f95678fa759f796bac3c6b9bceaead4"
},
{
"ImportPath": "github.com/Azure/go-ntlmssp",
"Rev": "e0b63eb299a769ea4b04dadfe530f6074b277afb"
},
{
"ImportPath": "github.com/armon/go-radix",
@ -499,6 +508,10 @@
"ImportPath": "golang.org/x/crypto/curve25519",
"Rev": "1f22c0103821b9390939b6776727195525381532"
},
{
"ImportPath": "golang.org/x/crypto/md4",
"Rev": "1f22c0103821b9390939b6776727195525381532"
},
{
"ImportPath": "golang.org/x/crypto/ssh",
"Rev": "1f22c0103821b9390939b6776727195525381532"

View file

@ -47,21 +47,21 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string)
// resourceGroupName is the name of the resource group. name is parameters
// supplied to the Create Availability Set operation. parameters is
// parameters supplied to the Create Availability Set operation.
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, ae error) {
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -92,7 +92,7 @@ func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName st
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -112,21 +112,21 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
//
// resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set.
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result autorest.Response, ae error) {
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request")
}
return
@ -156,7 +156,7 @@ func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, av
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -175,21 +175,21 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul
//
// resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set.
func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, ae error) {
func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
req, err := client.GetPreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request")
}
return
@ -219,7 +219,7 @@ func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, avail
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -238,21 +238,21 @@ func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result A
// List the operation to list the availability sets.
//
// resourceGroupName is the name of the resource group.
func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, ae error) {
func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request")
}
return
@ -281,7 +281,7 @@ func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*ht
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -298,10 +298,10 @@ func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result
}
// ListNextResults retrieves the next set of results, if any.
func (client AvailabilitySetsClient) ListNextResults(lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, ae error) {
func (client AvailabilitySetsClient) ListNextResults(lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) {
req, err := lastResults.AvailabilitySetListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -310,12 +310,12 @@ func (client AvailabilitySetsClient) ListNextResults(lastResults AvailabilitySet
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -326,21 +326,21 @@ func (client AvailabilitySetsClient) ListNextResults(lastResults AvailabilitySet
//
// resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set.
func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, ae error) {
func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
req, err := client.ListAvailableSizesPreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
}
resp, err := client.ListAvailableSizesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
}
result, err = client.ListAvailableSizesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request")
}
return
@ -370,7 +370,7 @@ func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupNam
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
// http.Response Body if it receives an error.
func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
@ -387,10 +387,10 @@ func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Resp
}
// ListAvailableSizesNextResults retrieves the next set of results, if any.
func (client AvailabilitySetsClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, ae error) {
func (client AvailabilitySetsClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
req, err := lastResults.VirtualMachineSizeListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -399,12 +399,12 @@ func (client AvailabilitySetsClient) ListAvailableSizesNextResults(lastResults V
resp, err := client.ListAvailableSizesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending next results request request")
}
result, err = client.ListAvailableSizesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
}
return

View file

@ -1,7 +1,7 @@
// Package compute implements the Azure ARM Compute service API version
// 2015-06-15.
//
// The Compute Management Client..
// The Compute Management Client.
package compute
// Copyright (c) Microsoft and contributors. All rights reserved.

View file

@ -394,8 +394,8 @@ func (client AvailabilitySetListResult) AvailabilitySetListResultPreparer() (*ht
// AvailabilitySetProperties is the instance view of a resource.
type AvailabilitySetProperties struct {
PlatformUpdateDomainCount *int `json:"platformUpdateDomainCount,omitempty"`
PlatformFaultDomainCount *int `json:"platformFaultDomainCount,omitempty"`
PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"`
PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"`
VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"`
Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
}
@ -415,18 +415,18 @@ type BootDiagnosticsInstanceView struct {
// DataDisk is describes a data disk.
type DataDisk struct {
Lun *int `json:"lun,omitempty"`
Lun *int32 `json:"lun,omitempty"`
Name *string `json:"name,omitempty"`
Vhd *VirtualHardDisk `json:"vhd,omitempty"`
Image *VirtualHardDisk `json:"image,omitempty"`
Caching CachingTypes `json:"caching,omitempty"`
CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
DiskSizeGB *int `json:"diskSizeGB,omitempty"`
DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
}
// DataDiskImage is contains the data disk images information.
type DataDiskImage struct {
Lun *int `json:"lun,omitempty"`
Lun *int32 `json:"lun,omitempty"`
}
// DeleteOperationResult is the compute long running operation response.
@ -520,6 +520,12 @@ func (client ListUsagesResult) ListUsagesResultPreparer() (*http.Request, error)
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ListVirtualMachineImageResource is
type ListVirtualMachineImageResource struct {
autorest.Response `json:"-"`
Value *[]VirtualMachineImageResource `json:"value,omitempty"`
}
// LongRunningOperationProperties is compute-specific operation properties,
// including output
type LongRunningOperationProperties struct {
@ -563,7 +569,7 @@ type OSDisk struct {
Image *VirtualHardDisk `json:"image,omitempty"`
Caching CachingTypes `json:"caching,omitempty"`
CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
DiskSizeGB *int `json:"diskSizeGB,omitempty"`
DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
}
// OSDiskImage is contains the os disk image information.
@ -611,7 +617,7 @@ type Resource struct {
type Sku struct {
Name *string `json:"name,omitempty"`
Tier *string `json:"tier,omitempty"`
Capacity *int32 `json:"capacity,omitempty"`
Capacity *int64 `json:"capacity,omitempty"`
}
// SSHConfiguration is sSH configuration for Linux based VMs running on Azure
@ -646,8 +652,8 @@ type UpgradePolicy struct {
// Usage is describes Compute Resource Usage.
type Usage struct {
Unit UsageUnit `json:"unit,omitempty"`
CurrentValue *int `json:"currentValue,omitempty"`
Limit *int32 `json:"limit,omitempty"`
CurrentValue *int32 `json:"currentValue,omitempty"`
Limit *int64 `json:"limit,omitempty"`
Name *UsageName `json:"name,omitempty"`
}
@ -805,16 +811,10 @@ type VirtualMachineImageResource struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// VirtualMachineImageResourceList is
type VirtualMachineImageResourceList struct {
autorest.Response `json:"-"`
Value *VirtualMachineImageResource `json:"value,omitempty"`
}
// VirtualMachineInstanceView is the instance view of a virtual machine.
type VirtualMachineInstanceView struct {
PlatformUpdateDomain *int `json:"platformUpdateDomain,omitempty"`
PlatformFaultDomain *int `json:"platformFaultDomain,omitempty"`
PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"`
PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"`
RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"`
VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"`
Disks *[]DiskInstanceView `json:"disks,omitempty"`
@ -1044,9 +1044,9 @@ type VirtualMachineScaleSetSku struct {
// VirtualMachineScaleSetSkuCapacity is describes scaling information of a sku.
type VirtualMachineScaleSetSkuCapacity struct {
Minimum *int32 `json:"minimum,omitempty"`
Maximum *int32 `json:"maximum,omitempty"`
DefaultCapacity *int32 `json:"defaultCapacity,omitempty"`
Minimum *int64 `json:"minimum,omitempty"`
Maximum *int64 `json:"maximum,omitempty"`
DefaultCapacity *int64 `json:"defaultCapacity,omitempty"`
ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"`
}
@ -1096,8 +1096,8 @@ type VirtualMachineScaleSetVMInstanceRequiredIDs struct {
// machine scale set VM.
type VirtualMachineScaleSetVMInstanceView struct {
autorest.Response `json:"-"`
PlatformUpdateDomain *int `json:"platformUpdateDomain,omitempty"`
PlatformFaultDomain *int `json:"platformFaultDomain,omitempty"`
PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"`
PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"`
RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"`
VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"`
Disks *[]DiskInstanceView `json:"disks,omitempty"`
@ -1152,11 +1152,11 @@ type VirtualMachineScaleSetVMProperties struct {
// VirtualMachineSize is describes the properties of a VM size.
type VirtualMachineSize struct {
Name *string `json:"name,omitempty"`
NumberOfCores *int `json:"numberOfCores,omitempty"`
OsDiskSizeInMB *int `json:"osDiskSizeInMB,omitempty"`
ResourceDiskSizeInMB *int `json:"resourceDiskSizeInMB,omitempty"`
MemoryInMB *int `json:"memoryInMB,omitempty"`
MaxDataDiskCount *int `json:"maxDataDiskCount,omitempty"`
NumberOfCores *int32 `json:"numberOfCores,omitempty"`
OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"`
ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"`
MemoryInMB *int32 `json:"memoryInMB,omitempty"`
MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"`
}
// VirtualMachineSizeListResult is the List Virtual Machine operation response.
@ -1182,7 +1182,7 @@ func (client VirtualMachineSizeListResult) VirtualMachineSizeListResultPreparer(
// machine scale set instance view status summary.
type VirtualMachineStatusCodeCount struct {
Code *string `json:"code,omitempty"`
Count *int `json:"count,omitempty"`
Count *int32 `json:"count,omitempty"`
}
// WindowsConfiguration is describes Windows Configuration of the OS Profile.

View file

@ -45,21 +45,21 @@ func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string)
// List lists compute usages for a subscription.
//
// location is the location upon which resource usage is queried.
func (client UsageOperationsClient) List(location string) (result ListUsagesResult, ae error) {
func (client UsageOperationsClient) List(location string) (result ListUsagesResult, err error) {
req, err := client.ListPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to request")
}
return
@ -88,7 +88,7 @@ func (client UsageOperationsClient) ListPreparer(location string) (*http.Request
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -105,10 +105,10 @@ func (client UsageOperationsClient) ListResponder(resp *http.Response) (result L
}
// ListNextResults retrieves the next set of results, if any.
func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, ae error) {
func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
req, err := lastResults.ListUsagesResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -117,12 +117,12 @@ func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/UsageOperationsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -23,13 +23,13 @@ import (
)
const (
major = "0"
minor = "5"
patch = "0"
major = "2"
minor = "1"
patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
userAgentFormat = "Azure-SDK-for-Go/%s;Package arm/%s;API %s"
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.

View file

@ -44,21 +44,21 @@ func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscript
// Get gets a virtual machine extension image.
//
func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, ae error) {
func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
req, err := client.GetPreparer(location, publisherName, typeParameter, version)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request")
}
return
@ -90,7 +90,7 @@ func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, p
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -108,21 +108,21 @@ func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Respon
// ListTypes gets a list of virtual machine extension image types.
//
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListTypesPreparer(location, publisherName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
}
resp, err := client.ListTypesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
}
result, err = client.ListTypesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request")
}
return
@ -152,12 +152,12 @@ func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location str
// ListTypesSender sends the ListTypes request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListTypesResponder handles the response to the ListTypes request. The method always
// closes the http.Response Body.
func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -171,28 +171,28 @@ func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.
// ListVersions gets a list of virtual machine extension image versions.
//
// filter is the filter to apply on the operation.
func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int, orderBy string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderBy string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderBy)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
}
resp, err := client.ListVersionsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
}
result, err = client.ListVersionsResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request")
}
return
}
// ListVersionsPreparer prepares the ListVersions request.
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int, orderBy string) (*http.Request, error) {
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderBy string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": url.QueryEscape(location),
"publisherName": url.QueryEscape(publisherName),
@ -225,12 +225,12 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location
// ListVersionsSender sends the ListVersions request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListVersionsResponder handles the response to the ListVersions request. The method always
// closes the http.Response Body.
func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),

View file

@ -42,35 +42,38 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID
return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate the operation to create or update the extension.
// CreateOrUpdate the operation to create or update the extension. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// 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.
func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtension, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters)
func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) {
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -82,7 +85,7 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGrou
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -95,49 +98,53 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGrou
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the operation to delete the extension.
// Delete the operation to delete the extension. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// 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.
func (client VirtualMachineExtensionsClient) Delete(resourceGroupName string, vmName string, vmExtensionName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, vmName, vmExtensionName)
func (client VirtualMachineExtensionsClient) Delete(resourceGroupName string, vmName string, vmExtensionName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, vmName, vmExtensionName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, vmName string, vmExtensionName string) (*http.Request, error) {
func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, vmName string, vmExtensionName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -149,7 +156,7 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName st
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -161,7 +168,9 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName st
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +191,21 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response
// 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.
func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmName string, vmExtensionName string, expand string) (result VirtualMachineExtension, ae error) {
func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmName string, vmExtensionName string, expand string) (result VirtualMachineExtension, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, vmExtensionName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request")
}
return
@ -230,7 +239,7 @@ func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName strin
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always

View file

@ -44,21 +44,21 @@ func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID str
// Get gets a virtual machine image.
//
func (client VirtualMachineImagesClient) Get(location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, ae error) {
func (client VirtualMachineImagesClient) Get(location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) {
req, err := client.GetPreparer(location, publisherName, offer, skus, version)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request")
}
return
@ -91,7 +91,7 @@ func (client VirtualMachineImagesClient) GetPreparer(location string, publisherN
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -110,28 +110,28 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu
// List gets a list of virtual machine images.
//
// filter is the filter to apply on the operation.
func (client VirtualMachineImagesClient) List(location string, publisherName string, offer string, skus string, filter string, top *int, orderby string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineImagesClient) List(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListPreparer(location, publisherName, offer, skus, filter, top, orderby)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int, orderby string) (*http.Request, error) {
func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": url.QueryEscape(location),
"offer": url.QueryEscape(offer),
@ -165,12 +165,12 @@ func (client VirtualMachineImagesClient) ListPreparer(location string, publisher
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -183,21 +183,21 @@ func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (res
// ListOffers gets a list of virtual machine image offers.
//
func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListOffersPreparer(location, publisherName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
}
resp, err := client.ListOffersSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request")
}
result, err = client.ListOffersResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request")
}
return
@ -227,12 +227,12 @@ func (client VirtualMachineImagesClient) ListOffersPreparer(location string, pub
// ListOffersSender sends the ListOffers request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListOffersResponder handles the response to the ListOffers request. The method always
// closes the http.Response Body.
func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -245,21 +245,21 @@ func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response
// ListPublishers gets a list of virtual machine image publishers.
//
func (client VirtualMachineImagesClient) ListPublishers(location string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListPublishersPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
}
resp, err := client.ListPublishersSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request")
}
result, err = client.ListPublishersResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request")
}
return
@ -288,12 +288,12 @@ func (client VirtualMachineImagesClient) ListPublishersPreparer(location string)
// ListPublishersSender sends the ListPublishers request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListPublishersResponder handles the response to the ListPublishers request. The method always
// closes the http.Response Body.
func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -306,21 +306,21 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp
// ListSkus gets a list of virtual machine image skus.
//
func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result VirtualMachineImageResourceList, ae error) {
func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListSkusPreparer(location, publisherName, offer)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
}
resp, err := client.ListSkusSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request")
}
result, err = client.ListSkusResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request")
}
return
@ -351,12 +351,12 @@ func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publi
// ListSkusSender sends the ListSkus request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListSkusResponder handles the response to the ListSkus request. The method always
// closes the http.Response Body.
func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result VirtualMachineImageResourceList, err error) {
func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),

View file

@ -43,33 +43,36 @@ func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string)
}
// Capture captures the VM by copying VirtualHardDisks of the VM and outputs a
// template that can be used to create similar VMs.
// template that can be used to create similar VMs. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// 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.
func (client VirtualMachinesClient) Capture(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters) (result VirtualMachineCaptureResult, ae error) {
req, err := client.CapturePreparer(resourceGroupName, vmName, parameters)
func (client VirtualMachinesClient) Capture(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CapturePreparer(resourceGroupName, vmName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Capture", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request")
}
resp, err := client.CaptureSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Capture", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure sending request")
}
result, err = client.CaptureResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Capture", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure responding to request")
}
return
}
// CapturePreparer prepares the Capture request.
func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters) (*http.Request, error) {
func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -80,7 +83,7 @@ func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vm
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -93,49 +96,53 @@ func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vm
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CaptureResponder handles the response to the Capture request. The method always
// closes the http.Response Body.
func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) {
func (client VirtualMachinesClient) CaptureResponder(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
}
// CreateOrUpdate the operation to create or update a virtual machine.
// CreateOrUpdate the operation to create or update a virtual machine. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// 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.
func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine) (result VirtualMachine, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, parameters)
func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, parameters VirtualMachine) (*http.Request, error) {
func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -146,7 +153,7 @@ func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName str
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -159,50 +166,53 @@ func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName str
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) {
func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Deallocate shuts down the Virtual Machine and releases the compute
// resources. You are not billed for the compute resources that this Virtual
// Machine uses.
// Machine uses. This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Deallocate(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmName)
func (client VirtualMachinesClient) Deallocate(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Deallocate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request")
}
resp, err := client.DeallocateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Deallocate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure sending request")
}
result, err = client.DeallocateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Deallocate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure responding to request")
}
return
}
// DeallocatePreparer prepares the Deallocate request.
func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, vmName string) (*http.Request, error) {
func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -213,7 +223,7 @@ func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -225,7 +235,9 @@ func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeallocateResponder handles the response to the Deallocate request. The method always
@ -240,32 +252,35 @@ func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (re
return
}
// Delete the operation to delete a virtual machine.
// Delete the operation to delete a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Delete(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, vmName)
func (client VirtualMachinesClient) Delete(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, vmName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmName string) (*http.Request, error) {
func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -276,7 +291,7 @@ func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmN
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -288,7 +303,9 @@ func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmN
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -307,21 +324,21 @@ func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName string) (result autorest.Response, err error) {
req, err := client.GeneralizePreparer(resourceGroupName, vmName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Generalize", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request")
}
resp, err := client.GeneralizeSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Generalize", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request")
}
result, err = client.GeneralizeResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Generalize", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request")
}
return
@ -351,7 +368,7 @@ func (client VirtualMachinesClient) GeneralizePreparer(resourceGroupName string,
// GeneralizeSender sends the Generalize request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GeneralizeResponder handles the response to the Generalize request. The method always
@ -371,21 +388,21 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re
// 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.
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand string) (result VirtualMachine, ae error) {
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand string) (result VirtualMachine, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request")
}
return
@ -418,7 +435,7 @@ func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, vmName
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -437,21 +454,21 @@ func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result Vi
// List the operation to list virtual machines under a resource group.
//
// resourceGroupName is the name of the resource group.
func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, ae error) {
func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request")
}
return
@ -480,7 +497,7 @@ func (client VirtualMachinesClient) ListPreparer(resourceGroupName string) (*htt
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -497,10 +514,10 @@ func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result V
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, ae error) {
func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
req, err := lastResults.VirtualMachineListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -509,12 +526,12 @@ func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineLi
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to next results request request")
}
return
@ -523,21 +540,21 @@ func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineLi
// ListAll gets the list of Virtual Machines in the subscription. Use nextLink
// property in the response to get the next page of Virtual Machines. Do this
// till nextLink is not null to fetch all the Virtual Machines.
func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, ae error) {
func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request")
}
return
@ -565,7 +582,7 @@ func (client VirtualMachinesClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -582,10 +599,10 @@ func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (resul
}
// ListAllNextResults retrieves the next set of results, if any.
func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, ae error) {
func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
req, err := lastResults.VirtualMachineListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -594,12 +611,12 @@ func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachin
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to next results request request")
}
return
@ -610,21 +627,21 @@ func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachin
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) ListAvailableSizes(resourceGroupName string, vmName string) (result VirtualMachineSizeListResult, ae error) {
func (client VirtualMachinesClient) ListAvailableSizes(resourceGroupName string, vmName string) (result VirtualMachineSizeListResult, err error) {
req, err := client.ListAvailableSizesPreparer(resourceGroupName, vmName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request")
}
resp, err := client.ListAvailableSizesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request")
}
result, err = client.ListAvailableSizesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request")
}
return
@ -654,7 +671,7 @@ func (client VirtualMachinesClient) ListAvailableSizesPreparer(resourceGroupName
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
@ -671,10 +688,10 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo
}
// ListAvailableSizesNextResults retrieves the next set of results, if any.
func (client VirtualMachinesClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, ae error) {
func (client VirtualMachinesClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
req, err := lastResults.VirtualMachineSizeListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -683,43 +700,46 @@ func (client VirtualMachinesClient) ListAvailableSizesNextResults(lastResults Vi
resp, err := client.ListAvailableSizesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending next results request request")
}
result, err = client.ListAvailableSizesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
}
return
}
// PowerOff the operation to power off (stop) a virtual machine.
// PowerOff the operation to power off (stop) a virtual machine. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) PowerOff(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmName)
func (client VirtualMachinesClient) PowerOff(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "PowerOff", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request")
}
resp, err := client.PowerOffSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "PowerOff", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure sending request")
}
result, err = client.PowerOffResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "PowerOff", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure responding to request")
}
return
}
// PowerOffPreparer prepares the PowerOff request.
func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, vmName string) (*http.Request, error) {
func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -730,7 +750,7 @@ func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, v
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -742,7 +762,9 @@ func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, v
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// PowerOffResponder handles the response to the PowerOff request. The method always
@ -757,32 +779,35 @@ func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (resu
return
}
// Restart the operation to restart a virtual machine.
// Restart the operation to restart a virtual machine. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Restart(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
req, err := client.RestartPreparer(resourceGroupName, vmName)
func (client VirtualMachinesClient) Restart(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.RestartPreparer(resourceGroupName, vmName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Restart", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request")
}
resp, err := client.RestartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Restart", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure sending request")
}
result, err = client.RestartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Restart", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure responding to request")
}
return
}
// RestartPreparer prepares the Restart request.
func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vmName string) (*http.Request, error) {
func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -793,7 +818,7 @@ func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vm
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -805,7 +830,9 @@ func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vm
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// RestartResponder handles the response to the Restart request. The method always
@ -820,32 +847,35 @@ func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (resul
return
}
// Start the operation to start a virtual machine.
// Start the operation to start a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Start(resourceGroupName string, vmName string) (result autorest.Response, ae error) {
req, err := client.StartPreparer(resourceGroupName, vmName)
func (client VirtualMachinesClient) Start(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StartPreparer(resourceGroupName, vmName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Start", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request")
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Start", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure sending request")
}
result, err = client.StartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachinesClient", "Start", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure responding to request")
}
return
}
// StartPreparer prepares the Start request.
func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmName string) (*http.Request, error) {
func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -856,7 +886,7 @@ func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmNa
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -868,7 +898,9 @@ func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmNa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StartResponder handles the response to the Start request. The method always

View file

@ -43,33 +43,35 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID
}
// CreateOrUpdate the operation to create or update a virtual machine scale
// set.
// set. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. name is parameters
// supplied to the Create Virtual Machine Scale Set operation. parameters is
// parameters supplied to the Create Virtual Machine Scale Set operation.
func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet) (result VirtualMachineScaleSet, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": url.QueryEscape(name),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -80,7 +82,7 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroup
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -93,50 +95,53 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroup
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) {
func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Deallocate the operation to deallocate virtual machines in a virtual
// machine scale set.
// machine scale set. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, ae error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request")
}
resp, err := client.DeallocateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure sending request")
}
result, err = client.DeallocateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure responding to request")
}
return
}
// DeallocatePreparer prepares the Deallocate request.
func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -158,13 +163,15 @@ func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(vmInstanceIDs))
}
return preparer.Prepare(&http.Request{})
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeallocateSender sends the Deallocate request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeallocateResponder handles the response to the Deallocate request. The method always
@ -179,32 +186,35 @@ func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Respo
return
}
// Delete the operation to delete a virtual machine scale set.
// Delete the operation to delete a virtual machine scale set. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set.
func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmScaleSetName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName)
func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -215,7 +225,7 @@ func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName str
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -227,7 +237,9 @@ func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName str
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -243,33 +255,35 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response)
}
// DeleteInstances the operation to delete virtual machines in a virtual
// machine scale set.
// machine scale set. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result autorest.Response, ae error) {
req, err := client.DeleteInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeleteInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request")
}
resp, err := client.DeleteInstancesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure sending request")
}
result, err = client.DeleteInstancesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure responding to request")
}
return
}
// DeleteInstancesPreparer prepares the DeleteInstances request.
func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -280,7 +294,7 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGrou
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -293,7 +307,9 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGrou
// DeleteInstancesSender sends the DeleteInstances request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteInstancesResponder handles the response to the DeleteInstances request. The method always
@ -312,21 +328,21 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set.
func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSet, ae error) {
func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSet, err error) {
req, err := client.GetPreparer(resourceGroupName, vmScaleSetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request")
}
return
@ -356,7 +372,7 @@ func (client VirtualMachineScaleSetsClient) GetPreparer(resourceGroupName string
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -377,21 +393,21 @@ func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (r
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set.
func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetInstanceView, ae error) {
func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) {
req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request")
}
resp, err := client.GetInstanceViewSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request")
}
result, err = client.GetInstanceViewResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request")
}
return
@ -421,7 +437,7 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(resourceGrou
// GetInstanceViewSender sends the GetInstanceView request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always
@ -441,21 +457,21 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.
// group.
//
// resourceGroupName is the name of the resource group.
func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, ae error) {
func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request")
}
return
@ -484,7 +500,7 @@ func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName strin
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -501,10 +517,10 @@ func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, ae error) {
func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -513,12 +529,12 @@ func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualM
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -528,21 +544,21 @@ func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualM
// Use nextLink property in the response to get the next page of Virtual
// Machine Scale Sets. Do this till nextLink is not null to fetch all the
// Virtual Machine Scale Sets.
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, ae error) {
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request")
}
return
@ -570,7 +586,7 @@ func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, er
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -587,10 +603,10 @@ func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response
}
// ListAllNextResults retrieves the next set of results, if any.
func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, ae error) {
func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -599,12 +615,12 @@ func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults Virtu
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to next results request request")
}
return
@ -615,21 +631,21 @@ func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults Virtu
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set.
func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetListSkusResult, ae error) {
func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) {
req, err := client.ListSkusPreparer(resourceGroupName, vmScaleSetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request")
}
resp, err := client.ListSkusSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request")
}
result, err = client.ListSkusResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request")
}
return
@ -659,7 +675,7 @@ func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName s
// ListSkusSender sends the ListSkus request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListSkusResponder handles the response to the ListSkus request. The method always
@ -676,10 +692,10 @@ func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Respons
}
// ListSkusNextResults retrieves the next set of results, if any.
func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, ae error) {
func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -688,45 +704,47 @@ func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults Virt
resp, err := client.ListSkusSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending next results request request")
}
result, err = client.ListSkusResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to next results request request")
}
return
}
// PowerOff the operation to power off (stop) virtual machines in a virtual
// machine scale set.
// machine scale set. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, ae error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request")
}
resp, err := client.PowerOffSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure sending request")
}
result, err = client.PowerOffResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure responding to request")
}
return
}
// PowerOffPreparer prepares the PowerOff request.
func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -748,13 +766,15 @@ func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName s
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(vmInstanceIDs))
}
return preparer.Prepare(&http.Request{})
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// PowerOffSender sends the PowerOff request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// PowerOffResponder handles the response to the PowerOff request. The method always
@ -770,33 +790,35 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons
}
// Restart the operation to restart virtual machines in a virtual machine
// scale set.
// scale set. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, ae error) {
req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request")
}
resp, err := client.RestartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure sending request")
}
result, err = client.RestartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Restart", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure responding to request")
}
return
}
// RestartPreparer prepares the Restart request.
func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -818,13 +840,15 @@ func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName st
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(vmInstanceIDs))
}
return preparer.Prepare(&http.Request{})
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// RestartSender sends the Restart request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// RestartResponder handles the response to the Restart request. The method always
@ -840,33 +864,35 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response
}
// Start the operation to start virtual machines in a virtual machine scale
// set.
// set. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result autorest.Response, ae error) {
req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request")
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure sending request")
}
result, err = client.StartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "Start", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure responding to request")
}
return
}
// StartPreparer prepares the Start request.
func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -888,13 +914,15 @@ func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName stri
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(vmInstanceIDs))
}
return preparer.Prepare(&http.Request{})
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// StartSender sends the Start request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StartResponder handles the response to the Start request. The method always
@ -910,33 +938,35 @@ func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response)
}
// UpdateInstances the operation to manually upgrade virtual machines in a
// virtual machine scale set.
// virtual machine scale set. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of
// virtual machine scale set instance IDs.
func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result autorest.Response, ae error) {
req, err := client.UpdateInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs)
func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.UpdateInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request")
}
resp, err := client.UpdateInstancesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure sending request")
}
result, err = client.UpdateInstancesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure responding to request")
}
return
}
// UpdateInstancesPreparer prepares the UpdateInstances request.
func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -947,7 +977,7 @@ func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGrou
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -960,7 +990,9 @@ func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGrou
// UpdateInstancesSender sends the UpdateInstances request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// UpdateInstancesResponder handles the response to the UpdateInstances request. The method always

View file

@ -42,33 +42,36 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Deallocate the operation to deallocate a virtual machine scale set.
// Deallocate the operation to deallocate a virtual machine scale set. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, vmScaleSetName string, instanceID string) (result autorest.Response, ae error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, instanceID)
func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request")
}
resp, err := client.DeallocateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure sending request")
}
result, err = client.DeallocateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure responding to request")
}
return
}
// DeallocatePreparer prepares the Deallocate request.
func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"instanceId": url.QueryEscape(instanceID),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -80,7 +83,7 @@ func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupNa
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -92,7 +95,9 @@ func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupNa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeallocateResponder handles the response to the Deallocate request. The method always
@ -107,33 +112,36 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res
return
}
// Delete the operation to delete a virtual machine scale set.
// Delete the operation to delete a virtual machine scale set. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, vmScaleSetName string, instanceID string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, instanceID)
func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"instanceId": url.QueryEscape(instanceID),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -145,7 +153,7 @@ func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName s
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -157,7 +165,9 @@ func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName s
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -177,21 +187,21 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, ae error) {
func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) {
req, err := client.GetPreparer(resourceGroupName, vmScaleSetName, instanceID)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request")
}
return
@ -222,7 +232,7 @@ func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName stri
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -244,21 +254,21 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response)
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, ae error) {
func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) {
req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName, instanceID)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request")
}
resp, err := client.GetInstanceViewSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request")
}
result, err = client.GetInstanceViewResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request")
}
return
@ -289,7 +299,7 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGr
// GetInstanceViewSender sends the GetInstanceView request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always
@ -312,21 +322,21 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *htt
// filter is the filter to apply on the operation. selectParameter is the
// list parameters. expand is the expand expression to apply on the
// operation.
func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, ae error) {
func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request")
}
return
@ -365,7 +375,7 @@ func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName str
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -382,10 +392,10 @@ func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response)
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, ae error) {
func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) {
req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -394,44 +404,47 @@ func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults Virtua
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to next results request request")
}
return
}
// PowerOff the operation to power off (stop) a virtual machine scale set.
// This method may poll for completion. Polling can be canceled by passing
// the cancel channel argument. The channel will be used to cancel polling
// and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, vmScaleSetName string, instanceID string) (result autorest.Response, ae error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, instanceID)
func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request")
}
resp, err := client.PowerOffSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure sending request")
}
result, err = client.PowerOffResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure responding to request")
}
return
}
// PowerOffPreparer prepares the PowerOff request.
func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"instanceId": url.QueryEscape(instanceID),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -443,7 +456,7 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -455,7 +468,9 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// PowerOffResponder handles the response to the PowerOff request. The method always
@ -470,33 +485,36 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo
return
}
// Restart the operation to restart a virtual machine scale set.
// Restart the operation to restart a virtual machine scale set. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, vmScaleSetName string, instanceID string) (result autorest.Response, ae error) {
req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, instanceID)
func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request")
}
resp, err := client.RestartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure sending request")
}
result, err = client.RestartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure responding to request")
}
return
}
// RestartPreparer prepares the Restart request.
func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"instanceId": url.QueryEscape(instanceID),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -508,7 +526,7 @@ func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -520,7 +538,9 @@ func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// RestartResponder handles the response to the Restart request. The method always
@ -535,33 +555,36 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon
return
}
// Start the operation to start a virtual machine scale set.
// Start the operation to start a virtual machine scale set. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of
// the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, vmScaleSetName string, instanceID string) (result autorest.Response, ae error) {
req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, instanceID)
func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request")
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Start", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure sending request")
}
result, err = client.StartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineScaleSetVMsClient", "Start", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure responding to request")
}
return
}
// StartPreparer prepares the Start request.
func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"instanceId": url.QueryEscape(instanceID),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -573,7 +596,7 @@ func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName st
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -585,7 +608,9 @@ func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName st
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StartResponder handles the response to the Start request. The method always

View file

@ -45,21 +45,21 @@ func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID stri
// List lists virtual-machine-sizes available in a location for a subscription.
//
// location is the location upon which virtual-machine-sizes is queried.
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, ae error) {
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) {
req, err := client.ListPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request")
}
return
@ -88,7 +88,7 @@ func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Req
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -105,10 +105,10 @@ func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (resu
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualMachineSizesClient) ListNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, ae error) {
func (client VirtualMachineSizesClient) ListNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
req, err := lastResults.VirtualMachineSizeListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -117,12 +117,12 @@ func (client VirtualMachineSizesClient) ListNextResults(lastResults VirtualMachi
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -47,33 +47,35 @@ func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID stri
}
// CreateOrUpdate the Put ApplicationGateway operation creates/updates a
// ApplicationGateway
// ApplicationGateway This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the ApplicationGateway. parameters is parameters supplied
// to the create/delete ApplicationGateway operation
func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGateway, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters)
func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (*http.Request, error) {
func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -84,7 +86,7 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -97,49 +99,52 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) {
func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete applicationgateway operation deletes the specified
// applicationgateway.
// applicationgateway. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the applicationgateway.
func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName)
func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -150,7 +155,7 @@ func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +167,9 @@ func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +189,21 @@ func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (re
//
// resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the applicationgateway.
func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, ae error) {
func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
req, err := client.GetPreparer(resourceGroupName, applicationGatewayName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request")
}
return
@ -226,7 +233,7 @@ func (client ApplicationGatewaysClient) GetPreparer(resourceGroupName string, ap
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -246,21 +253,21 @@ func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (resul
// applicationgateways in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, ae error) {
func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request")
}
return
@ -289,7 +296,7 @@ func (client ApplicationGatewaysClient) ListPreparer(resourceGroupName string) (
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -306,10 +313,10 @@ func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (resu
}
// ListNextResults retrieves the next set of results, if any.
func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, ae error) {
func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
req, err := lastResults.ApplicationGatewayListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -318,12 +325,12 @@ func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationG
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to next results request request")
}
return
@ -331,21 +338,21 @@ func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationG
// ListAll the List applicationgateway opertion retrieves all the
// applicationgateways in a subscription.
func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, ae error) {
func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request")
}
return
@ -373,7 +380,7 @@ func (client ApplicationGatewaysClient) ListAllPreparer() (*http.Request, error)
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -390,10 +397,10 @@ func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (r
}
// ListAllNextResults retrieves the next set of results, if any.
func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, ae error) {
func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
req, err := lastResults.ApplicationGatewayListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -402,44 +409,47 @@ func (client ApplicationGatewaysClient) ListAllNextResults(lastResults Applicati
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to next results request request")
}
return
}
// Start the Start ApplicationGateway operation starts application gatewayin
// the specified resource group through Network resource provider.
// the specified resource group through Network resource provider. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the application gateway.
func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicationGatewayName string) (result autorest.Response, ae error) {
req, err := client.StartPreparer(resourceGroupName, applicationGatewayName)
func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StartPreparer(resourceGroupName, applicationGatewayName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Start", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request")
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Start", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure sending request")
}
result, err = client.StartResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Start", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure responding to request")
}
return
}
// StartPreparer prepares the Start request.
func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -450,7 +460,7 @@ func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -462,7 +472,9 @@ func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StartResponder handles the response to the Start request. The method always
@ -478,32 +490,35 @@ func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (res
}
// Stop the STOP ApplicationGateway operation stops application gatewayin the
// specified resource group through Network resource provider.
// specified resource group through Network resource provider. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the application gateway.
func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicationGatewayName string) (result autorest.Response, ae error) {
req, err := client.StopPreparer(resourceGroupName, applicationGatewayName)
func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StopPreparer(resourceGroupName, applicationGatewayName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Stop", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request")
}
resp, err := client.StopSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Stop", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure sending request")
}
result, err = client.StopResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ApplicationGatewaysClient", "Stop", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure responding to request")
}
return
}
// StopPreparer prepares the Stop request.
func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -514,7 +529,7 @@ func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, a
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -526,7 +541,9 @@ func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, a
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StopResponder handles the response to the Stop request. The method always

View file

@ -4,7 +4,7 @@
// The Microsoft Azure Network management API provides a RESTful set of web
// services that interact with Microsoft Azure Networks service to manage
// your network resrources. The API has entities that capture the
// relationship between an end user and the Microsoft Azure Networks service..
// relationship between an end user and the Microsoft Azure Networks service.
package network
// Copyright (c) Microsoft and contributors. All rights reserved.
@ -67,21 +67,21 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
// 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]$.
func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, ae error) {
func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {
req, err := client.CheckDNSNameAvailabilityPreparer(location, domainNameLabel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request")
}
resp, err := client.CheckDNSNameAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request")
}
result, err = client.CheckDNSNameAvailabilityResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request")
}
return
@ -113,7 +113,7 @@ func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string,
// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always

View file

@ -47,34 +47,37 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc
}
// CreateOrUpdate the Put Authorization operation creates/updates an
// authorization in thespecified ExpressRouteCircuits
// authorization in thespecified ExpressRouteCircuits This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// 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/update ExpressRouteCircuitAuthorization operation
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorization, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters)
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (*http.Request, error) {
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationName": url.QueryEscape(authorizationName),
"circuitName": url.QueryEscape(circuitName),
@ -86,7 +89,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(res
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -99,50 +102,54 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(res
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) {
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete authorization operation deletes the specified
// authorization from the specified ExpressRouteCircuit.
// authorization from the specified ExpressRouteCircuit. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. authorizationName is the name of the
// authorization.
func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName)
func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationName": url.QueryEscape(authorizationName),
"circuitName": url.QueryEscape(circuitName),
@ -154,7 +161,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGro
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -166,7 +173,9 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGro
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -187,21 +196,21 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http
// resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. authorizationName is the name of the
// authorization.
func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, ae error) {
func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName, authorizationName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure responding to request")
}
return
@ -232,7 +241,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupN
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -253,21 +262,21 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Re
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the curcuit.
func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, ae error) {
func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request")
}
return
@ -297,7 +306,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroup
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -314,10 +323,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.R
}
// ListNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, ae error) {
func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) {
req, err := lastResults.AuthorizationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -326,12 +335,12 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResult
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -47,34 +47,36 @@ func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptio
}
// CreateOrUpdate the Put Pering operation creates/updates an peering in the
// specified ExpressRouteCircuits
// specified ExpressRouteCircuits This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The
// channel will be used to cancel polling and any outstanding HTTP requests.
//
// 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/update
// ExpressRouteCircuit Peering operation
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeering, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters)
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (*http.Request, error) {
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"circuitName": url.QueryEscape(circuitName),
"peeringName": url.QueryEscape(peeringName),
@ -86,7 +88,7 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceG
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -99,49 +101,52 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceG
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) {
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete peering operation deletes the specified peering from the
// ExpressRouteCircuit.
// ExpressRouteCircuit. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. peeringName is the name of the peering.
func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName)
func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"circuitName": url.QueryEscape(circuitName),
"peeringName": url.QueryEscape(peeringName),
@ -153,7 +158,7 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -165,7 +170,9 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -185,21 +192,21 @@ func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Respo
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. peeringName is the name of the peering.
func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, ae error) {
func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName, peeringName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure responding to request")
}
return
@ -230,7 +237,7 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName st
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -251,21 +258,21 @@ func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the curcuit.
func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, ae error) {
func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request")
}
return
@ -295,7 +302,7 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName s
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -312,10 +319,10 @@ func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Respons
}
// ListNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, ae error) {
func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) {
req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -324,12 +331,12 @@ func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults Expr
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -47,33 +47,35 @@ func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID str
}
// CreateOrUpdate the Put ExpressRouteCircuit operation creates/updates a
// ExpressRouteCircuit
// ExpressRouteCircuit This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. parameters is parameters supplied to the
// create/delete ExpressRouteCircuit operation
func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuit, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters)
func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (*http.Request, error) {
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"circuitName": url.QueryEscape(circuitName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -84,7 +86,7 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupNam
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -97,49 +99,52 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupNam
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuit, err error) {
func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete ExpressRouteCircuit operation deletes the specified
// ExpressRouteCircuit.
// ExpressRouteCircuit. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the express route Circuit.
func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName)
func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"circuitName": url.QueryEscape(circuitName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -150,7 +155,7 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +167,9 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +189,21 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit.
func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, ae error) {
func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request")
}
return
@ -226,7 +233,7 @@ func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, c
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -246,21 +253,21 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
// ExpressRouteCircuits in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, ae error) {
func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request")
}
return
@ -289,7 +296,7 @@ func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string)
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -306,10 +313,10 @@ func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (res
}
// ListNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -318,12 +325,12 @@ func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRout
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -331,21 +338,21 @@ func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRout
// ListAll the List ExpressRouteCircuit opertion retrieves all the
// ExpressRouteCircuits in a subscription.
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request")
}
return
@ -373,7 +380,7 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -390,10 +397,10 @@ func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (
}
// ListAllNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -402,12 +409,12 @@ func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressR
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request request")
}
return
@ -419,21 +426,21 @@ func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressR
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit.
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsArpTableListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsArpTableListResult, err error) {
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
}
resp, err := client.ListArpTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request")
}
result, err = client.ListArpTableResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request")
}
return
@ -463,7 +470,7 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListArpTableResponder handles the response to the ListArpTable request. The method always
@ -480,10 +487,10 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon
}
// ListArpTableNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListArpTableNextResults(lastResults ExpressRouteCircuitsArpTableListResult) (result ExpressRouteCircuitsArpTableListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListArpTableNextResults(lastResults ExpressRouteCircuitsArpTableListResult) (result ExpressRouteCircuitsArpTableListResult, err error) {
req, err := lastResults.ExpressRouteCircuitsArpTableListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -492,12 +499,12 @@ func (client ExpressRouteCircuitsClient) ListArpTableNextResults(lastResults Exp
resp, err := client.ListArpTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending next results request request")
}
result, err = client.ListArpTableResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to next results request request")
}
return
@ -509,21 +516,21 @@ func (client ExpressRouteCircuitsClient) ListArpTableNextResults(lastResults Exp
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit.
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsRoutesTableListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
}
resp, err := client.ListRoutesTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request")
}
result, err = client.ListRoutesTableResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request")
}
return
@ -553,7 +560,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupNa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
@ -570,10 +577,10 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res
}
// ListRoutesTableNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListRoutesTableNextResults(lastResults ExpressRouteCircuitsRoutesTableListResult) (result ExpressRouteCircuitsRoutesTableListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListRoutesTableNextResults(lastResults ExpressRouteCircuitsRoutesTableListResult) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
req, err := lastResults.ExpressRouteCircuitsRoutesTableListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -582,12 +589,12 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableNextResults(lastResults
resp, err := client.ListRoutesTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending next results request request")
}
result, err = client.ListRoutesTableResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to next results request request")
}
return
@ -598,21 +605,21 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableNextResults(lastResults
//
// resourceGroupName is the name of the resource group. circuitName is the
// name of the loadBalancer.
func (client ExpressRouteCircuitsClient) ListStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsStatsListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsStatsListResult, err error) {
req, err := client.ListStatsPreparer(resourceGroupName, circuitName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing request")
}
resp, err := client.ListStatsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending request")
}
result, err = client.ListStatsResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to request")
}
return
@ -642,7 +649,7 @@ func (client ExpressRouteCircuitsClient) ListStatsPreparer(resourceGroupName str
// ListStatsSender sends the ListStats request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListStatsSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListStatsResponder handles the response to the ListStats request. The method always
@ -659,10 +666,10 @@ func (client ExpressRouteCircuitsClient) ListStatsResponder(resp *http.Response)
}
// ListStatsNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListStatsNextResults(lastResults ExpressRouteCircuitsStatsListResult) (result ExpressRouteCircuitsStatsListResult, ae error) {
func (client ExpressRouteCircuitsClient) ListStatsNextResults(lastResults ExpressRouteCircuitsStatsListResult) (result ExpressRouteCircuitsStatsListResult, err error) {
req, err := lastResults.ExpressRouteCircuitsStatsListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -671,12 +678,12 @@ func (client ExpressRouteCircuitsClient) ListStatsNextResults(lastResults Expres
resp, err := client.ListStatsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending next results request request")
}
result, err = client.ListStatsResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to next results request request")
}
return

View file

@ -48,21 +48,21 @@ func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscripti
// List the List ExpressRouteServiceProvider opertion retrieves all the
// available ExpressRouteServiceProviders.
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, ae error) {
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request")
}
return
@ -90,7 +90,7 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request,
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -107,10 +107,10 @@ func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Respon
}
// ListNextResults retrieves the next set of results, if any.
func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, ae error) {
func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) {
req, err := lastResults.ExpressRouteServiceProviderListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -119,12 +119,12 @@ func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults Exp
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -46,33 +46,35 @@ func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) Inter
}
// CreateOrUpdate the Put NetworkInterface operation creates/updates a
// networkInterface
// networkInterface This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. parameters is parameters supplied to
// the create/update NetworkInterface operation
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface) (result Interface, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters)
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface) (*http.Request, error) {
func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -83,7 +85,7 @@ func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -96,49 +98,52 @@ func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) {
func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete netwokInterface operation deletes the specified
// netwokInterface.
// netwokInterface. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface.
func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName)
func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string) (*http.Request, error) {
func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -149,7 +154,7 @@ func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkI
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -161,7 +166,9 @@ func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkI
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +189,21 @@ func (client InterfacesClient) DeleteResponder(resp *http.Response) (result auto
// resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. expand is expand references
// resources.
func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, ae error) {
func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request")
}
return
@ -229,7 +236,7 @@ func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInte
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -253,21 +260,21 @@ func (client InterfacesClient) GetResponder(resp *http.Response) (result Interfa
// 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 expand references resources.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, ae error) {
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request")
}
resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request")
}
result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request")
}
return
@ -302,7 +309,7 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer
// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always
@ -322,21 +329,21 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponde
// networkInterfaces in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, ae error) {
func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request")
}
return
@ -365,7 +372,7 @@ func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Req
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -382,10 +389,10 @@ func (client InterfacesClient) ListResponder(resp *http.Response) (result Interf
}
// ListNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -394,12 +401,12 @@ func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult)
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request request")
}
return
@ -407,21 +414,21 @@ func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult)
// ListAll the List networkInterfaces opertion retrieves all the
// networkInterfaces in a subscription.
func (client InterfacesClient) ListAll() (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request")
}
return
@ -449,7 +456,7 @@ func (client InterfacesClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -466,10 +473,10 @@ func (client InterfacesClient) ListAllResponder(resp *http.Response) (result Int
}
// ListAllNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -478,12 +485,12 @@ func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResul
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request request")
}
return
@ -495,21 +502,21 @@ func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResul
//
// resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) {
req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request")
}
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request")
}
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request")
}
return
@ -539,7 +546,7 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPrepar
// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always
@ -556,10 +563,10 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesRespon
}
// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -568,12 +575,12 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextRe
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request request")
}
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request request")
}
return
@ -586,21 +593,21 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextRe
// resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set.
// virtualmachineIndex is the virtual machine index.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) {
req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request")
}
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request")
}
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request")
}
return
@ -631,7 +638,7 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPrep
// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always
@ -648,10 +655,10 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResp
}
// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, ae error) {
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -660,12 +667,12 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNext
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request request")
}
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request request")
}
return

View file

@ -46,33 +46,36 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo
return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate the Put LoadBalancer operation creates/updates a LoadBalancer
// CreateOrUpdate the Put LoadBalancer operation creates/updates a
// LoadBalancer This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer. parameters is parameters supplied to the
// create/delete LoadBalancer operation
func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancer, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters)
func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (*http.Request, error) {
func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"loadBalancerName": url.QueryEscape(loadBalancerName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -83,7 +86,7 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName strin
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -96,48 +99,52 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName strin
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (result LoadBalancer, err error) {
func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete loadbalancer operation deletes the specified loadbalancer.
// Delete the delete loadbalancer operation deletes the specified
// loadbalancer. This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer.
func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, loadBalancerName)
func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) {
func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"loadBalancerName": url.QueryEscape(loadBalancerName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -148,7 +155,7 @@ func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadB
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -160,7 +167,9 @@ func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadB
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -180,21 +189,21 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a
//
// resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer. expand is expand references resources.
func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, ae error) {
func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure responding to request")
}
return
@ -227,7 +236,7 @@ func (client LoadBalancersClient) GetPreparer(resourceGroupName string, loadBala
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -247,21 +256,21 @@ func (client LoadBalancersClient) GetResponder(resp *http.Response) (result Load
// resource group.
//
// resourceGroupName is the name of the resource group.
func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, ae error) {
func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request")
}
return
@ -290,7 +299,7 @@ func (client LoadBalancersClient) ListPreparer(resourceGroupName string) (*http.
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -307,10 +316,10 @@ func (client LoadBalancersClient) ListResponder(resp *http.Response) (result Loa
}
// ListNextResults retrieves the next set of results, if any.
func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, ae error) {
func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -319,12 +328,12 @@ func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListRe
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to next results request request")
}
return
@ -332,21 +341,21 @@ func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListRe
// ListAll the List loadBalancer opertion retrieves all the loadbalancers in a
// subscription.
func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, ae error) {
func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request")
}
return
@ -374,7 +383,7 @@ func (client LoadBalancersClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -391,10 +400,10 @@ func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result
}
// ListAllNextResults retrieves the next set of results, if any.
func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, ae error) {
func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -403,12 +412,12 @@ func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerLis
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LoadBalancersClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to next results request request")
}
return

View file

@ -48,34 +48,36 @@ func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID str
// CreateOrUpdate the Put LocalNetworkGateway operation creates/updates a
// local network gateway in the specified resource group through Network
// resource provider.
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group.
// localNetworkGatewayName is the name of the local network gateway.
// parameters is parameters supplied to the Begin Create or update Local
// Network Gateway operation through Network resource provider.
func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (result LocalNetworkGateway, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters)
func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (*http.Request, error) {
func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"localNetworkGatewayName": url.QueryEscape(localNetworkGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -86,7 +88,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupNam
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -99,49 +101,53 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupNam
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result LocalNetworkGateway, err error) {
func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete LocalNetworkGateway operation deletes the specifed local
// network Gateway through Network resource provider.
// network Gateway through Network resource provider. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group.
// localNetworkGatewayName is the name of the local network gateway.
func (client LocalNetworkGatewaysClient) Delete(resourceGroupName string, localNetworkGatewayName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, localNetworkGatewayName)
func (client LocalNetworkGatewaysClient) Delete(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, localNetworkGatewayName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) {
func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"localNetworkGatewayName": url.QueryEscape(localNetworkGatewayName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -152,7 +158,7 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -164,7 +170,9 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -184,21 +192,21 @@ func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (r
//
// resourceGroupName is the name of the resource group.
// localNetworkGatewayName is the name of the local network gateway.
func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, ae error) {
func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) {
req, err := client.GetPreparer(resourceGroupName, localNetworkGatewayName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request")
}
return
@ -228,7 +236,7 @@ func (client LocalNetworkGatewaysClient) GetPreparer(resourceGroupName string, l
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -248,21 +256,21 @@ func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (resu
// gateways stored.
//
// resourceGroupName is the name of the resource group.
func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, ae error) {
func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request")
}
return
@ -291,7 +299,7 @@ func (client LocalNetworkGatewaysClient) ListPreparer(resourceGroupName string)
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -308,10 +316,10 @@ func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (res
}
// ListNextResults retrieves the next set of results, if any.
func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, ae error) {
func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) {
req, err := lastResults.LocalNetworkGatewayListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -320,12 +328,12 @@ func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetwor
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/LocalNetworkGatewaysClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -487,10 +487,10 @@ type ApplicationGatewayBackendHTTPSettings struct {
// ApplicationGatewayBackendHTTPSettingsPropertiesFormat is properties of
// Backend address pool settings of application gateway
type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct {
Port *int `json:"port,omitempty"`
Port *int32 `json:"port,omitempty"`
Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"`
CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"`
RequestTimeout *int `json:"requestTimeout,omitempty"`
RequestTimeout *int32 `json:"requestTimeout,omitempty"`
Probe *SubResource `json:"probe,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -525,7 +525,7 @@ type ApplicationGatewayFrontendPort struct {
// ApplicationGatewayFrontendPortPropertiesFormat is properties of Frontend
// Port of application gateway
type ApplicationGatewayFrontendPortPropertiesFormat struct {
Port *int `json:"port,omitempty"`
Port *int32 `json:"port,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -616,9 +616,9 @@ type ApplicationGatewayProbePropertiesFormat struct {
Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"`
Host *string `json:"host,omitempty"`
Path *string `json:"path,omitempty"`
Interval *int `json:"interval,omitempty"`
Timeout *int `json:"timeout,omitempty"`
UnhealthyThreshold *int `json:"unhealthyThreshold,omitempty"`
Interval *int32 `json:"interval,omitempty"`
Timeout *int32 `json:"timeout,omitempty"`
UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -664,7 +664,7 @@ type ApplicationGatewayRequestRoutingRulePropertiesFormat struct {
type ApplicationGatewaySku struct {
Name ApplicationGatewaySkuName `json:"name,omitempty"`
Tier ApplicationGatewayTier `json:"tier,omitempty"`
Capacity *int `json:"capacity,omitempty"`
Capacity *int32 `json:"capacity,omitempty"`
}
// ApplicationGatewaySslCertificate is sSL certificates of application gateway
@ -760,7 +760,7 @@ type BackendAddressPoolPropertiesFormat struct {
// ConnectionResetSharedKey is
type ConnectionResetSharedKey struct {
autorest.Response `json:"-"`
KeyLength *int32 `json:"keyLength,omitempty"`
KeyLength *int64 `json:"keyLength,omitempty"`
}
// ConnectionSharedKey is response for GetConnectionSharedKey Api servive call
@ -869,7 +869,7 @@ type ExpressRouteCircuitPeering struct {
type ExpressRouteCircuitPeeringConfig struct {
AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"`
AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"`
CustomerASN *int `json:"customerASN,omitempty"`
CustomerASN *int32 `json:"customerASN,omitempty"`
RoutingRegistryName *string `json:"routingRegistryName,omitempty"`
}
@ -897,14 +897,14 @@ func (client ExpressRouteCircuitPeeringListResult) ExpressRouteCircuitPeeringLis
type ExpressRouteCircuitPeeringPropertiesFormat struct {
PeeringType ExpressRouteCircuitPeeringType `json:"peeringType,omitempty"`
State ExpressRouteCircuitPeeringState `json:"state,omitempty"`
AzureASN *int `json:"azureASN,omitempty"`
PeerASN *int `json:"peerASN,omitempty"`
AzureASN *int32 `json:"azureASN,omitempty"`
PeerASN *int32 `json:"peerASN,omitempty"`
PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"`
SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"`
PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"`
SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"`
SharedKey *string `json:"sharedKey,omitempty"`
VlanID *int `json:"vlanId,omitempty"`
VlanID *int32 `json:"vlanId,omitempty"`
MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"`
Stats *ExpressRouteCircuitStats `json:"stats,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
@ -956,7 +956,7 @@ func (client ExpressRouteCircuitsArpTableListResult) ExpressRouteCircuitsArpTabl
type ExpressRouteCircuitServiceProviderProperties struct {
ServiceProviderName *string `json:"serviceProviderName,omitempty"`
PeeringLocation *string `json:"peeringLocation,omitempty"`
BandwidthInMbps *int `json:"bandwidthInMbps,omitempty"`
BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"`
}
// ExpressRouteCircuitSku is contains sku in an ExpressRouteCircuit
@ -1008,8 +1008,8 @@ func (client ExpressRouteCircuitsStatsListResult) ExpressRouteCircuitsStatsListR
// ExpressRouteCircuitStats is contains Stats associated with the peering
type ExpressRouteCircuitStats struct {
BytesIn *int `json:"bytesIn,omitempty"`
BytesOut *int `json:"bytesOut,omitempty"`
BytesIn *int32 `json:"bytesIn,omitempty"`
BytesOut *int32 `json:"bytesOut,omitempty"`
}
// ExpressRouteServiceProvider is expressRouteResourceProvider object
@ -1026,7 +1026,7 @@ type ExpressRouteServiceProvider struct {
// in ExpressRouteServiceProviders
type ExpressRouteServiceProviderBandwidthsOffered struct {
OfferName *string `json:"offerName,omitempty"`
ValueInMbps *int `json:"valueInMbps,omitempty"`
ValueInMbps *int32 `json:"valueInMbps,omitempty"`
}
// ExpressRouteServiceProviderListResult is response for
@ -1091,9 +1091,9 @@ type InboundNatPool struct {
type InboundNatPoolPropertiesFormat struct {
FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"`
Protocol TransportProtocol `json:"protocol,omitempty"`
FrontendPortRangeStart *int `json:"frontendPortRangeStart,omitempty"`
FrontendPortRangeEnd *int `json:"frontendPortRangeEnd,omitempty"`
BackendPort *int `json:"backendPort,omitempty"`
FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"`
FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"`
BackendPort *int32 `json:"backendPort,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1110,9 +1110,9 @@ type InboundNatRulePropertiesFormat struct {
FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"`
BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"`
Protocol TransportProtocol `json:"protocol,omitempty"`
FrontendPort *int `json:"frontendPort,omitempty"`
BackendPort *int `json:"backendPort,omitempty"`
IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`
FrontendPort *int32 `json:"frontendPort,omitempty"`
BackendPort *int32 `json:"backendPort,omitempty"`
IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"`
EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1264,9 +1264,9 @@ type LoadBalancingRulePropertiesFormat struct {
Probe *SubResource `json:"probe,omitempty"`
Protocol TransportProtocol `json:"protocol,omitempty"`
LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"`
FrontendPort *int `json:"frontendPort,omitempty"`
BackendPort *int `json:"backendPort,omitempty"`
IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`
FrontendPort *int32 `json:"frontendPort,omitempty"`
BackendPort *int32 `json:"backendPort,omitempty"`
IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"`
EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1321,7 +1321,7 @@ type OutboundNatRule struct {
// OutboundNatRulePropertiesFormat is outbound NAT pool of the loadbalancer
type OutboundNatRulePropertiesFormat struct {
AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty"`
AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"`
FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"`
BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
@ -1339,9 +1339,9 @@ type Probe struct {
type ProbePropertiesFormat struct {
LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"`
Protocol ProbeProtocol `json:"protocol,omitempty"`
Port *int `json:"port,omitempty"`
IntervalInSeconds *int `json:"intervalInSeconds,omitempty"`
NumberOfProbes *int `json:"numberOfProbes,omitempty"`
Port *int32 `json:"port,omitempty"`
IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"`
NumberOfProbes *int32 `json:"numberOfProbes,omitempty"`
RequestPath *string `json:"requestPath,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1392,7 +1392,7 @@ type PublicIPAddressPropertiesFormat struct {
IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"`
DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"`
IPAddress *string `json:"ipAddress,omitempty"`
IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`
IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"`
ResourceGUID *string `json:"resourceGuid,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1560,7 +1560,7 @@ type SecurityRulePropertiesFormat struct {
SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"`
DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"`
Access SecurityRuleAccess `json:"access,omitempty"`
Priority *int `json:"priority,omitempty"`
Priority *int32 `json:"priority,omitempty"`
Direction SecurityRuleDirection `json:"direction,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
@ -1617,8 +1617,8 @@ type SubResource struct {
// Usage is describes Network Resource Usage.
type Usage struct {
Unit UsageUnit `json:"unit,omitempty"`
CurrentValue *int32 `json:"currentValue,omitempty"`
Limit *int32 `json:"limit,omitempty"`
CurrentValue *int64 `json:"currentValue,omitempty"`
Limit *int64 `json:"limit,omitempty"`
Name *UsageName `json:"name,omitempty"`
}
@ -1712,11 +1712,11 @@ type VirtualNetworkGatewayConnectionPropertiesFormat struct {
VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"`
LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"`
ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"`
RoutingWeight *int `json:"routingWeight,omitempty"`
RoutingWeight *int32 `json:"routingWeight,omitempty"`
SharedKey *string `json:"sharedKey,omitempty"`
ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"`
EgressBytesTransferred *int32 `json:"egressBytesTransferred,omitempty"`
IngressBytesTransferred *int32 `json:"ingressBytesTransferred,omitempty"`
EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"`
IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"`
Peer *SubResource `json:"peer,omitempty"`
ResourceGUID *string `json:"resourceGuid,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
@ -1778,7 +1778,7 @@ type VirtualNetworkGatewayPropertiesFormat struct {
type VirtualNetworkGatewaySku struct {
Name VirtualNetworkGatewaySkuName `json:"name,omitempty"`
Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"`
Capacity *int `json:"capacity,omitempty"`
Capacity *int32 `json:"capacity,omitempty"`
}
// VirtualNetworkListResult is response for ListVirtualNetworks Api servive

View file

@ -47,33 +47,35 @@ func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string
}
// CreateOrUpdate the Put PublicIPAddress operation creates/updates a
// stable/dynamic PublicIP address
// stable/dynamic PublicIP address This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The
// channel will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the publicIpAddress. parameters is parameters supplied to the
// create/update PublicIPAddress operation
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (result PublicIPAddress, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters)
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (*http.Request, error) {
func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"publicIpAddressName": url.QueryEscape(publicIPAddressName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -84,7 +86,7 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName s
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -97,49 +99,52 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName s
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) {
func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete publicIpAddress operation deletes the specified
// publicIpAddress.
// publicIpAddress. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the subnet.
func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName)
func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string) (*http.Request, error) {
func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"publicIpAddressName": url.QueryEscape(publicIPAddressName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -150,7 +155,7 @@ func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, p
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +167,9 @@ func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, p
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +189,21 @@ func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (resu
//
// resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the subnet. expand is expand references resources.
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, ae error) {
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure responding to request")
}
return
@ -229,7 +236,7 @@ func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publ
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -249,21 +256,21 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result
// in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, ae error) {
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request")
}
return
@ -292,7 +299,7 @@ func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*h
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -309,10 +316,10 @@ func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result
}
// ListNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, ae error) {
func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -321,12 +328,12 @@ func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddres
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to next results request request")
}
return
@ -334,21 +341,21 @@ func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddres
// ListAll the List publicIpAddress opertion retrieves all the
// publicIpAddresses in a subscription.
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, ae error) {
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request")
}
return
@ -376,7 +383,7 @@ func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -393,10 +400,10 @@ func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (res
}
// ListAllNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, ae error) {
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -405,12 +412,12 @@ func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAdd
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request request")
}
return

View file

@ -45,33 +45,35 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli
}
// CreateOrUpdate the Put route operation creates/updates a route in the
// specified route table
// specified route table This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// 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/update routeoperation
func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result Route, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters)
func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (*http.Request, error) {
func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"routeName": url.QueryEscape(routeName),
@ -83,7 +85,7 @@ func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, rout
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -96,49 +98,52 @@ func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, rout
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result Route, err error) {
func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete route operation deletes the specified route from a route
// table.
// table. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. routeName is the name of the route.
func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName)
func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) {
func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"routeName": url.QueryEscape(routeName),
@ -150,7 +155,7 @@ func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableNa
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +167,9 @@ func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableNa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +189,21 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. routeName is the name of the route.
func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, ae error) {
func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, err error) {
req, err := client.GetPreparer(resourceGroupName, routeTableName, routeName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure responding to request")
}
return
@ -227,7 +234,7 @@ func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -248,21 +255,21 @@ func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table.
func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, ae error) {
func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, routeTableName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request")
}
return
@ -292,7 +299,7 @@ func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -309,10 +316,10 @@ func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListR
}
// ListNextResults retrieves the next set of results, if any.
func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, ae error) {
func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) {
req, err := lastResults.RouteListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -321,12 +328,12 @@ func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -46,33 +46,35 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
}
// CreateOrUpdate the Put RouteTable operation creates/updates a route tablein
// the specified resource group.
// the specified resource group. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. parameters is parameters supplied to the
// create/update Route Table operation
func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTable, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters)
func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, parameters RouteTable) (*http.Request, error) {
func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"routeTableName": url.QueryEscape(routeTableName),
@ -83,7 +85,7 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -96,48 +98,52 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteTable, err error) {
func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete RouteTable operation deletes the specifed Route Table
// This method may poll for completion. Polling can be canceled by passing
// the cancel channel argument. The channel will be used to cancel polling
// and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table.
func (client RouteTablesClient) Delete(resourceGroupName string, routeTableName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, routeTableName)
func (client RouteTablesClient) Delete(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, routeTableName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTableName string) (*http.Request, error) {
func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"routeTableName": url.QueryEscape(routeTableName),
@ -148,7 +154,7 @@ func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTa
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -160,7 +166,9 @@ func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -180,21 +188,21 @@ func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result aut
//
// resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. expand is expand references resources.
func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, ae error) {
func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) {
req, err := client.GetPreparer(resourceGroupName, routeTableName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure responding to request")
}
return
@ -227,7 +235,7 @@ func (client RouteTablesClient) GetPreparer(resourceGroupName string, routeTable
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -246,21 +254,21 @@ func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteT
// List the list RouteTables returns all route tables in a resource group
//
// resourceGroupName is the name of the resource group.
func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, ae error) {
func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request")
}
return
@ -289,7 +297,7 @@ func (client RouteTablesClient) ListPreparer(resourceGroupName string) (*http.Re
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -306,10 +314,10 @@ func (client RouteTablesClient) ListResponder(resp *http.Response) (result Route
}
// ListNextResults retrieves the next set of results, if any.
func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, ae error) {
func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -318,33 +326,33 @@ func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to next results request request")
}
return
}
// ListAll the list RouteTables returns all route tables in a subscription
func (client RouteTablesClient) ListAll() (result RouteTableListResult, ae error) {
func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request")
}
return
@ -372,7 +380,7 @@ func (client RouteTablesClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -389,10 +397,10 @@ func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result Ro
}
// ListAllNextResults retrieves the next set of results, if any.
func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, ae error) {
func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -401,12 +409,12 @@ func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListRes
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/RouteTablesClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to next results request request")
}
return

View file

@ -47,34 +47,37 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
}
// CreateOrUpdate the Put NetworkSecurityGroup operation creates/updates a
// network security groupin the specified resource group.
// network security groupin the specified resource group. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group.
// parameters is parameters supplied to the create/update Network Security
// Group operation
func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroup, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters)
func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (*http.Request, error) {
func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkSecurityGroupName": url.QueryEscape(networkSecurityGroupName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -85,7 +88,7 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName stri
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -98,49 +101,52 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName stri
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityGroup, err error) {
func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete NetworkSecurityGroup operation deletes the specifed
// network security group
// network security group This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group.
func (client SecurityGroupsClient) Delete(resourceGroupName string, networkSecurityGroupName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName)
func (client SecurityGroupsClient) Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) {
func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkSecurityGroupName": url.QueryEscape(networkSecurityGroupName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -151,7 +157,7 @@ func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, netw
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -163,7 +169,9 @@ func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, netw
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -184,21 +192,21 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result
// resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. expand
// is expand references resources.
func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, ae error) {
func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure responding to request")
}
return
@ -231,7 +239,7 @@ func (client SecurityGroupsClient) GetPreparer(resourceGroupName string, network
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -251,21 +259,21 @@ func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result Sec
// a resource group
//
// resourceGroupName is the name of the resource group.
func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, ae error) {
func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request")
}
return
@ -294,7 +302,7 @@ func (client SecurityGroupsClient) ListPreparer(resourceGroupName string) (*http
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -311,10 +319,10 @@ func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result Se
}
// ListNextResults retrieves the next set of results, if any.
func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, ae error) {
func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -323,12 +331,12 @@ func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupList
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -336,21 +344,21 @@ func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupList
// ListAll the list NetworkSecurityGroups returns all network security groups
// in a subscription
func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, ae error) {
func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request")
}
return
@ -378,7 +386,7 @@ func (client SecurityGroupsClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -395,10 +403,10 @@ func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result
}
// ListAllNextResults retrieves the next set of results, if any.
func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, ae error) {
func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -407,12 +415,12 @@ func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupL
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityGroupsClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to next results request request")
}
return

View file

@ -47,35 +47,38 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se
}
// CreateOrUpdate the Put network security rule operation creates/updates a
// security rule in the specified network security group
// security rule in the specified network security group This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// 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/update network security rule
// operation
func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRule, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters)
func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (*http.Request, error) {
func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkSecurityGroupName": url.QueryEscape(networkSecurityGroupName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -87,7 +90,7 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName strin
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -100,50 +103,53 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName strin
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityRule, err error) {
func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete network security rule operation deletes the specified
// network security rule.
// network security rule. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// 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.
func (client SecurityRulesClient) Delete(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName)
func (client SecurityRulesClient) Delete(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) {
func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkSecurityGroupName": url.QueryEscape(networkSecurityGroupName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -155,7 +161,7 @@ func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, netwo
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -167,7 +173,9 @@ func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, netwo
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -188,21 +196,21 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a
// 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.
func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, ae error) {
func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, securityRuleName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityRulesClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure responding to request")
}
return
@ -233,7 +241,7 @@ func (client SecurityRulesClient) GetPreparer(resourceGroupName string, networkS
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -254,21 +262,21 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu
//
// resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group.
func (client SecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, ae error) {
func (client SecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, networkSecurityGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request")
}
return
@ -298,7 +306,7 @@ func (client SecurityRulesClient) ListPreparer(resourceGroupName string, network
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -315,10 +323,10 @@ func (client SecurityRulesClient) ListResponder(resp *http.Response) (result Sec
}
// ListNextResults retrieves the next set of results, if any.
func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, ae error) {
func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) {
req, err := lastResults.SecurityRuleListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -327,12 +335,12 @@ func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListRe
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SecurityRulesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -45,34 +45,36 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC
}
// CreateOrUpdate the Put Subnet operation creates/updates a subnet in
// thespecified virtual network
// thespecified virtual network This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
//
// 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/update Subnet
// operation
func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (result Subnet, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters)
func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SubnetsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (*http.Request, error) {
func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subnetName": url.QueryEscape(subnetName),
@ -84,7 +86,7 @@ func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, vir
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -97,48 +99,52 @@ func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, vir
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result Subnet, err error) {
func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the delete subnet operation deletes the specified subnet.
// Delete the delete subnet operation deletes the specified subnet. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. subnetName is the name of the subnet.
func (client SubnetsClient) Delete(resourceGroupName string, virtualNetworkName string, subnetName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, subnetName)
func (client SubnetsClient) Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, subnetName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SubnetsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, subnetName string) (*http.Request, error) {
func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subnetName": url.QueryEscape(subnetName),
@ -150,7 +156,7 @@ func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetw
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +168,9 @@ func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetw
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -183,21 +191,21 @@ func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autores
// 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 expand references resources.
func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, ae error) {
func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, subnetName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SubnetsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure responding to request")
}
return
@ -231,7 +239,7 @@ func (client SubnetsClient) GetPreparer(resourceGroupName string, virtualNetwork
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -252,21 +260,21 @@ func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, er
//
// resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network.
func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResult, ae error) {
func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, virtualNetworkName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SubnetsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request")
}
return
@ -296,7 +304,7 @@ func (client SubnetsClient) ListPreparer(resourceGroupName string, virtualNetwor
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -313,10 +321,10 @@ func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetLis
}
// ListNextResults retrieves the next set of results, if any.
func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, ae error) {
func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) {
req, err := lastResults.SubnetListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -325,12 +333,12 @@ func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (resul
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/SubnetsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/SubnetsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -47,21 +47,21 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli
// List lists compute usages for a subscription.
//
// location is the location upon which resource usage is queried.
func (client UsagesClient) List(location string) (result UsagesListResult, ae error) {
func (client UsagesClient) List(location string) (result UsagesListResult, err error) {
req, err := client.ListPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/UsagesClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/UsagesClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/UsagesClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request")
}
return
@ -90,7 +90,7 @@ func (client UsagesClient) ListPreparer(location string) (*http.Request, error)
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -107,10 +107,10 @@ func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesList
}
// ListNextResults retrieves the next set of results, if any.
func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, ae error) {
func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) {
req, err := lastResults.UsagesListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/UsagesClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -119,12 +119,12 @@ func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/UsagesClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/UsagesClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -23,13 +23,13 @@ import (
)
const (
major = "0"
minor = "5"
patch = "0"
major = "2"
minor = "1"
patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
userAgentFormat = "Azure-SDK-for-Go/%s;Package arm/%s;API %s"
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.

View file

@ -48,35 +48,38 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr
// CreateOrUpdate the Put VirtualNetworkGatewayConnection operation
// creates/updates a virtual network gateway connection in the specified
// resource group through Network resource provider.
// resource group through Network resource provider. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network
// gateway conenction. parameters is parameters supplied to the Begin Create
// or update Virtual Network Gateway connection operation through Network
// resource provider.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnection, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (*http.Request, error) {
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -87,7 +90,7 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(reso
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -100,51 +103,54 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(reso
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) {
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete VirtualNetworkGatewayConnection operation deletes the
// specifed virtual network Gateway connection through Network resource
// provider.
// provider. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network
// gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Delete(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayConnectionName)
func (client VirtualNetworkGatewayConnectionsClient) Delete(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) {
func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -155,7 +161,7 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGrou
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -167,7 +173,9 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGrou
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -189,21 +197,21 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network
// gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, ae error) {
func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request")
}
return
@ -233,7 +241,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(resourceGroupNa
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -256,21 +264,21 @@ func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Res
// resourceGroupName is the name of the resource group.
// connectionSharedKeyName is the virtual network gateway connection shared
// key name.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, connectionSharedKeyName string) (result ConnectionSharedKeyResult, ae error) {
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, connectionSharedKeyName string) (result ConnectionSharedKeyResult, err error) {
req, err := client.GetSharedKeyPreparer(resourceGroupName, connectionSharedKeyName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request")
}
resp, err := client.GetSharedKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request")
}
result, err = client.GetSharedKeyResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request")
}
return
@ -300,7 +308,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resour
// GetSharedKeySender sends the GetSharedKey request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always
@ -320,21 +328,21 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp
// virtual network gateways connections created.
//
// resourceGroupName is the name of the resource group.
func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName string) (result VirtualNetworkGatewayConnectionListResult, ae error) {
func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName string) (result VirtualNetworkGatewayConnectionListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request")
}
return
@ -363,7 +371,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(resourceGroupN
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -380,10 +388,10 @@ func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Re
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, ae error) {
func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) {
req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -392,12 +400,12 @@ func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -406,35 +414,37 @@ func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults
// 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.
// Network resource provider. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
//
// 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.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (result ConnectionResetSharedKey, ae error) {
req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request")
}
resp, err := client.ResetSharedKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure sending request")
}
result, err = client.ResetSharedKeyResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure responding to request")
}
return
}
// ResetSharedKeyPreparer prepares the ResetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (*http.Request, error) {
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -445,7 +455,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(reso
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -458,54 +468,57 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(reso
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(resp *http.Response) (result ConnectionResetSharedKey, err error) {
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(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
}
// 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.
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// 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 conection Shared key operation throughNetwork
// resource provider.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (result ConnectionSharedKey, ae error) {
req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request")
}
resp, err := client.SetSharedKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure sending request")
}
result, err = client.SetSharedKeyResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure responding to request")
}
return
}
// SetSharedKeyPreparer prepares the SetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (*http.Request, error) {
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -516,7 +529,7 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resour
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -529,18 +542,19 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resour
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) {
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}

View file

@ -48,34 +48,36 @@ func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID s
// CreateOrUpdate the Put VirtualNetworkGateway operation creates/updates a
// virtual network gateway in the specified resource group through Network
// resource provider.
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Create or update Virtual
// Network Gateway operation through Network resource provider.
func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGateway, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) {
func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -86,7 +88,7 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupN
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -99,49 +101,53 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupN
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete VirtualNetworkGateway operation deletes the specifed
// virtual network Gateway through Network resource provider.
// virtual network Gateway through Network resource provider. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway.
func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName)
func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -152,7 +158,7 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName stri
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -164,7 +170,9 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName stri
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -187,21 +195,21 @@ func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response)
// virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Generating Virtual Network
// Gateway Vpn client package operation through Network resource provider.
func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, ae error) {
func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) {
req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request")
}
resp, err := client.GeneratevpnclientpackageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request")
}
result, err = client.GeneratevpnclientpackageResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request")
}
return
@ -232,7 +240,7 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(reso
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always
@ -253,21 +261,21 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(res
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway.
func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, ae error) {
func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request")
}
return
@ -297,7 +305,7 @@ func (client VirtualNetworkGatewaysClient) GetPreparer(resourceGroupName string,
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -317,21 +325,21 @@ func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (re
// network gateways stored.
//
// resourceGroupName is the name of the resource group.
func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, ae error) {
func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request")
}
return
@ -360,7 +368,7 @@ func (client VirtualNetworkGatewaysClient) ListPreparer(resourceGroupName string
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -377,10 +385,10 @@ func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (r
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, ae error) {
func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) {
req, err := lastResults.VirtualNetworkGatewayListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -389,12 +397,12 @@ func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNe
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to next results request request")
}
return
@ -402,34 +410,36 @@ func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNe
// Reset the Reset VirtualNetworkGateway operation resets the primary of the
// virtual network gateway in the specified resource group through Network
// resource provider.
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Reset Virtual Network
// Gateway operation through Network resource provider.
func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGateway, ae error) {
req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request")
}
resp, err := client.ResetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure sending request")
}
result, err = client.ResetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure responding to request")
}
return
}
// ResetPreparer prepares the Reset request.
func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) {
func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -440,7 +450,7 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName strin
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -453,18 +463,19 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName strin
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ResetResponder handles the response to the Reset request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}

View file

@ -47,33 +47,36 @@ func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string)
}
// CreateOrUpdate the Put VirtualNetwork operation creates/updates a virtual
// network in the specified resource group.
// network in the specified resource group. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. parameters is parameters supplied to the
// create/update Virtual Network operation
func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetwork, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters)
func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (*http.Request, error) {
func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -84,7 +87,7 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName str
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -97,49 +100,52 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName str
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) {
func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete the Delete VirtualNetwork operation deletes the specifed virtual
// network
// network This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network.
func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName)
func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -150,7 +156,7 @@ func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, vir
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -162,7 +168,9 @@ func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, vir
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -182,21 +190,21 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. expand is expand references resources.
func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, ae error) {
func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request")
}
return
@ -229,7 +237,7 @@ func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtua
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -249,21 +257,21 @@ func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result Vi
// group
//
// resourceGroupName is the name of the resource group.
func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, ae error) {
func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request")
}
return
@ -292,7 +300,7 @@ func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*htt
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -309,10 +317,10 @@ func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result V
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, ae error) {
func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -321,12 +329,12 @@ func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkLi
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to next results request request")
}
return
@ -334,21 +342,21 @@ func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkLi
// ListAll the list VirtualNetwork returns all Virtual Networks in a
// subscription
func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, ae error) {
func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request")
}
return
@ -376,7 +384,7 @@ func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) {
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
@ -393,10 +401,10 @@ func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (resul
}
// ListAllNextResults retrieves the next set of results, if any.
func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, ae error) {
func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -405,12 +413,12 @@ func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetwor
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending next results request request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "network/VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request request")
}
return

View file

@ -63,21 +63,21 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client ManagementClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, ae error) {
func (client ManagementClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, err error) {
req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "CheckExistence", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "CheckExistence", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "CheckExistence", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "CheckExistence", resp, "Failure sending request")
}
result, err = client.CheckExistenceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "CheckExistence", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "CheckExistence", resp, "Failure responding to request")
}
return
@ -110,7 +110,7 @@ func (client ManagementClient) CheckExistencePreparer(resourceGroupName string,
// CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
@ -132,21 +132,21 @@ func (client ManagementClient) CheckExistenceResponder(resp *http.Response) (res
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity. parameters is create or
// update resource parameters.
func (client ManagementClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (result GenericResource, ae error) {
func (client ManagementClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (result GenericResource, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -180,7 +180,7 @@ func (client ManagementClient) CreateOrUpdatePreparer(resourceGroupName string,
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -202,21 +202,21 @@ func (client ManagementClient) CreateOrUpdateResponder(resp *http.Response) (res
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client ManagementClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, ae error) {
func (client ManagementClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "Delete", resp, "Failure responding to request")
}
return
@ -249,7 +249,7 @@ func (client ManagementClient) DeletePreparer(resourceGroupName string, resource
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -270,21 +270,21 @@ func (client ManagementClient) DeleteResponder(resp *http.Response) (result auto
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client ManagementClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result GenericResource, ae error) {
func (client ManagementClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result GenericResource, err error) {
req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "Get", resp, "Failure responding to request")
}
return
@ -317,7 +317,7 @@ func (client ManagementClient) GetPreparer(resourceGroupName string, resourcePro
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -337,28 +337,28 @@ func (client ManagementClient) GetResponder(resp *http.Response) (result Generic
//
// filter is the filter to apply on the operation. top is query parameters. If
// null is passed returns all resource groups.
func (client ManagementClient) List(filter string, top *int) (result ResourceListResult, ae error) {
func (client ManagementClient) List(filter string, top *int32) (result ResourceListResult, err error) {
req, err := client.ListPreparer(filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ManagementClient) ListPreparer(filter string, top *int) (*http.Request, error) {
func (client ManagementClient) ListPreparer(filter string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(client.SubscriptionID),
}
@ -385,7 +385,7 @@ func (client ManagementClient) ListPreparer(filter string, top *int) (*http.Requ
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -402,10 +402,10 @@ func (client ManagementClient) ListResponder(resp *http.Response) (result Resour
}
// ListNextResults retrieves the next set of results, if any.
func (client ManagementClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, ae error) {
func (client ManagementClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -414,44 +414,47 @@ func (client ManagementClient) ListNextResults(lastResults ResourceListResult) (
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "List", resp, "Failure responding to next results request request")
}
return
}
// MoveResources begin moving resources.To determine whether the operation has
// finished processing the request, call GetLongRunningOperationStatus.
// finished processing the request, call GetLongRunningOperationStatus. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// sourceResourceGroupName is source resource group name. parameters is move
// resources' parameters.
func (client ManagementClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo) (result autorest.Response, ae error) {
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters)
func (client ManagementClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "MoveResources", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "MoveResources", nil, "Failure preparing request")
}
resp, err := client.MoveResourcesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/ManagementClient", "MoveResources", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ManagementClient", "MoveResources", resp, "Failure sending request")
}
result, err = client.MoveResourcesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ManagementClient", "MoveResources", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ManagementClient", "MoveResources", resp, "Failure responding to request")
}
return
}
// MoveResourcesPreparer prepares the MoveResources request.
func (client ManagementClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) {
func (client ManagementClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"sourceResourceGroupName": url.QueryEscape(sourceResourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -461,7 +464,7 @@ func (client ManagementClient) MoveResourcesPreparer(sourceResourceGroupName str
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -474,7 +477,9 @@ func (client ManagementClient) MoveResourcesPreparer(sourceResourceGroupName str
// MoveResourcesSender sends the MoveResources request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) MoveResourcesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// MoveResourcesResponder handles the response to the MoveResources request. The method always

View file

@ -48,21 +48,21 @@ func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID str
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment. operationID is
// operation Id.
func (client DeploymentOperationsClient) Get(resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, ae error) {
func (client DeploymentOperationsClient) Get(resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) {
req, err := client.GetPreparer(resourceGroupName, deploymentName, operationID)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure responding to request")
}
return
@ -93,7 +93,7 @@ func (client DeploymentOperationsClient) GetPreparer(resourceGroupName string, d
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -114,28 +114,28 @@ func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (resu
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment. top is query
// parameters.
func (client DeploymentOperationsClient) List(resourceGroupName string, deploymentName string, top *int) (result DeploymentOperationsListResult, ae error) {
func (client DeploymentOperationsClient) List(resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, deploymentName, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string, deploymentName string, top *int) (*http.Request, error) {
func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"deploymentName": url.QueryEscape(deploymentName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -161,7 +161,7 @@ func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string,
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -178,10 +178,10 @@ func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (res
}
// ListNextResults retrieves the next set of results, if any.
func (client DeploymentOperationsClient) ListNextResults(lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, ae error) {
func (client DeploymentOperationsClient) ListNextResults(lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) {
req, err := lastResults.DeploymentOperationsListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -190,12 +190,12 @@ func (client DeploymentOperationsClient) ListNextResults(lastResults DeploymentO
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentOperationsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -46,21 +46,21 @@ func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) Depl
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment.
func (client DeploymentsClient) Cancel(resourceGroupName string, deploymentName string) (result autorest.Response, ae error) {
func (client DeploymentsClient) Cancel(resourceGroupName string, deploymentName string) (result autorest.Response, err error) {
req, err := client.CancelPreparer(resourceGroupName, deploymentName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Cancel", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", nil, "Failure preparing request")
}
resp, err := client.CancelSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Cancel", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure sending request")
}
result, err = client.CancelResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Cancel", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure responding to request")
}
return
@ -90,7 +90,7 @@ func (client DeploymentsClient) CancelPreparer(resourceGroupName string, deploym
// CancelSender sends the Cancel request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CancelResponder handles the response to the Cancel request. The method always
@ -109,21 +109,21 @@ func (client DeploymentsClient) CancelResponder(resp *http.Response) (result aut
//
// resourceGroupName is the name of the resource group to check. The name is
// case insensitive. deploymentName is the name of the deployment.
func (client DeploymentsClient) CheckExistence(resourceGroupName string, deploymentName string) (result autorest.Response, ae error) {
func (client DeploymentsClient) CheckExistence(resourceGroupName string, deploymentName string) (result autorest.Response, err error) {
req, err := client.CheckExistencePreparer(resourceGroupName, deploymentName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CheckExistence", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CheckExistence", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure sending request")
}
result, err = client.CheckExistenceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CheckExistence", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure responding to request")
}
return
@ -153,7 +153,7 @@ func (client DeploymentsClient) CheckExistencePreparer(resourceGroupName string,
// CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
@ -168,33 +168,36 @@ func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (re
return
}
// CreateOrUpdate create a named template deployment using a template.
// CreateOrUpdate create a named template deployment using a template. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment. parameters is
// additional parameters supplied to the operation.
func (client DeploymentsClient) CreateOrUpdate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentExtended, ae error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, deploymentName, parameters)
func (client DeploymentsClient) CreateOrUpdate(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, deploymentName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CreateOrUpdate", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) {
func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"deploymentName": url.QueryEscape(deploymentName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -205,7 +208,7 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string,
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -218,49 +221,53 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string,
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) {
func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
result.Response = resp
return
}
// Delete begin deleting deployment.To determine whether the operation has
// finished processing the request, call GetLongRunningOperationStatus.
// finished processing the request, call GetLongRunningOperationStatus. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment to be deleted.
func (client DeploymentsClient) Delete(resourceGroupName string, deploymentName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName, deploymentName)
func (client DeploymentsClient) Delete(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, deploymentName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploymentName string) (*http.Request, error) {
func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"deploymentName": url.QueryEscape(deploymentName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -271,7 +278,7 @@ func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploym
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -283,7 +290,9 @@ func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploym
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -302,21 +311,21 @@ func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result aut
//
// resourceGroupName is the name of the resource group to get. The name is
// case insensitive. deploymentName is the name of the deployment.
func (client DeploymentsClient) Get(resourceGroupName string, deploymentName string) (result DeploymentExtended, ae error) {
func (client DeploymentsClient) Get(resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) {
req, err := client.GetPreparer(resourceGroupName, deploymentName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure responding to request")
}
return
@ -346,7 +355,7 @@ func (client DeploymentsClient) GetPreparer(resourceGroupName string, deployment
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -367,28 +376,28 @@ func (client DeploymentsClient) GetResponder(resp *http.Response) (result Deploy
// resourceGroupName is the name of the resource group to filter by. The name
// is case insensitive. filter is the filter to apply on the operation. top
// is query parameters. If null is passed returns all deployments.
func (client DeploymentsClient) List(resourceGroupName string, filter string, top *int) (result DeploymentListResult, ae error) {
func (client DeploymentsClient) List(resourceGroupName string, filter string, top *int32) (result DeploymentListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter string, top *int) (*http.Request, error) {
func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -416,7 +425,7 @@ func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter st
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -433,10 +442,10 @@ func (client DeploymentsClient) ListResponder(resp *http.Response) (result Deplo
}
// ListNextResults retrieves the next set of results, if any.
func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult) (result DeploymentListResult, ae error) {
func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult) (result DeploymentListResult, err error) {
req, err := lastResults.DeploymentListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -445,12 +454,12 @@ func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -461,21 +470,21 @@ func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment. parameters is
// deployment to validate.
func (client DeploymentsClient) Validate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, ae error) {
func (client DeploymentsClient) Validate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
req, err := client.ValidatePreparer(resourceGroupName, deploymentName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Validate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", nil, "Failure preparing request")
}
resp, err := client.ValidateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Validate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure sending request")
}
result, err = client.ValidateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/DeploymentsClient", "Validate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure responding to request")
}
return
@ -506,7 +515,7 @@ func (client DeploymentsClient) ValidatePreparer(resourceGroupName string, deplo
// ValidateSender sends the Validate request. The method will close the
// http.Response Body if it receives an error.
func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ValidateResponder handles the response to the Validate request. The method always

View file

@ -44,21 +44,21 @@ func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsCli
//
// resourceGroupName is the name of the resource group to check. The name is
// case insensitive.
func (client GroupsClient) CheckExistence(resourceGroupName string) (result autorest.Response, ae error) {
func (client GroupsClient) CheckExistence(resourceGroupName string) (result autorest.Response, err error) {
req, err := client.CheckExistencePreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "CheckExistence", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "CheckExistence", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure sending request")
}
result, err = client.CheckExistenceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "CheckExistence", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure responding to request")
}
return
@ -87,7 +87,7 @@ func (client GroupsClient) CheckExistencePreparer(resourceGroupName string) (*ht
// CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
@ -107,21 +107,21 @@ func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result
// resourceGroupName is the name of the resource group to be created or
// updated. parameters is parameters supplied to the create or update
// resource group service operation.
func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, ae error) {
func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -151,7 +151,7 @@ func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, para
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -168,32 +168,35 @@ func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result
}
// Delete begin deleting resource group.To determine whether the operation has
// finished processing the request, call GetLongRunningOperationStatus.
// finished processing the request, call GetLongRunningOperationStatus. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group to be deleted. The name
// is case insensitive.
func (client GroupsClient) Delete(resourceGroupName string) (result autorest.Response, ae error) {
req, err := client.DeletePreparer(resourceGroupName)
func (client GroupsClient) Delete(resourceGroupName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client GroupsClient) DeletePreparer(resourceGroupName string) (*http.Request, error) {
func (client GroupsClient) DeletePreparer(resourceGroupName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -203,7 +206,7 @@ func (client GroupsClient) DeletePreparer(resourceGroupName string) (*http.Reque
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
@ -215,7 +218,9 @@ func (client GroupsClient) DeletePreparer(resourceGroupName string) (*http.Reque
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
@ -234,21 +239,21 @@ func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest
//
// resourceGroupName is the name of the resource group to get. The name is
// case insensitive.
func (client GroupsClient) Get(resourceGroupName string) (result ResourceGroup, ae error) {
func (client GroupsClient) Get(resourceGroupName string) (result ResourceGroup, err error) {
req, err := client.GetPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure responding to request")
}
return
@ -277,7 +282,7 @@ func (client GroupsClient) GetPreparer(resourceGroupName string) (*http.Request,
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -297,28 +302,28 @@ func (client GroupsClient) GetResponder(resp *http.Response) (result ResourceGro
//
// filter is the filter to apply on the operation. top is query parameters. If
// null is passed returns all resource groups.
func (client GroupsClient) List(filter string, top *int) (result ResourceGroupListResult, ae error) {
func (client GroupsClient) List(filter string, top *int32) (result ResourceGroupListResult, err error) {
req, err := client.ListPreparer(filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client GroupsClient) ListPreparer(filter string, top *int) (*http.Request, error) {
func (client GroupsClient) ListPreparer(filter string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(client.SubscriptionID),
}
@ -345,7 +350,7 @@ func (client GroupsClient) ListPreparer(filter string, top *int) (*http.Request,
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -362,10 +367,10 @@ func (client GroupsClient) ListResponder(resp *http.Response) (result ResourceGr
}
// ListNextResults retrieves the next set of results, if any.
func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult) (result ResourceGroupListResult, ae error) {
func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult) (result ResourceGroupListResult, err error) {
req, err := lastResults.ResourceGroupListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -374,12 +379,12 @@ func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult)
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -390,28 +395,28 @@ func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult)
// resourceGroupName is query parameters. If null is passed returns all
// resource groups. filter is the filter to apply on the operation. top is
// query parameters. If null is passed returns all resource groups.
func (client GroupsClient) ListResources(resourceGroupName string, filter string, top *int) (result ResourceListResult, ae error) {
func (client GroupsClient) ListResources(resourceGroupName string, filter string, top *int32) (result ResourceListResult, err error) {
req, err := client.ListResourcesPreparer(resourceGroupName, filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing request")
}
resp, err := client.ListResourcesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending request")
}
result, err = client.ListResourcesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to request")
}
return
}
// ListResourcesPreparer prepares the ListResources request.
func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filter string, top *int) (*http.Request, error) {
func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filter string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": url.QueryEscape(resourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -439,7 +444,7 @@ func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filte
// ListResourcesSender sends the ListResources request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) ListResourcesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResourcesResponder handles the response to the ListResources request. The method always
@ -456,10 +461,10 @@ func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result R
}
// ListResourcesNextResults retrieves the next set of results, if any.
func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResult) (result ResourceListResult, ae error) {
func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -468,12 +473,12 @@ func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResu
resp, err := client.ListResourcesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending next results request request")
}
result, err = client.ListResourcesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "ListResources", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to next results request request")
}
return
@ -487,21 +492,21 @@ func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResu
// resourceGroupName is the name of the resource group to be created or
// updated. The name is case insensitive. parameters is parameters supplied
// to the update state resource group service operation.
func (client GroupsClient) Patch(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, ae error) {
func (client GroupsClient) Patch(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, err error) {
req, err := client.PatchPreparer(resourceGroupName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Patch", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", nil, "Failure preparing request")
}
resp, err := client.PatchSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/GroupsClient", "Patch", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure sending request")
}
result, err = client.PatchResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/GroupsClient", "Patch", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure responding to request")
}
return
@ -531,7 +536,7 @@ func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters Re
// PatchSender sends the Patch request. The method will close the
// http.Response Body if it receives an error.
func (client GroupsClient) PatchSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// PatchResponder handles the response to the Patch request. The method always

View file

@ -47,21 +47,21 @@ func NewPolicyAssignmentsClientWithBaseURI(baseURI string, subscriptionID string
//
// scope is scope. policyAssignmentName is policy assignment name. parameters
// is policy assignment.
func (client PolicyAssignmentsClient) Create(scope string, policyAssignmentName string, parameters PolicyAssignment) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) Create(scope string, policyAssignmentName string, parameters PolicyAssignment) (result PolicyAssignment, err error) {
req, err := client.CreatePreparer(scope, policyAssignmentName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Create", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Create", nil, "Failure preparing request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Create", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Create", resp, "Failure sending request")
}
result, err = client.CreateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Create", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Create", resp, "Failure responding to request")
}
return
@ -92,7 +92,7 @@ func (client PolicyAssignmentsClient) CreatePreparer(scope string, policyAssignm
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateResponder handles the response to the Create request. The method always
@ -111,21 +111,21 @@ func (client PolicyAssignmentsClient) CreateResponder(resp *http.Response) (resu
// CreateByID create policy assignment by Id.
//
// policyAssignmentID is policy assignment Id parameters is policy assignment.
func (client PolicyAssignmentsClient) CreateByID(policyAssignmentID string, parameters PolicyAssignment) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) CreateByID(policyAssignmentID string, parameters PolicyAssignment) (result PolicyAssignment, err error) {
req, err := client.CreateByIDPreparer(policyAssignmentID, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "CreateByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "CreateByID", nil, "Failure preparing request")
}
resp, err := client.CreateByIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "CreateByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "CreateByID", resp, "Failure sending request")
}
result, err = client.CreateByIDResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "CreateByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "CreateByID", resp, "Failure responding to request")
}
return
@ -155,7 +155,7 @@ func (client PolicyAssignmentsClient) CreateByIDPreparer(policyAssignmentID stri
// CreateByIDSender sends the CreateByID request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateByIDResponder handles the response to the CreateByID request. The method always
@ -174,21 +174,21 @@ func (client PolicyAssignmentsClient) CreateByIDResponder(resp *http.Response) (
// Delete delete policy assignment.
//
// scope is scope. policyAssignmentName is policy assignment name.
func (client PolicyAssignmentsClient) Delete(scope string, policyAssignmentName string) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) Delete(scope string, policyAssignmentName string) (result PolicyAssignment, err error) {
req, err := client.DeletePreparer(scope, policyAssignmentName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Delete", resp, "Failure responding to request")
}
return
@ -218,7 +218,7 @@ func (client PolicyAssignmentsClient) DeletePreparer(scope string, policyAssignm
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -237,21 +237,21 @@ func (client PolicyAssignmentsClient) DeleteResponder(resp *http.Response) (resu
// DeleteByID delete policy assignment.
//
// policyAssignmentID is policy assignment Id
func (client PolicyAssignmentsClient) DeleteByID(policyAssignmentID string) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) DeleteByID(policyAssignmentID string) (result PolicyAssignment, err error) {
req, err := client.DeleteByIDPreparer(policyAssignmentID)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "DeleteByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "DeleteByID", nil, "Failure preparing request")
}
resp, err := client.DeleteByIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "DeleteByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "DeleteByID", resp, "Failure sending request")
}
result, err = client.DeleteByIDResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "DeleteByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "DeleteByID", resp, "Failure responding to request")
}
return
@ -280,7 +280,7 @@ func (client PolicyAssignmentsClient) DeleteByIDPreparer(policyAssignmentID stri
// DeleteByIDSender sends the DeleteByID request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteByIDResponder handles the response to the DeleteByID request. The method always
@ -299,21 +299,21 @@ func (client PolicyAssignmentsClient) DeleteByIDResponder(resp *http.Response) (
// Get get single policy assignment.
//
// scope is scope. policyAssignmentName is policy assignment name.
func (client PolicyAssignmentsClient) Get(scope string, policyAssignmentName string) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) Get(scope string, policyAssignmentName string) (result PolicyAssignment, err error) {
req, err := client.GetPreparer(scope, policyAssignmentName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "Get", resp, "Failure responding to request")
}
return
@ -343,7 +343,7 @@ func (client PolicyAssignmentsClient) GetPreparer(scope string, policyAssignment
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -362,21 +362,21 @@ func (client PolicyAssignmentsClient) GetResponder(resp *http.Response) (result
// GetByID get single policy assignment.
//
// policyAssignmentID is policy assignment Id
func (client PolicyAssignmentsClient) GetByID(policyAssignmentID string) (result PolicyAssignment, ae error) {
func (client PolicyAssignmentsClient) GetByID(policyAssignmentID string) (result PolicyAssignment, err error) {
req, err := client.GetByIDPreparer(policyAssignmentID)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "GetByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "GetByID", nil, "Failure preparing request")
}
resp, err := client.GetByIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "GetByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "GetByID", resp, "Failure sending request")
}
result, err = client.GetByIDResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "GetByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "GetByID", resp, "Failure responding to request")
}
return
@ -405,7 +405,7 @@ func (client PolicyAssignmentsClient) GetByIDPreparer(policyAssignmentID string)
// GetByIDSender sends the GetByID request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetByIDResponder handles the response to the GetByID request. The method always
@ -424,21 +424,21 @@ func (client PolicyAssignmentsClient) GetByIDResponder(resp *http.Response) (res
// List gets policy assignments of the subscription.
//
// filter is the filter to apply on the operation.
func (client PolicyAssignmentsClient) List(filter string) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) List(filter string) (result PolicyAssignmentListResult, err error) {
req, err := client.ListPreparer(filter)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", resp, "Failure responding to request")
}
return
@ -469,7 +469,7 @@ func (client PolicyAssignmentsClient) ListPreparer(filter string) (*http.Request
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -486,10 +486,10 @@ func (client PolicyAssignmentsClient) ListResponder(resp *http.Response) (result
}
// ListNextResults retrieves the next set of results, if any.
func (client PolicyAssignmentsClient) ListNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, err error) {
req, err := lastResults.PolicyAssignmentListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -498,12 +498,12 @@ func (client PolicyAssignmentsClient) ListNextResults(lastResults PolicyAssignme
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "List", resp, "Failure responding to next results request request")
}
return
@ -516,21 +516,21 @@ func (client PolicyAssignmentsClient) ListNextResults(lastResults PolicyAssignme
// parentResourcePath is the parent resource path. resourceType is the
// resource type. resourceName is the resource name. filter is the filter to
// apply on the operation.
func (client PolicyAssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result PolicyAssignmentListResult, err error) {
req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", nil, "Failure preparing request")
}
resp, err := client.ListForResourceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", resp, "Failure sending request")
}
result, err = client.ListForResourceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", resp, "Failure responding to request")
}
return
@ -566,7 +566,7 @@ func (client PolicyAssignmentsClient) ListForResourcePreparer(resourceGroupName
// ListForResourceSender sends the ListForResource request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListForResourceResponder handles the response to the ListForResource request. The method always
@ -583,10 +583,10 @@ func (client PolicyAssignmentsClient) ListForResourceResponder(resp *http.Respon
}
// ListForResourceNextResults retrieves the next set of results, if any.
func (client PolicyAssignmentsClient) ListForResourceNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForResourceNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, err error) {
req, err := lastResults.PolicyAssignmentListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -595,12 +595,12 @@ func (client PolicyAssignmentsClient) ListForResourceNextResults(lastResults Pol
resp, err := client.ListForResourceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", resp, "Failure sending next results request request")
}
result, err = client.ListForResourceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResource", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResource", resp, "Failure responding to next results request request")
}
return
@ -610,21 +610,21 @@ func (client PolicyAssignmentsClient) ListForResourceNextResults(lastResults Pol
//
// resourceGroupName is resource group name. filter is the filter to apply on
// the operation.
func (client PolicyAssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result PolicyAssignmentListResult, err error) {
req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request")
}
resp, err := client.ListForResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request")
}
result, err = client.ListForResourceGroupResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request")
}
return
@ -656,7 +656,7 @@ func (client PolicyAssignmentsClient) ListForResourceGroupPreparer(resourceGroup
// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always
@ -673,10 +673,10 @@ func (client PolicyAssignmentsClient) ListForResourceGroupResponder(resp *http.R
}
// ListForResourceGroupNextResults retrieves the next set of results, if any.
func (client PolicyAssignmentsClient) ListForResourceGroupNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForResourceGroupNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, err error) {
req, err := lastResults.PolicyAssignmentListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -685,12 +685,12 @@ func (client PolicyAssignmentsClient) ListForResourceGroupNextResults(lastResult
resp, err := client.ListForResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request request")
}
result, err = client.ListForResourceGroupResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request request")
}
return
@ -699,21 +699,21 @@ func (client PolicyAssignmentsClient) ListForResourceGroupNextResults(lastResult
// ListForScope gets policy assignments of the scope.
//
// scope is scope. filter is the filter to apply on the operation.
func (client PolicyAssignmentsClient) ListForScope(scope string, filter string) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForScope(scope string, filter string) (result PolicyAssignmentListResult, err error) {
req, err := client.ListForScopePreparer(scope, filter)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", nil, "Failure preparing request")
}
resp, err := client.ListForScopeSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", resp, "Failure sending request")
}
result, err = client.ListForScopeResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", resp, "Failure responding to request")
}
return
@ -745,7 +745,7 @@ func (client PolicyAssignmentsClient) ListForScopePreparer(scope string, filter
// ListForScopeSender sends the ListForScope request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListForScopeResponder handles the response to the ListForScope request. The method always
@ -762,10 +762,10 @@ func (client PolicyAssignmentsClient) ListForScopeResponder(resp *http.Response)
}
// ListForScopeNextResults retrieves the next set of results, if any.
func (client PolicyAssignmentsClient) ListForScopeNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, ae error) {
func (client PolicyAssignmentsClient) ListForScopeNextResults(lastResults PolicyAssignmentListResult) (result PolicyAssignmentListResult, err error) {
req, err := lastResults.PolicyAssignmentListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -774,12 +774,12 @@ func (client PolicyAssignmentsClient) ListForScopeNextResults(lastResults Policy
resp, err := client.ListForScopeSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", resp, "Failure sending next results request request")
}
result, err = client.ListForScopeResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyAssignmentsClient", "ListForScope", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.PolicyAssignmentsClient", "ListForScope", resp, "Failure responding to next results request request")
}
return

View file

@ -47,21 +47,21 @@ func NewPolicyDefinitionsClientWithBaseURI(baseURI string, subscriptionID string
//
// policyDefinitionName is the policy definition name. parameters is the
// policy definition properties
func (client PolicyDefinitionsClient) CreateOrUpdate(policyDefinitionName string, parameters PolicyDefinition) (result PolicyDefinition, ae error) {
func (client PolicyDefinitionsClient) CreateOrUpdate(policyDefinitionName string, parameters PolicyDefinition) (result PolicyDefinition, err error) {
req, err := client.CreateOrUpdatePreparer(policyDefinitionName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -91,7 +91,7 @@ func (client PolicyDefinitionsClient) CreateOrUpdatePreparer(policyDefinitionNam
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -110,21 +110,21 @@ func (client PolicyDefinitionsClient) CreateOrUpdateResponder(resp *http.Respons
// Delete deletes policy definition.
//
// policyDefinitionName is the policy definition name.
func (client PolicyDefinitionsClient) Delete(policyDefinitionName string) (result autorest.Response, ae error) {
func (client PolicyDefinitionsClient) Delete(policyDefinitionName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(policyDefinitionName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Delete", resp, "Failure responding to request")
}
return
@ -153,7 +153,7 @@ func (client PolicyDefinitionsClient) DeletePreparer(policyDefinitionName string
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -171,21 +171,21 @@ func (client PolicyDefinitionsClient) DeleteResponder(resp *http.Response) (resu
// Get gets policy definition.
//
// policyDefinitionName is the policy definition name.
func (client PolicyDefinitionsClient) Get(policyDefinitionName string) (result PolicyDefinition, ae error) {
func (client PolicyDefinitionsClient) Get(policyDefinitionName string) (result PolicyDefinition, err error) {
req, err := client.GetPreparer(policyDefinitionName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/PolicyDefinitionsClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.PolicyDefinitionsClient", "Get", resp, "Failure responding to request")
}
return
@ -214,7 +214,7 @@ func (client PolicyDefinitionsClient) GetPreparer(policyDefinitionName string) (
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client PolicyDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always

View file

@ -46,21 +46,21 @@ func NewProviderOperationDetailsClientWithBaseURI(baseURI string, subscriptionID
// List gets a list of resource providers.
//
// resourceProviderNamespace is resource identity.
func (client ProviderOperationDetailsClient) List(resourceProviderNamespace string, apiVersion string) (result ResourceProviderOperationDetailListResult, ae error) {
func (client ProviderOperationDetailsClient) List(resourceProviderNamespace string, apiVersion string) (result ResourceProviderOperationDetailListResult, err error) {
req, err := client.ListPreparer(resourceProviderNamespace, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", resp, "Failure responding to request")
}
return
@ -89,7 +89,7 @@ func (client ProviderOperationDetailsClient) ListPreparer(resourceProviderNamesp
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ProviderOperationDetailsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -106,10 +106,10 @@ func (client ProviderOperationDetailsClient) ListResponder(resp *http.Response)
}
// ListNextResults retrieves the next set of results, if any.
func (client ProviderOperationDetailsClient) ListNextResults(lastResults ResourceProviderOperationDetailListResult) (result ResourceProviderOperationDetailListResult, ae error) {
func (client ProviderOperationDetailsClient) ListNextResults(lastResults ResourceProviderOperationDetailListResult) (result ResourceProviderOperationDetailListResult, err error) {
req, err := lastResults.ResourceProviderOperationDetailListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -118,12 +118,12 @@ func (client ProviderOperationDetailsClient) ListNextResults(lastResults Resourc
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProviderOperationDetailsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.ProviderOperationDetailsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -45,21 +45,21 @@ func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) Provid
// Get gets a resource provider.
//
// resourceProviderNamespace is namespace of the resource provider.
func (client ProvidersClient) Get(resourceProviderNamespace string) (result Provider, ae error) {
func (client ProvidersClient) Get(resourceProviderNamespace string) (result Provider, err error) {
req, err := client.GetPreparer(resourceProviderNamespace)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProvidersClient", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure responding to request")
}
return
@ -88,7 +88,7 @@ func (client ProvidersClient) GetPreparer(resourceProviderNamespace string) (*ht
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -107,28 +107,28 @@ func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider
// List gets a list of resource providers.
//
// top is query parameters. If null is passed returns all deployments.
func (client ProvidersClient) List(top *int) (result ProviderListResult, ae error) {
func (client ProvidersClient) List(top *int32) (result ProviderListResult, err error) {
req, err := client.ListPreparer(top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ProvidersClient) ListPreparer(top *int) (*http.Request, error) {
func (client ProvidersClient) ListPreparer(top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(client.SubscriptionID),
}
@ -152,7 +152,7 @@ func (client ProvidersClient) ListPreparer(top *int) (*http.Request, error) {
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -169,10 +169,10 @@ func (client ProvidersClient) ListResponder(resp *http.Response) (result Provide
}
// ListNextResults retrieves the next set of results, if any.
func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (result ProviderListResult, ae error) {
func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (result ProviderListResult, err error) {
req, err := lastResults.ProviderListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -181,12 +181,12 @@ func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (r
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProvidersClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to next results request request")
}
return
@ -195,21 +195,21 @@ func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (r
// Register registers provider to be used with a subscription.
//
// resourceProviderNamespace is namespace of the resource provider.
func (client ProvidersClient) Register(resourceProviderNamespace string) (result Provider, ae error) {
func (client ProvidersClient) Register(resourceProviderNamespace string) (result Provider, err error) {
req, err := client.RegisterPreparer(resourceProviderNamespace)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Register", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", nil, "Failure preparing request")
}
resp, err := client.RegisterSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Register", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure sending request")
}
result, err = client.RegisterResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProvidersClient", "Register", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure responding to request")
}
return
@ -238,7 +238,7 @@ func (client ProvidersClient) RegisterPreparer(resourceProviderNamespace string)
// RegisterSender sends the Register request. The method will close the
// http.Response Body if it receives an error.
func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// RegisterResponder handles the response to the Register request. The method always
@ -257,21 +257,21 @@ func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Pro
// Unregister unregisters provider from a subscription.
//
// resourceProviderNamespace is namespace of the resource provider.
func (client ProvidersClient) Unregister(resourceProviderNamespace string) (result Provider, ae error) {
func (client ProvidersClient) Unregister(resourceProviderNamespace string) (result Provider, err error) {
req, err := client.UnregisterPreparer(resourceProviderNamespace)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Unregister", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", nil, "Failure preparing request")
}
resp, err := client.UnregisterSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/ProvidersClient", "Unregister", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure sending request")
}
result, err = client.UnregisterResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/ProvidersClient", "Unregister", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure responding to request")
}
return
@ -300,7 +300,7 @@ func (client ProvidersClient) UnregisterPreparer(resourceProviderNamespace strin
// UnregisterSender sends the Unregister request. The method will close the
// http.Response Body if it receives an error.
func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// UnregisterResponder handles the response to the Unregister request. The method always

View file

@ -46,21 +46,21 @@ func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client Client) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, ae error) {
func (client Client) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, err error) {
req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "CheckExistence", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/Client", "CheckExistence", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure sending request")
}
result, err = client.CheckExistenceResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "CheckExistence", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure responding to request")
}
return
@ -93,7 +93,7 @@ func (client Client) CheckExistencePreparer(resourceGroupName string, resourcePr
// CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CheckExistenceSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
@ -115,21 +115,21 @@ func (client Client) CheckExistenceResponder(resp *http.Response) (result autore
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity. parameters is create or
// update resource parameters.
func (client Client) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (result GenericResource, ae error) {
func (client Client) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string, parameters GenericResource) (result GenericResource, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/Client", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -163,7 +163,7 @@ func (client Client) CreateOrUpdatePreparer(resourceGroupName string, resourcePr
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -185,21 +185,21 @@ func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Generi
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client Client) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, ae error) {
func (client Client) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/Client", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "Delete", resp, "Failure responding to request")
}
return
@ -232,7 +232,7 @@ func (client Client) DeletePreparer(resourceGroupName string, resourceProviderNa
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -253,21 +253,21 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo
// insensitive. resourceProviderNamespace is resource identity.
// parentResourcePath is resource identity. resourceType is resource
// identity. resourceName is resource identity.
func (client Client) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result GenericResource, ae error) {
func (client Client) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, apiVersion string) (result GenericResource, err error) {
req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/Client", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure responding to request")
}
return
@ -300,7 +300,7 @@ func (client Client) GetPreparer(resourceGroupName string, resourceProviderNames
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client Client) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
@ -320,28 +320,28 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource,
//
// filter is the filter to apply on the operation. top is query parameters. If
// null is passed returns all resource groups.
func (client Client) List(filter string, top *int) (result ResourceListResult, ae error) {
func (client Client) List(filter string, top *int32) (result ResourceListResult, err error) {
req, err := client.ListPreparer(filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/Client", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client Client) ListPreparer(filter string, top *int) (*http.Request, error) {
func (client Client) ListPreparer(filter string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(client.SubscriptionID),
}
@ -368,7 +368,7 @@ func (client Client) ListPreparer(filter string, top *int) (*http.Request, error
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -385,10 +385,10 @@ func (client Client) ListResponder(resp *http.Response) (result ResourceListResu
}
// ListNextResults retrieves the next set of results, if any.
func (client Client) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, ae error) {
func (client Client) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -397,44 +397,47 @@ func (client Client) ListNextResults(lastResults ResourceListResult) (result Res
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/Client", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to next results request request")
}
return
}
// MoveResources begin moving resources.To determine whether the operation has
// finished processing the request, call GetLongRunningOperationStatus.
// finished processing the request, call GetLongRunningOperationStatus. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
//
// sourceResourceGroupName is source resource group name. parameters is move
// resources' parameters.
func (client Client) MoveResources(sourceResourceGroupName string, parameters MoveInfo) (result autorest.Response, ae error) {
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters)
func (client Client) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/Client", "MoveResources", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.Client", "MoveResources", nil, "Failure preparing request")
}
resp, err := client.MoveResourcesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/Client", "MoveResources", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.Client", "MoveResources", resp, "Failure sending request")
}
result, err = client.MoveResourcesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/Client", "MoveResources", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", resp, "Failure responding to request")
}
return
}
// MoveResourcesPreparer prepares the MoveResources request.
func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo) (*http.Request, error) {
func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"sourceResourceGroupName": url.QueryEscape(sourceResourceGroupName),
"subscriptionId": url.QueryEscape(client.SubscriptionID),
@ -444,7 +447,7 @@ func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, param
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
@ -457,7 +460,9 @@ func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, param
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// MoveResourcesResponder handles the response to the MoveResources request. The method always

View file

@ -43,21 +43,21 @@ func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient
// CreateOrUpdate create a subscription resource tag.
//
// tagName is the name of the tag.
func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, ae error) {
func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, err error) {
req, err := client.CreateOrUpdatePreparer(tagName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
@ -86,7 +86,7 @@ func (client TagsClient) CreateOrUpdatePreparer(tagName string) (*http.Request,
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -105,21 +105,21 @@ func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result Ta
// CreateOrUpdateValue create a subscription resource tag value.
//
// tagName is the name of the tag. tagValue is the value of the tag.
func (client TagsClient) CreateOrUpdateValue(tagName string, tagValue string) (result TagValue, ae error) {
func (client TagsClient) CreateOrUpdateValue(tagName string, tagValue string) (result TagValue, err error) {
req, err := client.CreateOrUpdateValuePreparer(tagName, tagValue)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateValueSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdateValue", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateValueResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request")
}
return
@ -149,7 +149,7 @@ func (client TagsClient) CreateOrUpdateValuePreparer(tagName string, tagValue st
// CreateOrUpdateValueSender sends the CreateOrUpdateValue request. The method will close the
// http.Response Body if it receives an error.
func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateValueResponder handles the response to the CreateOrUpdateValue request. The method always
@ -168,21 +168,21 @@ func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (resu
// Delete delete a subscription resource tag.
//
// tagName is the name of the tag.
func (client TagsClient) Delete(tagName string) (result autorest.Response, ae error) {
func (client TagsClient) Delete(tagName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(tagName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure responding to request")
}
return
@ -211,7 +211,7 @@ func (client TagsClient) DeletePreparer(tagName string) (*http.Request, error) {
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -229,21 +229,21 @@ func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.R
// DeleteValue delete a subscription resource tag value.
//
// tagName is the name of the tag. tagValue is the value of the tag.
func (client TagsClient) DeleteValue(tagName string, tagValue string) (result autorest.Response, ae error) {
func (client TagsClient) DeleteValue(tagName string, tagValue string) (result autorest.Response, err error) {
req, err := client.DeleteValuePreparer(tagName, tagValue)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "DeleteValue", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", nil, "Failure preparing request")
}
resp, err := client.DeleteValueSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "DeleteValue", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure sending request")
}
result, err = client.DeleteValueResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "DeleteValue", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure responding to request")
}
return
@ -273,7 +273,7 @@ func (client TagsClient) DeleteValuePreparer(tagName string, tagValue string) (*
// DeleteValueSender sends the DeleteValue request. The method will close the
// http.Response Body if it receives an error.
func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteValueResponder handles the response to the DeleteValue request. The method always
@ -289,21 +289,21 @@ func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autor
}
// List get a list of subscription resource tags.
func (client TagsClient) List() (result TagsListResult, ae error) {
func (client TagsClient) List() (result TagsListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request")
}
return
@ -331,7 +331,7 @@ func (client TagsClient) ListPreparer() (*http.Request, error) {
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -348,10 +348,10 @@ func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResu
}
// ListNextResults retrieves the next set of results, if any.
func (client TagsClient) ListNextResults(lastResults TagsListResult) (result TagsListResult, ae error) {
func (client TagsClient) ListNextResults(lastResults TagsListResult) (result TagsListResult, err error) {
req, err := lastResults.TagsListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "List", nil, "Failure preparing next results request request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
@ -360,12 +360,12 @@ func (client TagsClient) ListNextResults(lastResults TagsListResult) (result Tag
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources/TagsClient", "List", resp, "Failure sending next results request request")
return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "resources/TagsClient", "List", resp, "Failure responding to next results request request")
err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to next results request request")
}
return

View file

@ -23,13 +23,13 @@ import (
)
const (
major = "0"
minor = "5"
patch = "0"
major = "2"
minor = "1"
patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
userAgentFormat = "Azure-SDK-for-Go/%s;Package arm/%s;API %s"
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.

View file

@ -0,0 +1,282 @@
// Package subscriptions implements the Azure ARM Subscriptions service API
// version 2015-11-01.
//
package subscriptions
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
"net/url"
)
const (
// APIVersion is the version of the Subscriptions
APIVersion = "2015-11-01"
// DefaultBaseURI is the default URI used for the service Subscriptions
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Subscriptions.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
// Get gets details about particular subscription.
//
// subscriptionID is id of the subscription.
func (client ManagementClient) Get(subscriptionID string) (result Subscription, err error) {
req, err := client.GetPreparer(subscriptionID)
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ManagementClient) GetPreparer(subscriptionID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(subscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions/{subscriptionId}"),
autorest.WithPathParameters(pathParameters),
autorest.WithQueryParameters(queryParameters))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ManagementClient) GetResponder(resp *http.Response) (result Subscription, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List gets a list of the subscriptionIds.
func (client ManagementClient) List() (result SubscriptionListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ManagementClient) ListPreparer() (*http.Request, error) {
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions"),
autorest.WithQueryParameters(queryParameters))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ManagementClient) ListResponder(resp *http.Response) (result SubscriptionListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ManagementClient) ListNextResults(lastResults SubscriptionListResult) (result SubscriptionListResult, err error) {
req, err := lastResults.SubscriptionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "List", resp, "Failure responding to next results request request")
}
return
}
// ListLocations gets a list of the subscription locations.
//
// subscriptionID is id of the subscription
func (client ManagementClient) ListLocations(subscriptionID string) (result LocationListResult, err error) {
req, err := client.ListLocationsPreparer(subscriptionID)
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", nil, "Failure preparing request")
}
resp, err := client.ListLocationsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", resp, "Failure sending request")
}
result, err = client.ListLocationsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", resp, "Failure responding to request")
}
return
}
// ListLocationsPreparer prepares the ListLocations request.
func (client ManagementClient) ListLocationsPreparer(subscriptionID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(subscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions/{subscriptionId}/locations"),
autorest.WithPathParameters(pathParameters),
autorest.WithQueryParameters(queryParameters))
}
// ListLocationsSender sends the ListLocations request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) ListLocationsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListLocationsResponder handles the response to the ListLocations request. The method always
// closes the http.Response Body.
func (client ManagementClient) ListLocationsResponder(resp *http.Response) (result LocationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListLocationsNextResults retrieves the next set of results, if any.
func (client ManagementClient) ListLocationsNextResults(lastResults LocationListResult) (result LocationListResult, err error) {
req, err := lastResults.LocationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", nil, "Failure preparing next results request request")
}
if req == nil {
return
}
resp, err := client.ListLocationsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", resp, "Failure sending next results request request")
}
result, err = client.ListLocationsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.ManagementClient", "ListLocations", resp, "Failure responding to next results request request")
}
return
}

View file

@ -0,0 +1,107 @@
package subscriptions
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// Location is location information.
type Location struct {
ID *string `json:"id,omitempty"`
SubscriptionID *string `json:"subscriptionId,omitempty"`
Name *string `json:"name,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Latitude *string `json:"latitude,omitempty"`
Longitude *string `json:"longitude,omitempty"`
}
// LocationListResult is location list operation response.
type LocationListResult struct {
autorest.Response `json:"-"`
Value *[]Location `json:"value,omitempty"`
NextLink *string `json:",omitempty"`
}
// LocationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client LocationListResult) LocationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// Subscription is subscription information.
type Subscription struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
SubscriptionID *string `json:"subscriptionId,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
State *string `json:"state,omitempty"`
}
// SubscriptionListResult is subscription list operation response.
type SubscriptionListResult struct {
autorest.Response `json:"-"`
Value *[]Subscription `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// SubscriptionListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client SubscriptionListResult) SubscriptionListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// TenantIDDescription is tenant Id information
type TenantIDDescription struct {
ID *string `json:"id,omitempty"`
TenantID *string `json:"tenantId,omitempty"`
}
// TenantListResult is tenant Ids information.
type TenantListResult struct {
autorest.Response `json:"-"`
Value *[]TenantIDDescription `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// TenantListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client TenantListResult) TenantListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}

View file

@ -0,0 +1,266 @@
package subscriptions
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
"net/url"
)
// Client is the client for the Subscriptions methods of the Subscriptions
// service.
type Client struct {
ManagementClient
}
// NewClient creates an instance of the Client client.
func NewClient(subscriptionID string) Client {
return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClientWithBaseURI creates an instance of the Client client.
func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
return Client{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets details about particular subscription.
//
// subscriptionID is id of the subscription.
func (client Client) Get(subscriptionID string) (result Subscription, err error) {
req, err := client.GetPreparer(subscriptionID)
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.Client", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client Client) GetPreparer(subscriptionID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(subscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions/{subscriptionId}"),
autorest.WithPathParameters(pathParameters),
autorest.WithQueryParameters(queryParameters))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client Client) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client Client) GetResponder(resp *http.Response) (result Subscription, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List gets a list of the subscriptionIds.
func (client Client) List() (result SubscriptionListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.Client", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client Client) ListPreparer() (*http.Request, error) {
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions"),
autorest.WithQueryParameters(queryParameters))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client Client) ListResponder(resp *http.Response) (result SubscriptionListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client Client) ListNextResults(lastResults SubscriptionListResult) (result SubscriptionListResult, err error) {
req, err := lastResults.SubscriptionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.Client", "List", resp, "Failure responding to next results request request")
}
return
}
// ListLocations gets a list of the subscription locations.
//
// subscriptionID is id of the subscription
func (client Client) ListLocations(subscriptionID string) (result LocationListResult, err error) {
req, err := client.ListLocationsPreparer(subscriptionID)
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", nil, "Failure preparing request")
}
resp, err := client.ListLocationsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", resp, "Failure sending request")
}
result, err = client.ListLocationsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", resp, "Failure responding to request")
}
return
}
// ListLocationsPreparer prepares the ListLocations request.
func (client Client) ListLocationsPreparer(subscriptionID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": url.QueryEscape(subscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/subscriptions/{subscriptionId}/locations"),
autorest.WithPathParameters(pathParameters),
autorest.WithQueryParameters(queryParameters))
}
// ListLocationsSender sends the ListLocations request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListLocationsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListLocationsResponder handles the response to the ListLocations request. The method always
// closes the http.Response Body.
func (client Client) ListLocationsResponder(resp *http.Response) (result LocationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListLocationsNextResults retrieves the next set of results, if any.
func (client Client) ListLocationsNextResults(lastResults LocationListResult) (result LocationListResult, err error) {
req, err := lastResults.LocationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", nil, "Failure preparing next results request request")
}
if req == nil {
return
}
resp, err := client.ListLocationsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", resp, "Failure sending next results request request")
}
result, err = client.ListLocationsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.Client", "ListLocations", resp, "Failure responding to next results request request")
}
return
}

View file

@ -0,0 +1,119 @@
package subscriptions
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// TenantsClient is the client for the Tenants methods of the Subscriptions
// service.
type TenantsClient struct {
ManagementClient
}
// NewTenantsClient creates an instance of the TenantsClient client.
func NewTenantsClient(subscriptionID string) TenantsClient {
return NewTenantsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewTenantsClientWithBaseURI creates an instance of the TenantsClient client.
func NewTenantsClientWithBaseURI(baseURI string, subscriptionID string) TenantsClient {
return TenantsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List gets a list of the tenantIds.
func (client TenantsClient) List() (result TenantListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client TenantsClient) ListPreparer() (*http.Request, error) {
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/tenants"),
autorest.WithQueryParameters(queryParameters))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client TenantsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client TenantsClient) ListResponder(resp *http.Response) (result TenantListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client TenantsClient) ListNextResults(lastResults TenantListResult) (result TenantListResult, err error) {
req, err := lastResults.TenantListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing next results request request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending next results request request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to next results request request")
}
return
}

View file

@ -0,0 +1,43 @@
package subscriptions
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"fmt"
)
const (
major = "2"
minor = "1"
patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "subscriptions", "2015-11-01")
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
}

View file

@ -46,21 +46,21 @@ func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) Account
// 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.
func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, ae error) {
func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) {
req, err := client.CheckNameAvailabilityPreparer(accountName)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request")
}
resp, err := client.CheckNameAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request")
}
result, err = client.CheckNameAvailabilityResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "CheckNameAvailability", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request")
}
return
@ -89,7 +89,7 @@ func (client AccountsClient) CheckNameAvailabilityPreparer(accountName AccountCh
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
@ -109,35 +109,38 @@ func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response)
// parameters. Existing accounts cannot be updated with this API and should
// instead use the Update Storage Account API. If an account is already
// created and subsequent PUT request is issued with exact same set of
// properties, then HTTP 200 would be returned.
// properties, then HTTP 200 would be returned. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group within the user's
// subscription. 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.
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, ae error) {
req, err := client.CreatePreparer(resourceGroupName, accountName, parameters)
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", resp, "Failure sending request")
result.Response = resp
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure sending request")
}
result, err = client.CreateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Create", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) {
func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"accountName": url.QueryEscape(accountName),
"resourceGroupName": url.QueryEscape(resourceGroupName),
@ -148,7 +151,7 @@ func (client AccountsClient) CreatePreparer(resourceGroupName string, accountNam
"api-version": APIVersion,
}
return autorest.Prepare(&http.Request{},
return autorest.Prepare(&http.Request{Cancel: cancel},
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
@ -161,19 +164,20 @@ func (client AccountsClient) CreatePreparer(resourceGroupName string, accountNam
// 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) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) {
func (client AccountsClient) CreateResponder(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
}
@ -183,21 +187,21 @@ func (client AccountsClient) CreateResponder(resp *http.Response) (result Accoun
// subscription. 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.
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, ae error) {
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, accountName)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request")
}
return
@ -227,7 +231,7 @@ func (client AccountsClient) DeletePreparer(resourceGroupName string, accountNam
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
@ -250,21 +254,21 @@ func (client AccountsClient) DeleteResponder(resp *http.Response) (result autore
// subscription. 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.
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, ae error) {
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) {
req, err := client.GetPropertiesPreparer(resourceGroupName, accountName)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request")
}
resp, err := client.GetPropertiesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request")
}
result, err = client.GetPropertiesResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "GetProperties", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request")
}
return
@ -294,7 +298,7 @@ func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, acc
// GetPropertiesSender sends the GetProperties request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// GetPropertiesResponder handles the response to the GetProperties request. The method always
@ -312,21 +316,21 @@ func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result
// List lists all the storage accounts available under the subscription. Note
// that storage keys are not returned; use the ListKeys operation for this.
func (client AccountsClient) List() (result AccountListResult, ae error) {
func (client AccountsClient) List() (result AccountListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request")
}
return
@ -354,7 +358,7 @@ func (client AccountsClient) ListPreparer() (*http.Request, error) {
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
@ -376,21 +380,21 @@ func (client AccountsClient) ListResponder(resp *http.Response) (result AccountL
//
// resourceGroupName is the name of the resource group within the user's
// subscription.
func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, ae error) {
func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request")
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "ListByResourceGroup", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
@ -419,7 +423,7 @@ func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName strin
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
@ -439,21 +443,21 @@ func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (
//
// resourceGroupName is the name of the resource group. accountName is the
// name of the storage account.
func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, ae error) {
func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) {
req, err := client.ListKeysPreparer(resourceGroupName, accountName)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request")
}
resp, err := client.ListKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request")
}
result, err = client.ListKeysResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "ListKeys", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request")
}
return
@ -483,7 +487,7 @@ func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountN
// ListKeysSender sends the ListKeys request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListKeysResponder handles the response to the ListKeys request. The method always
@ -507,21 +511,21 @@ func (client AccountsClient) ListKeysResponder(resp *http.Response) (result Acco
// 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 for the default keys
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountKeys, ae error) {
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountKeys, err error) {
req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request")
}
resp, err := client.RegenerateKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request")
}
result, err = client.RegenerateKeyResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "RegenerateKey", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request")
}
return
@ -552,7 +556,7 @@ func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, acc
// RegenerateKeySender sends the RegenerateKey request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
@ -587,21 +591,21 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result
// characters in length and use numbers and lower-case letters only.
// parameters is the parameters to update on the account. Note that only one
// property can be changed at a time using this API.
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, ae error) {
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) {
req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request")
}
result, err = client.UpdateResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/AccountsClient", "Update", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request")
}
return
@ -632,7 +636,7 @@ func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountNam
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always

View file

@ -1,7 +1,7 @@
// Package storage implements the Azure ARM Storage service API version
// 2015-06-15.
//
// The Storage Management Client..
// The Storage Management Client.
package storage
// Copyright (c) Microsoft and contributors. All rights reserved.

View file

@ -199,8 +199,8 @@ type Resource struct {
// Usage is describes Storage Resource Usage.
type Usage struct {
Unit UsageUnit `json:"unit,omitempty"`
CurrentValue *int `json:"currentValue,omitempty"`
Limit *int `json:"limit,omitempty"`
CurrentValue *int32 `json:"currentValue,omitempty"`
Limit *int32 `json:"limit,omitempty"`
Name *UsageName `json:"name,omitempty"`
}

View file

@ -44,21 +44,21 @@ func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string)
// List gets the current usage count and the limit for the resources under the
// subscription.
func (client UsageOperationsClient) List() (result UsageListResult, ae error) {
func (client UsageOperationsClient) List() (result UsageListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "storage/UsageOperationsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storage/UsageOperationsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
ae = autorest.NewErrorWithError(err, "storage/UsageOperationsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", resp, "Failure responding to request")
}
return
@ -86,7 +86,7 @@ func (client UsageOperationsClient) ListPreparer() (*http.Request, error) {
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req)
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always

View file

@ -23,13 +23,13 @@ import (
)
const (
major = "0"
minor = "5"
patch = "0"
major = "2"
minor = "1"
patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
userAgentFormat = "Azure-SDK-for-Go/%s;Package arm/%s;API %s"
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.

View file

@ -88,6 +88,16 @@ type BlobListResponse struct {
NextMarker string `xml:"NextMarker"`
MaxResults int64 `xml:"MaxResults"`
Blobs []Blob `xml:"Blobs>Blob"`
// BlobPrefix is used to traverse blobs as if it were a file system.
// It is returned if ListBlobsParameters.Delimiter is specified.
// The list here can be thought of as "folders" that may contain
// other folders or blobs.
BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"`
// Delimiter is used to traverse blobs as if it were a file system.
// It is returned if ListBlobsParameters.Delimiter is specified.
Delimiter string `xml:"Delimiter"`
}
// ListContainersParameters defines the set of customizable parameters to make a
@ -749,14 +759,16 @@ func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extra
// with 512-byte boundaries and chunk must be of size multiplies by 512.
//
// See https://msdn.microsoft.com/en-us/library/ee691975.aspx
func (b BlobStorageClient) PutPage(container, name string, startByte, endByte int64, writeType PageWriteType, chunk []byte) error {
func (b BlobStorageClient) PutPage(container, name string, startByte, endByte int64, writeType PageWriteType, chunk []byte, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"page"}})
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypePage)
headers["x-ms-page-write"] = string(writeType)
headers["x-ms-range"] = fmt.Sprintf("bytes=%v-%v", startByte, endByte)
for k, v := range extraHeaders {
headers[k] = v
}
var contentLength int64
var data io.Reader
if writeType == PageWriteTypeClear {
@ -825,13 +837,17 @@ func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders ma
// AppendBlock appends a block to an append blob.
//
// See https://msdn.microsoft.com/en-us/library/azure/mt427365.aspx
func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte) error {
func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"appendblock"}})
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeAppend)
headers["Content-Length"] = fmt.Sprintf("%v", len(chunk))
for k, v := range extraHeaders {
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, bytes.NewReader(chunk))
if err != nil {
return err
@ -908,8 +924,8 @@ func (b BlobStorageClient) waitForBlobCopy(container, name, copyID string) error
// DeleteBlob deletes the given blob from the specified container.
// If the blob does not exists at the time of the Delete Blob operation, it
// returns error. See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx
func (b BlobStorageClient) DeleteBlob(container, name string) error {
resp, err := b.deleteBlob(container, name)
func (b BlobStorageClient) DeleteBlob(container, name string, extraHeaders map[string]string) error {
resp, err := b.deleteBlob(container, name, extraHeaders)
if err != nil {
return err
}
@ -921,8 +937,8 @@ func (b BlobStorageClient) DeleteBlob(container, name string) error {
// blob is deleted with this call, returns true. Otherwise returns false.
//
// See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx
func (b BlobStorageClient) DeleteBlobIfExists(container, name string) (bool, error) {
resp, err := b.deleteBlob(container, name)
func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeaders map[string]string) (bool, error) {
resp, err := b.deleteBlob(container, name, extraHeaders)
if resp != nil && (resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound) {
return resp.statusCode == http.StatusAccepted, nil
}
@ -930,10 +946,13 @@ func (b BlobStorageClient) DeleteBlobIfExists(container, name string) (bool, err
return false, err
}
func (b BlobStorageClient) deleteBlob(container, name string) (*storageResponse, error) {
func (b BlobStorageClient) deleteBlob(container, name string, extraHeaders map[string]string) (*storageResponse, error) {
verb := "DELETE"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders()
for k, v := range extraHeaders {
headers[k] = v
}
return b.client.exec(verb, uri, headers, nil)
}
@ -962,7 +981,7 @@ func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Tim
if err != nil {
return "", err
}
signedExpiry := expiry.Format(time.RFC3339)
signedExpiry := expiry.UTC().Format(time.RFC3339)
signedResource := "b"
stringToSign, err := blobSASStringToSign(b.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions)

View file

@ -37,6 +37,10 @@ const (
// Client is the object that needs to be constructed to perform
// operations on the storage account.
type Client struct {
// HTTPClient is the http.Client used to initiate API
// requests. If it is nil, http.DefaultClient is used.
HTTPClient *http.Client
accountName string
accountKey []byte
useHTTPS bool
@ -318,7 +322,11 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
for k, v := range headers {
req.Header.Add(k, v)
}
httpClient := http.Client{}
httpClient := c.HTTPClient
if httpClient == nil {
httpClient = http.DefaultClient
}
resp, err := httpClient.Do(req)
if err != nil {
return nil, err

View file

@ -75,47 +75,14 @@ func ResponseHasStatusCode(resp *http.Response, codes ...int) bool {
return containsInt(codes, resp.StatusCode)
}
// ResponseRequiresPolling returns true if the passed http.Response requires polling follow-up
// request (as determined by the status code being in the passed set, which defaults to HTTP 202
// Accepted).
func ResponseRequiresPolling(resp *http.Response, codes ...int) bool {
if resp.StatusCode == http.StatusOK {
return false
}
if len(codes) == 0 {
codes = []int{http.StatusAccepted}
}
return ResponseHasStatusCode(resp, codes...)
// GetLocation retrieves the URL from the Location header of the passed response.
func GetLocation(resp *http.Response) string {
return resp.Header.Get(HeaderLocation)
}
// NewPollingRequest allocates and returns a new http.Request to poll for the passed response. If
// it successfully creates the request, it will also close the body of the passed response,
// otherwise the body remains open.
func NewPollingRequest(resp *http.Response, c Client) (*http.Request, error) {
location := GetPollingLocation(resp)
if location == "" {
return nil, NewErrorWithResponse("autorest", "NewPollingRequest", resp, "Location header missing from response that requires polling")
}
req, err := Prepare(&http.Request{},
AsGet(),
WithBaseURL(location))
if err != nil {
return nil, NewErrorWithError(err, "autorest", "NewPollingRequest", nil, "Failure creating poll request to %s", location)
}
Respond(resp,
c.ByInspecting(),
ByClosing())
return req, nil
}
// GetPollingDelay extracts the polling delay from the Retry-After header of the passed response. If
// GetRetryAfter extracts the retry delay from the Retry-After header of the passed response. If
// the header is absent or is malformed, it will return the supplied default delay time.Duration.
func GetPollingDelay(resp *http.Response, defaultDelay time.Duration) time.Duration {
func GetRetryAfter(resp *http.Response, defaultDelay time.Duration) time.Duration {
retry := resp.Header.Get(HeaderRetryAfter)
if retry == "" {
return defaultDelay
@ -129,38 +96,19 @@ func GetPollingDelay(resp *http.Response, defaultDelay time.Duration) time.Durat
return d
}
// GetPollingLocation retrieves the polling URL from the Location header of the passed response.
func GetPollingLocation(resp *http.Response) string {
return resp.Header.Get(HeaderLocation)
}
// PollForAttempts will retry the passed http.Request until it receives an HTTP status code outside
// the passed set or has made the specified number of attempts. The set of status codes defaults to
// HTTP 202 Accepted.
func PollForAttempts(s Sender, req *http.Request, defaultDelay time.Duration, attempts int, codes ...int) (*http.Response, error) {
return SendWithSender(
decorateForPolling(s, defaultDelay, codes...),
req,
DoRetryForAttempts(attempts, time.Duration(0)))
}
// PollForDuration will retry the passed http.Request until it receives an HTTP status code outside
// the passed set or the total time meets or exceeds the specified duration. The set of status codes
// defaults to HTTP 202 Accepted.
func PollForDuration(s Sender, req *http.Request, defaultDelay time.Duration, total time.Duration, codes ...int) (*http.Response, error) {
return SendWithSender(
decorateForPolling(s, defaultDelay, codes...),
req,
DoRetryForDuration(total, time.Duration(0)))
}
func decorateForPolling(s Sender, defaultDelay time.Duration, codes ...int) Sender {
if len(codes) == 0 {
codes = []int{http.StatusAccepted}
// NewPollingRequest allocates and returns a new http.Request to poll for the passed response.
func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Request, error) {
location := GetLocation(resp)
if location == "" {
return nil, NewErrorWithResponse("autorest", "NewPollingRequest", resp, "Location header missing from response that requires polling")
}
return DecorateSender(s,
AfterRetryDelay(defaultDelay),
DoErrorIfStatusCode(codes...),
DoCloseIfError())
req, err := Prepare(&http.Request{Cancel: cancel},
AsGet(),
WithBaseURL(location))
if err != nil {
return nil, NewErrorWithError(err, "autorest", "NewPollingRequest", nil, "Failure creating poll request to %s", location)
}
return req, nil
}

View file

@ -0,0 +1,302 @@
package azure
import (
"bytes"
"fmt"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"io/ioutil"
"net/http"
"strings"
"time"
)
const (
headerAsyncOperation = "Azure-AsyncOperation"
)
const (
methodDelete = "DELETE"
methodPatch = "PATCH"
methodPost = "POST"
methodPut = "PUT"
methodGet = "GET"
operationInProgress string = "InProgress"
operationCanceled string = "Canceled"
operationFailed string = "Failed"
operationSucceeded string = "Succeeded"
)
// 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.
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)
if err != nil {
return resp, err
}
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(resp, ps)
if err != nil {
return resp, err
}
resp, err = autorest.SendWithSender(s, r,
autorest.AfterDelay(autorest.GetRetryAfter(resp, delay)))
}
return resp, err
})
}
}
func getAsyncOperation(resp *http.Response) string {
return resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation))
}
func hasSucceeded(state string) bool {
return state == operationSucceeded
}
func hasTerminated(state string) bool {
switch state {
case operationCanceled, operationFailed, operationSucceeded:
return true
default:
return false
}
}
func hasFailed(state string) bool {
return 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 {
return ps.ProvisioningError != ServiceError{}
}
type pollingResponseFormat string
const (
usesOperationResponse pollingResponseFormat = "OperationResponse"
usesProvisioningStatus pollingResponseFormat = "ProvisioningStatus"
formatIsUnknown pollingResponseFormat = ""
)
type pollingState struct {
responseFormat pollingResponseFormat
uri string
state string
code string
message string
}
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 {
return fmt.Sprintf("Long running operation terminated with status '%s': Code=%q Message=%q", ps.state, ps.code, ps.message)
}
// 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.responseFormat == usesOperationResponse {
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.responseFormat == formatIsUnknown {
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.responseFormat = usesOperationResponse
} else {
ps.responseFormat = usesProvisioningStatus
}
// 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 == methodPatch || m == methodPut || m == methodGet {
ps.uri = req.URL.String()
}
}
if ps.uri == "" {
return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", req.Method, req.RequestURI)
}
}
// 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
}
}
// For failed operation, check for error code and message in
// -- Operation resource
// -- Response
// -- Otherwise, Unknown
if ps.hasFailed() {
if ps.responseFormat == usesOperationResponse {
or := pt.(*operationResource)
ps.code = or.OperationError.Code
ps.message = or.OperationError.Message
} else {
p := pt.(*provisioningStatus)
if p.hasProvisioningError() {
ps.code = p.ProvisioningError.Code
ps.message = p.ProvisioningError.Message
} else {
ps.code = "Unknown"
ps.message = "None"
}
}
}
return nil
}
func newPollingRequest(resp *http.Response, ps pollingState) (*http.Request, error) {
req := resp.Request
if req == nil {
return nil, autorest.NewError("azure", "newPollingRequest", "Azure Polling Error - Original HTTP request is missing")
}
reqPoll, err := autorest.Prepare(&http.Request{Cancel: req.Cancel},
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
}

View file

@ -10,16 +10,11 @@ import (
"io/ioutil"
"net/http"
"strconv"
"time"
"github.com/Azure/go-autorest/autorest"
)
const (
// HeaderAsyncOperation is the Azure header containing the location to poll for long-running
// operations.
HeaderAsyncOperation = "Azure-AsyncOperation"
// HeaderClientID is the Azure extension header to set a user-specified request ID.
HeaderClientID = "x-ms-client-request-id"
@ -38,6 +33,10 @@ type ServiceError struct {
Message string `json:"message"`
}
func (se ServiceError) Error() string {
return fmt.Sprintf("Azure Error: Code=%q Message=%q", se.Code, se.Message)
}
// RequestError describes an error response returned by Azure service.
type RequestError struct {
autorest.DetailedError
@ -131,57 +130,6 @@ func ExtractRequestID(resp *http.Response) string {
return autorest.ExtractHeaderValue(HeaderRequestID, resp)
}
// GetAsyncOperation retrieves the long-running URL to poll from the passed response.
func GetAsyncOperation(resp *http.Response) string {
return resp.Header.Get(http.CanonicalHeaderKey(HeaderAsyncOperation))
}
// ResponseIsLongRunning returns true if the passed response is for an Azure long-running operation.
func ResponseIsLongRunning(resp *http.Response) bool {
return autorest.ResponseRequiresPolling(resp, http.StatusCreated) && GetAsyncOperation(resp) != ""
}
// NewAsyncPollingRequest allocates and returns a new http.Request to poll an Azure long-running
// operation. If it successfully creates the request, it will also close the body of the passed
// response, otherwise the body remains open.
func NewAsyncPollingRequest(resp *http.Response, c autorest.Client) (*http.Request, error) {
location := GetAsyncOperation(resp)
if location == "" {
return nil, autorest.NewErrorWithResponse("azure", "NewAsyncPollingRequest", resp, "Azure-AsyncOperation header missing from response that requires polling")
}
req, err := autorest.Prepare(&http.Request{},
autorest.AsGet(),
autorest.WithBaseURL(location))
if err != nil {
return nil, autorest.NewErrorWithError(err, "azure", "NewAsyncPollingRequest", nil, "Failure creating poll request to %s", location)
}
autorest.Respond(resp,
c.ByInspecting(),
autorest.ByClosing())
return req, nil
}
// WithAsyncPolling will poll until the completion of an Azure long-running operation. The delay
// time between requests is taken from the HTTP Retry-After header, if present, or the passed
// delay otherwise. Polling may be canceled by signaling on the optional http.Request channel.
func WithAsyncPolling(defaultDelay time.Duration) autorest.SendDecorator {
return func(s autorest.Sender) autorest.Sender {
return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) {
resp, err := s.Do(r)
for err == nil && ResponseIsLongRunning(resp) {
err = autorest.DelayForBackoff(autorest.GetPollingDelay(resp, defaultDelay), 1, r.Cancel)
if err == nil {
resp, err = s.Do(r)
}
}
return resp, err
})
}
}
// WithErrorUnlessStatusCode returns a RespondDecorator that emits an
// azure.RequestError by reading the response body unless the response HTTP status code
// is among the set passed.

View file

@ -91,7 +91,7 @@ func InitiateDeviceAuth(client *autorest.Client, oauthConfig OAuthConfig, client
}),
)
resp, err := client.Send(req)
resp, err := autorest.SendWithSender(client, req)
if err != nil {
return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err)
}
@ -129,7 +129,7 @@ func CheckForUserCompletion(client *autorest.Client, code *DeviceCode) (*Token,
}),
)
resp, err := client.Send(req)
resp, err := autorest.SendWithSender(client, req)
if err != nil {
return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err)
}

View file

@ -43,6 +43,9 @@ func SaveToken(path string, mode os.FileMode, token Token) error {
if json.NewEncoder(newFile).Encode(token); err != nil {
return fmt.Errorf("failed to encode token to file (%s) while saving token: %v", tempPath, err)
}
if err := newFile.Close(); err != nil {
return fmt.Errorf("failed to close temp file %s: %v", tempPath, err)
}
// Atomic replace to avoid multi-writer file corruptions
if err := os.Rename(tempPath, path); err != nil {

View file

@ -10,28 +10,13 @@ import (
)
const (
// DefaultPollingDelay is the default delay between polling requests (only used if the
// http.Request lacks a well-formed Retry-After header).
// DefaultPollingDelay is a reasonable delay between polling requests.
DefaultPollingDelay = 60 * time.Second
// DefaultPollingDuration is the default total polling duration.
// DefaultPollingDuration is a reasonable total polling duration.
DefaultPollingDuration = 15 * time.Minute
)
// PollingMode sets how, if at all, clients composed with Client will poll.
type PollingMode string
const (
// PollUntilAttempts polling mode polls until reaching a maximum number of attempts.
PollUntilAttempts PollingMode = "poll-until-attempts"
// PollUntilDuration polling mode polls until a specified time.Duration has passed.
PollUntilDuration PollingMode = "poll-until-duration"
// DoNotPoll disables polling.
DoNotPoll PollingMode = "not-at-all"
)
const (
requestFormat = `HTTP Request Begin ===================================================
%s
@ -43,6 +28,12 @@ const (
`
)
// Response serves as the base for all responses from generated clients. It provides access to the
// last http.Response.
type Response struct {
*http.Response `json:"-"`
}
// LoggingInspector implements request and response inspectors that log the full request and
// response to a supplied log.
type LoggingInspector struct {
@ -95,17 +86,9 @@ func (li LoggingInspector) ByInspecting() RespondDecorator {
}
}
var (
// DefaultClient is the base from which generated clients should create a Client instance. Users
// can then established widely used Client defaults by replacing or modifying the DefaultClient
// before instantiating a generated client.
DefaultClient = Client{PollingMode: PollUntilDuration, PollingDuration: DefaultPollingDuration}
)
// Client is the base for autorest generated clients. It provides default, "do nothing"
// implementations of an Authorizer, RequestInspector, and ResponseInspector. It also returns the
// standard, undecorated http.Client as a default Sender. Lastly, it supports basic request polling,
// limited to a maximum number of attempts or a specified duration.
// standard, undecorated http.Client as a default Sender.
//
// Generated clients should also use Error (see NewError and NewErrorWithError) for errors and
// return responses that compose with Response.
@ -120,8 +103,10 @@ type Client struct {
RequestInspector PrepareDecorator
ResponseInspector RespondDecorator
PollingMode PollingMode
PollingAttempts int
// PollingDelay sets the polling frequency used in absence of a Retry-After HTTP header
PollingDelay time.Duration
// PollingDuration sets the maximum polling time after which an error is returned.
PollingDuration time.Duration
// UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent
@ -129,91 +114,21 @@ type Client struct {
UserAgent string
}
// NewClientWithUserAgent returns an instance of the DefaultClient with the UserAgent set to the
// passed string.
// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed
// string.
func NewClientWithUserAgent(ua string) Client {
c := DefaultClient
c := Client{PollingDelay: DefaultPollingDelay, PollingDuration: DefaultPollingDuration}
c.UserAgent = ua
return c
}
// IsPollingAllowed returns an error if the client allows polling and the passed http.Response
// requires it, otherwise it returns nil.
func (c Client) IsPollingAllowed(resp *http.Response, codes ...int) error {
if c.DoNotPoll() && ResponseRequiresPolling(resp, codes...) {
return NewErrorWithResponse("autorest/Client", "IsPollingAllowed", resp, "Response to %s requires polling but polling is disabled",
resp.Request.URL)
}
return nil
}
// PollAsNeeded is a convenience method that will poll if the passed http.Response requires it.
func (c Client) PollAsNeeded(resp *http.Response, codes ...int) (*http.Response, error) {
if !ResponseRequiresPolling(resp, codes...) {
return resp, nil
}
if c.DoNotPoll() {
return resp, NewErrorWithResponse("autorest/Client", "PollAsNeeded", resp, "Polling for %s is required, but polling is disabled",
resp.Request.URL)
}
req, err := NewPollingRequest(resp, c)
if err != nil {
return resp, NewErrorWithError(err, "autorest/Client", "PollAsNeeded", resp, "Unable to create polling request for response to %s",
resp.Request.URL)
}
Prepare(req,
c.WithInspection())
if c.PollForAttempts() {
return PollForAttempts(c, req, DefaultPollingDelay, c.PollingAttempts, codes...)
}
return PollForDuration(c, req, DefaultPollingDelay, c.PollingDuration, codes...)
}
// DoNotPoll returns true if the client should not poll, false otherwise.
func (c Client) DoNotPoll() bool {
return len(c.PollingMode) == 0 || c.PollingMode == DoNotPoll
}
// PollForAttempts returns true if the PollingMode is set to ForAttempts, false otherwise.
func (c Client) PollForAttempts() bool {
return c.PollingMode == PollUntilAttempts
}
// PollForDuration return true if the PollingMode is set to ForDuration, false otherwise.
func (c Client) PollForDuration() bool {
return c.PollingMode == PollUntilDuration
}
// Send sends the passed http.Request after applying authorization. It will poll if the client
// allows polling and the http.Response status code requires it. It will close the http.Response
// Body if the request returns an error.
func (c Client) Send(req *http.Request) (*http.Response, error) {
resp, err := SendWithSender(c, req)
if err == nil {
err = c.IsPollingAllowed(resp)
if err == nil {
resp, err = c.PollAsNeeded(resp)
}
}
if err != nil {
Respond(resp,
ByClosing())
}
return resp, err
}
// Do implements the Sender interface by invoking the active Sender. If Sender is not set, it uses
// a new instance of http.Client. In both cases it will, if UserAgent is set, apply set the
// User-Agent header.
// Do implements the Sender interface by invoking the active Sender after applying authorization.
// If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent
// is set, apply set the User-Agent header.
func (c Client) Do(r *http.Request) (*http.Response, error) {
if len(c.UserAgent) > 0 {
r, _ = Prepare(r, WithUserAgent(c.UserAgent))
if r.UserAgent() == "" {
r, _ = Prepare(r,
WithUserAgent(c.UserAgent))
}
r, err := Prepare(r,
c.WithInspection(),
@ -221,7 +136,12 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
if err != nil {
return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
}
return c.sender().Do(r)
resp, err := c.sender().Do(r)
Respond(resp,
c.ByInspecting())
return resp, err
}
// sender returns the Sender to which to send requests.
@ -263,20 +183,3 @@ func (c Client) ByInspecting() RespondDecorator {
}
return c.ResponseInspector
}
// Response serves as the base for all responses from generated clients. It provides access to the
// last http.Response.
type Response struct {
*http.Response `json:"-"`
}
// GetPollingDelay extracts the polling delay from the Retry-After header of the response. If
// the header is absent or is malformed, it will return the supplied default delay time.Duration.
func (r Response) GetPollingDelay(defaultDelay time.Duration) time.Duration {
return GetPollingDelay(r.Response, defaultDelay)
}
// GetPollingLocation retrieves the polling URL from the Location header of the response.
func (r Response) GetPollingLocation() string {
return GetPollingLocation(r.Response)
}

View file

@ -7,17 +7,14 @@ package date
import (
"fmt"
"github.com/Azure/go-autorest/autorest"
"io"
"io/ioutil"
"net/http"
"time"
)
const (
rfc3339FullDate = "2006-01-02"
dateFormat = "%4d-%02d-%02d"
jsonFormat = `"%4d-%02d-%02d"`
fullDate = "2006-01-02"
fullDateJSON = `"2006-01-02"`
dateFormat = "%04d-%02d-%02d"
jsonFormat = `"%04d-%02d-%02d"`
)
// Date defines a type similar to time.Time but assumes a layout of RFC3339 full-date (i.e.,
@ -28,31 +25,12 @@ type Date struct {
// ParseDate create a new Date from the passed string.
func ParseDate(date string) (d Date, err error) {
d = Date{}
d.Time, err = time.Parse(rfc3339FullDate, date)
return d, err
return parseDate(date, fullDate)
}
func readDate(r io.Reader) (Date, error) {
b, err := ioutil.ReadAll(r)
if err == nil {
return ParseDate(string(b))
}
return Date{}, err
}
// ByUnmarshallingDate returns a RespondDecorator that decodes the http.Response Body into a Date
// pointed to by d.
func ByUnmarshallingDate(d *Date) autorest.RespondDecorator {
return func(r autorest.Responder) autorest.Responder {
return autorest.ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*d, err = readDate(resp.Body)
}
return err
})
}
func parseDate(date string, format string) (Date, error) {
d, err := time.Parse(format, date)
return Date{Time: d}, err
}
// MarshalBinary preserves the Date as a byte array conforming to RFC3339 full-date (i.e.,
@ -76,14 +54,8 @@ func (d Date) MarshalJSON() (json []byte, err error) {
// UnmarshalJSON reconstitutes the Date from a JSON string conforming to RFC3339 full-date (i.e.,
// 2006-01-02).
func (d *Date) UnmarshalJSON(data []byte) (err error) {
if data[0] == '"' {
data = data[1 : len(data)-1]
}
d.Time, err = time.Parse(rfc3339FullDate, string(data))
if err != nil {
return err
}
return nil
d.Time, err = time.Parse(fullDateJSON, string(data))
return err
}
// MarshalText preserves the Date as a byte array conforming to RFC3339 full-date (i.e.,
@ -95,11 +67,8 @@ func (d Date) MarshalText() (text []byte, err error) {
// UnmarshalText reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e.,
// 2006-01-02).
func (d *Date) UnmarshalText(data []byte) (err error) {
d.Time, err = time.Parse(rfc3339FullDate, string(data))
if err != nil {
return err
}
return nil
d.Time, err = time.Parse(fullDate, string(data))
return err
}
// String returns the Date formatted as an RFC3339 full-date string (i.e., 2006-01-02).

View file

@ -1,89 +1,63 @@
package date
import (
"github.com/Azure/go-autorest/autorest"
"io"
"io/ioutil"
"net/http"
"time"
)
const (
rfc3339JSON = `"` + time.RFC3339Nano + `"`
rfc3339 = time.RFC3339Nano
)
// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e.,
// 2006-01-02T15:04:05Z).
type Time struct {
time.Time
}
// ParseTime creates a new Time from the passed string.
func ParseTime(date string) (d Time, err error) {
d = Time{}
d.Time, err = time.Parse(time.RFC3339, date)
return d, err
}
func readTime(r io.Reader) (Time, error) {
b, err := ioutil.ReadAll(r)
if err == nil {
return ParseTime(string(b))
}
return Time{}, err
}
// ByUnmarshallingTime returns a RespondDecorator that decodes the http.Response Body into a Time
// pointed to by t.
func ByUnmarshallingTime(t *Time) autorest.RespondDecorator {
return func(r autorest.Responder) autorest.Responder {
return autorest.ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*t, err = readTime(resp.Body)
}
return err
})
}
}
// MarshalBinary preserves the Time as a byte array conforming to RFC3339 date-time (i.e.,
// 2006-01-02T15:04:05Z).
func (d Time) MarshalBinary() ([]byte, error) {
return d.Time.MarshalText()
func (t Time) MarshalBinary() ([]byte, error) {
return t.Time.MarshalText()
}
// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z).
func (d *Time) UnmarshalBinary(data []byte) error {
return d.Time.UnmarshalText(data)
func (t *Time) UnmarshalBinary(data []byte) error {
return t.UnmarshalText(data)
}
// MarshalJSON preserves the Time as a JSON string conforming to RFC3339 date-time (i.e.,
// 2006-01-02T15:04:05Z).
func (d Time) MarshalJSON() (json []byte, err error) {
return d.Time.MarshalJSON()
func (t Time) MarshalJSON() (json []byte, err error) {
return t.Time.MarshalJSON()
}
// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z).
func (d *Time) UnmarshalJSON(data []byte) (err error) {
return d.Time.UnmarshalJSON(data)
func (t *Time) UnmarshalJSON(data []byte) (err error) {
t.Time, err = ParseTime(rfc3339JSON, string(data))
return err
}
// MarshalText preserves the Time as a byte array conforming to RFC3339 date-time (i.e.,
// 2006-01-02T15:04:05Z).
func (d Time) MarshalText() (text []byte, err error) {
return d.Time.MarshalText()
func (t Time) MarshalText() (text []byte, err error) {
return t.Time.MarshalText()
}
// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z).
func (d *Time) UnmarshalText(data []byte) (err error) {
return d.Time.UnmarshalText(data)
func (t *Time) UnmarshalText(data []byte) (err error) {
t.Time, err = ParseTime(rfc3339, string(data))
return err
}
// String returns the Time formatted as an RFC3339 date-time string (i.e.,
// 2006-01-02T15:04:05Z).
func (d Time) String() string {
func (t Time) String() string {
// Note: time.Time.String does not return an RFC3339 compliant string, time.Time.MarshalText does.
b, err := d.Time.MarshalText()
b, err := t.MarshalText()
if err != nil {
return ""
}
@ -91,6 +65,6 @@ func (d Time) String() string {
}
// ToTime returns a Time as a time.Time
func (d Time) ToTime() time.Time {
return d.Time
func (t Time) ToTime() time.Time {
return t.Time
}

View file

@ -0,0 +1,86 @@
package date
import (
"errors"
"time"
)
const (
rfc1123JSON = `"` + time.RFC1123 + `"`
rfc1123 = time.RFC1123
)
// TimeRFC1123 defines a type similar to time.Time but assumes a layout of RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
type TimeRFC1123 struct {
time.Time
}
// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalJSON(data []byte) (err error) {
t.Time, err = ParseTime(rfc1123JSON, string(data))
if err != nil {
return err
}
return nil
}
// MarshalJSON preserves the Time as a JSON string conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalJSON() ([]byte, error) {
if y := t.Year(); y < 0 || y >= 10000 {
return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]")
}
b := []byte(t.Format(rfc1123JSON))
return b, nil
}
// MarshalText preserves the Time as a byte array conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalText() ([]byte, error) {
if y := t.Year(); y < 0 || y >= 10000 {
return nil, errors.New("Time.MarshalText: year outside of range [0,9999]")
}
b := []byte(t.Format(rfc1123))
return b, nil
}
// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalText(data []byte) (err error) {
t.Time, err = ParseTime(rfc1123, string(data))
if err != nil {
return err
}
return nil
}
// MarshalBinary preserves the Time as a byte array conforming to RFC1123 date-time (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) MarshalBinary() ([]byte, error) {
return t.MarshalText()
}
// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC1123 date-time
// (i.e., Mon, 02 Jan 2006 15:04:05 MST).
func (t *TimeRFC1123) UnmarshalBinary(data []byte) error {
return t.UnmarshalText(data)
}
// ToTime returns a Time as a time.Time
func (t TimeRFC1123) ToTime() time.Time {
return t.Time
}
// String returns the Time formatted as an RFC1123 date-time string (i.e.,
// Mon, 02 Jan 2006 15:04:05 MST).
func (t TimeRFC1123) String() string {
// Note: time.Time.String does not return an RFC1123 compliant string, time.Time.MarshalText does.
b, err := t.MarshalText()
if err != nil {
return ""
}
return string(b)
}

View file

@ -0,0 +1,11 @@
package date
import (
"strings"
"time"
)
// ParseTime to parse Time string to specified format.
func ParseTime(format string, t string) (d time.Time, err error) {
return time.Parse(format, strings.ToUpper(t))
}

View file

@ -57,6 +57,7 @@ func NewErrorWithError(original error, packageType string, method string, resp *
if resp != nil {
statusCode = resp.StatusCode
}
return DetailedError{
Original: original,
PackageType: packageType,
@ -70,7 +71,7 @@ func NewErrorWithError(original error, packageType string, method string, resp *
// StatusCode, Message, and original error (if any)).
func (e DetailedError) Error() string {
if e.Original == nil {
return fmt.Sprintf("%s:%s %v %s", e.PackageType, e.Method, e.StatusCode, e.Message)
return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode)
}
return fmt.Sprintf("%s:%s %v %s -- Original Error: %v", e.PackageType, e.Method, e.StatusCode, e.Message, e.Original)
return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original)
}

View file

@ -195,6 +195,51 @@ func WithFormData(v url.Values) PrepareDecorator {
}
}
// WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request
// and sets the Content-Length header.
func WithBool(v bool) PrepareDecorator {
return WithString(fmt.Sprintf("%v", v))
}
// WithFloat32 returns a PrepareDecorator that encodes the passed float32 into the body of the
// request and sets the Content-Length header.
func WithFloat32(v float32) PrepareDecorator {
return WithString(fmt.Sprintf("%v", v))
}
// WithFloat64 returns a PrepareDecorator that encodes the passed float64 into the body of the
// request and sets the Content-Length header.
func WithFloat64(v float64) PrepareDecorator {
return WithString(fmt.Sprintf("%v", v))
}
// WithInt32 returns a PrepareDecorator that encodes the passed int32 into the body of the request
// and sets the Content-Length header.
func WithInt32(v int32) PrepareDecorator {
return WithString(fmt.Sprintf("%v", v))
}
// WithInt64 returns a PrepareDecorator that encodes the passed int64 into the body of the request
// and sets the Content-Length header.
func WithInt64(v int64) PrepareDecorator {
return WithString(fmt.Sprintf("%v", v))
}
// WithString returns a PrepareDecorator that encodes the passed string into the body of the request
// and sets the Content-Length header.
func WithString(v string) PrepareDecorator {
return func(p Preparer) Preparer {
return PreparerFunc(func(r *http.Request) (*http.Request, error) {
r, err := p.Prepare(r)
if err == nil {
r.ContentLength = int64(len(v))
r.Body = ioutil.NopCloser(strings.NewReader(v))
}
return r, err
})
}
}
// WithJSON returns a PrepareDecorator that encodes the data passed as JSON into the body of the
// request and sets the Content-Length header.
func WithJSON(v interface{}) PrepareDecorator {

View file

@ -1,8 +1,13 @@
package autorest
import (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"strings"
)
// Responder is the interface that wraps the Respond method.
@ -68,6 +73,20 @@ func ByIgnoring() RespondDecorator {
}
}
// ByCopying copies the contents of the http.Response Body into the passed bytes.Buffer as
// the Body is read.
func ByCopying(b *bytes.Buffer) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil && resp != nil && resp.Body != nil {
resp.Body = TeeReadCloser(resp.Body, b)
}
return err
})
}
}
// ByClosing returns a RespondDecorator that first invokes the passed Responder after which it
// closes the response body. Since the passed Responder is invoked prior to closing the response
// body, the decorator may occur anywhere within the set.
@ -97,116 +116,48 @@ func ByClosingIfError() RespondDecorator {
}
}
// ByUnmarshallingBool returns a RespondDecorator that decodes the http.Response Body into a bool
// pointed to by b.
func ByUnmarshallingBool(b *bool) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*b, err = readBool(resp.Body)
}
return err
})
}
}
// ByUnmarshallingFloat32 returns a RespondDecorator that decodes the http.Response Body into a
// float32 pointed to by f.
func ByUnmarshallingFloat32(f *float32) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*f, err = readFloat32(resp.Body)
}
return err
})
}
}
// ByUnmarshallingFloat64 returns a RespondDecorator that decodes the http.Response Body into a
// float64 pointed to by f.
func ByUnmarshallingFloat64(f *float64) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*f, err = readFloat64(resp.Body)
}
return err
})
}
}
// ByUnmarshallingInt32 returns a RespondDecorator that decodes the http.Response Body into an
// int32 pointed to by i.
func ByUnmarshallingInt32(i *int32) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*i, err = readInt32(resp.Body)
}
return err
})
}
}
// ByUnmarshallingInt64 returns a RespondDecorator that decodes the http.Response Body into an
// int64 pointed to by i.
func ByUnmarshallingInt64(i *int64) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*i, err = readInt64(resp.Body)
}
return err
})
}
}
// ByUnmarshallingString returns a RespondDecorator that decodes the http.Response Body into a
// string pointed to by s.
func ByUnmarshallingString(s *string) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
*s, err = readString(resp.Body)
}
return err
})
}
}
// ByUnmarshallingJSON returns a RespondDecorator that decodes a JSON document returned in the
// response Body into the value pointed to by v.
func ByUnmarshallingJSON(v interface{}) RespondDecorator {
return byUnmarshallingAs(EncodedAsJSON, v)
}
// ByUnmarshallingXML returns a RespondDecorator that decodes a XML document returned in the
// response Body into the value pointed to by v.
func ByUnmarshallingXML(v interface{}) RespondDecorator {
return byUnmarshallingAs(EncodedAsXML, v)
}
func byUnmarshallingAs(encodedAs EncodedAs, v interface{}) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
b, errDecode := CopyAndDecode(encodedAs, resp.Body, v)
if errDecode != nil {
err = fmt.Errorf("Error (%v) occurred decoding %s (\"%s\")", errDecode, encodedAs, b.String())
b, errInner := ioutil.ReadAll(resp.Body)
if errInner != nil {
err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner)
} else if len(strings.Trim(string(b), " ")) > 0 {
errInner = json.Unmarshal(b, v)
if errInner != nil {
err = fmt.Errorf("Error occurred unmarshalling JSON - Error = '%v' JSON = '%s'", errInner, string(b))
}
}
}
return err
})
}
}
// ByUnmarshallingXML returns a RespondDecorator that decodes a XML document returned in the
// response Body into the value pointed to by v.
func ByUnmarshallingXML(v interface{}) RespondDecorator {
return func(r Responder) Responder {
return ResponderFunc(func(resp *http.Response) error {
err := r.Respond(resp)
if err == nil {
b, errInner := ioutil.ReadAll(resp.Body)
if errInner != nil {
err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner)
} else {
errInner = xml.Unmarshal(b, v)
if errInner != nil {
err = fmt.Errorf("Error occurred unmarshalling Xml - Error = '%v' Xml = '%s'", errInner, string(b))
}
}
}
return err
})
}
}
// WithErrorUnlessStatusCode returns a RespondDecorator that emits an error unless the response

View file

@ -79,23 +79,6 @@ func AfterDelay(d time.Duration) SendDecorator {
}
}
// AfterRetryDelay returns a SendDecorator that delays for the number of seconds specified in the
// Retry-After header of the prior response when polling is required. The delay may be canceled
// by closing the optional channel on the http.Request.
func AfterRetryDelay(defaultDelay time.Duration, codes ...int) SendDecorator {
return func(s Sender) Sender {
return SenderFunc(func(r *http.Request) (*http.Response, error) {
resp, err := s.Do(r)
if ResponseRequiresPolling(resp, codes...) {
if DelayForBackoff(GetPollingDelay(resp, defaultDelay), 1, r.Cancel) != nil {
err = fmt.Errorf("autorest: AfterRetryDelay canceled before full delay")
}
}
return resp, err
})
}
}
// AsIs returns a SendDecorator that invokes the passed Sender without modifying the http.Request.
func AsIs() SendDecorator {
return func(s Sender) Sender {
@ -105,19 +88,6 @@ func AsIs() SendDecorator {
}
}
// WithLogging returns a SendDecorator that implements simple before and after logging of the
// request.
func WithLogging(logger *log.Logger) SendDecorator {
return func(s Sender) Sender {
return SenderFunc(func(r *http.Request) (*http.Response, error) {
logger.Printf("Sending %s %s\n", r.Method, r.URL)
resp, err := s.Do(r)
logger.Printf("%s %s received %s\n", r.Method, r.URL, resp.Status)
return resp, err
})
}
}
// DoCloseIfError returns a SendDecorator that first invokes the passed Sender after which
// it closes the response if the passed Sender returns an error and the response body exists.
func DoCloseIfError() SendDecorator {
@ -168,7 +138,34 @@ func DoErrorUnlessStatusCode(codes ...int) SendDecorator {
}
}
// DoRetryForAttempts returns a SendDecorator that retries the request for up to the specified
// DoPollForStatusCodes returns a SendDecorator that polls if the http.Response contains one of the
// passed status codes. It expects the http.Response to contain a Location header providing the
// URL at which to poll (using GET) and will poll until the time passed is equal to or greater than
// the supplied duration. 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.
func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...int) SendDecorator {
return func(s Sender) Sender {
return SenderFunc(func(r *http.Request) (resp *http.Response, err error) {
resp, err = s.Do(r)
if err == nil && ResponseHasStatusCode(resp, codes...) {
r, err = NewPollingRequest(resp, r.Cancel)
for err == nil && ResponseHasStatusCode(resp, codes...) {
Respond(resp,
ByClosing())
resp, err = SendWithSender(s, r,
AfterDelay(GetRetryAfter(resp, delay)))
}
}
return resp, err
})
}
}
// DoRetryForAttempts returns a SendDecorator that retries a failed request for up to the specified
// number of attempts, exponentially backing off between requests using the supplied backoff
// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on
// the http.Request.
@ -207,6 +204,23 @@ func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator {
}
}
// WithLogging returns a SendDecorator that implements simple before and after logging of the
// request.
func WithLogging(logger *log.Logger) SendDecorator {
return func(s Sender) Sender {
return SenderFunc(func(r *http.Request) (*http.Response, error) {
logger.Printf("Sending %s %s", r.Method, r.URL)
resp, err := s.Do(r)
if err != nil {
logger.Printf("%s %s received error '%v'", r.Method, r.URL, err)
} else {
logger.Printf("%s %s received %s", r.Method, r.URL, resp.Status)
}
return resp, err
})
}
}
// DelayForBackoff invokes time.After for the supplied backoff duration raised to the power of
// passed attempt (i.e., an exponential backoff delay). Backoff may be zero. The delay may be
// canceled by closing the passed channel.

View file

@ -6,9 +6,7 @@ import (
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"net/url"
"strconv"
)
// EncodedAs is a series of constants specifying various data encodings
@ -48,53 +46,24 @@ func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffe
return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v)
}
func readBool(r io.Reader) (bool, error) {
s, err := readString(r)
if err == nil {
return strconv.ParseBool(s)
}
return false, err
// TeeReadCloser returns a ReadCloser that writes to w what it reads from rc.
// It utilizes io.TeeReader to copy the data read and has the same behavior when reading.
// Further, when it is closed, it ensures that rc is closed as well.
func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser {
return &teeReadCloser{rc, io.TeeReader(rc, w)}
}
func readFloat32(r io.Reader) (float32, error) {
s, err := readString(r)
if err == nil {
v, err := strconv.ParseFloat(s, 32)
return float32(v), err
}
return float32(0), err
type teeReadCloser struct {
rc io.ReadCloser
r io.Reader
}
func readFloat64(r io.Reader) (float64, error) {
s, err := readString(r)
if err == nil {
v, err := strconv.ParseFloat(s, 64)
return v, err
}
return float64(0), err
func (t *teeReadCloser) Read(p []byte) (int, error) {
return t.r.Read(p)
}
func readInt32(r io.Reader) (int32, error) {
s, err := readString(r)
if err == nil {
v, err := strconv.ParseInt(s, 10, 32)
return int32(v), err
}
return int32(0), err
}
func readInt64(r io.Reader) (int64, error) {
s, err := readString(r)
if err == nil {
v, err := strconv.ParseInt(s, 10, 64)
return v, err
}
return int64(0), err
}
func readString(r io.Reader) (string, error) {
b, err := ioutil.ReadAll(r)
return string(b), err
func (t *teeReadCloser) Close() error {
return t.rc.Close()
}
func containsInt(ints []int, n int) bool {

View file

@ -5,7 +5,7 @@ import (
)
const (
major = "5"
major = "7"
minor = "0"
patch = "0"
tag = ""

14
vendor/github.com/Azure/go-ntlmssp/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,14 @@
sudo: false
language: go
before_script:
- go get -u github.com/golang/lint/golint
go: 1.6
script:
- test -z "$(gofmt -s -l . | tee /dev/stderr)"
- test -z "$(golint ./... | tee /dev/stderr)"
- go vet ./...
- go build -v ./...
- go test -v ./...

21
vendor/github.com/Azure/go-ntlmssp/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

11
vendor/github.com/Azure/go-ntlmssp/README.md generated vendored Normal file
View file

@ -0,0 +1,11 @@
# go-ntlmssp
Golang package that provides NTLM/Negotiate authentication over HTTP
[![GoDoc](https://godoc.org/github.com/Azure/go-ntlmssp?status.svg)](https://godoc.org/github.com/Azure/go-ntlmssp) [![Build Status](https://travis-ci.org/Azure/go-ntlmssp.svg?branch=dev)](https://travis-ci.org/Azure/go-ntlmssp)
Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx
Implementation hints from http://davenport.sourceforge.net/ntlm.html
This package only implements authentication, no key exchange or encryption. It
only supports Unicode (UTF16LE) encoding of protocol strings, no OEM encoding.
This package implements NTLMv2.

View file

@ -0,0 +1,128 @@
package ntlmssp
import (
"bytes"
"crypto/rand"
"encoding/binary"
"errors"
"time"
)
type authenicateMessage struct {
LmChallengeResponse []byte
NtChallengeResponse []byte
TargetName string
UserName string
// only set if negotiateFlag_NTLMSSP_NEGOTIATE_KEY_EXCH
EncryptedRandomSessionKey []byte
NegotiateFlags negotiateFlags
MIC []byte
}
type authenticateMessageFields struct {
messageHeader
LmChallengeResponse varField
NtChallengeResponse varField
TargetName varField
UserName varField
Workstation varField
_ [8]byte
NegotiateFlags negotiateFlags
}
func (m authenicateMessage) MarshalBinary() ([]byte, error) {
if !m.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEUNICODE) {
return nil, errors.New("Only unicode is supported")
}
target, user := toUnicode(m.TargetName), toUnicode(m.UserName)
workstation := toUnicode("go-ntlmssp")
ptr := binary.Size(&authenticateMessageFields{})
f := authenticateMessageFields{
messageHeader: newMessageHeader(3),
NegotiateFlags: m.NegotiateFlags,
LmChallengeResponse: newVarField(&ptr, len(m.LmChallengeResponse)),
NtChallengeResponse: newVarField(&ptr, len(m.NtChallengeResponse)),
TargetName: newVarField(&ptr, len(target)),
UserName: newVarField(&ptr, len(user)),
Workstation: newVarField(&ptr, len(workstation)),
}
f.NegotiateFlags.Unset(negotiateFlagNTLMSSPNEGOTIATEVERSION)
b := bytes.Buffer{}
if err := binary.Write(&b, binary.LittleEndian, &f); err != nil {
return nil, err
}
if err := binary.Write(&b, binary.LittleEndian, &m.LmChallengeResponse); err != nil {
return nil, err
}
if err := binary.Write(&b, binary.LittleEndian, &m.NtChallengeResponse); err != nil {
return nil, err
}
if err := binary.Write(&b, binary.LittleEndian, &target); err != nil {
return nil, err
}
if err := binary.Write(&b, binary.LittleEndian, &user); err != nil {
return nil, err
}
if err := binary.Write(&b, binary.LittleEndian, &workstation); err != nil {
return nil, err
}
return b.Bytes(), nil
}
//ProcessChallenge crafts an AUTHENTICATE message in response to the CHALLENGE message
//that was received from the server
func ProcessChallenge(challengeMessageData []byte, user, password string) ([]byte, error) {
if user == "" && password == "" {
return nil, errors.New("Anonymous authentication not supported")
}
var cm challengeMessage
if err := cm.UnmarshalBinary(challengeMessageData); err != nil {
return nil, err
}
if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATELMKEY) {
return nil, errors.New("Only NTLM v2 is supported, but server requested v1 (NTLMSSP_NEGOTIATE_LM_KEY)")
}
if cm.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEKEYEXCH) {
return nil, errors.New("Key exchange requested but not supported (NTLMSSP_NEGOTIATE_KEY_EXCH)")
}
am := authenicateMessage{
UserName: user,
TargetName: cm.TargetName,
NegotiateFlags: cm.NegotiateFlags,
}
timestamp := cm.TargetInfo[avIDMsvAvTimestamp]
if timestamp == nil { // no time sent, take current time
ft := uint64(time.Now().UnixNano()) / 100
ft += 116444736000000000 // add time between unix & windows offset
timestamp = make([]byte, 8)
binary.LittleEndian.PutUint64(timestamp, ft)
}
clientChallenge := make([]byte, 8)
rand.Reader.Read(clientChallenge)
ntlmV2Hash := getNtlmV2Hash(password, user, cm.TargetName)
am.NtChallengeResponse = computeNtlmV2Response(ntlmV2Hash,
cm.ServerChallenge[:], clientChallenge, timestamp, cm.TargetInfoRaw)
if cm.TargetInfoRaw == nil {
am.LmChallengeResponse = computeLmV2Response(ntlmV2Hash,
cm.ServerChallenge[:], clientChallenge)
}
return am.MarshalBinary()
}

33
vendor/github.com/Azure/go-ntlmssp/authheader.go generated vendored Normal file
View file

@ -0,0 +1,33 @@
package ntlmssp
import (
"encoding/base64"
"strings"
)
type authheader string
func (h authheader) IsBasic() bool {
return strings.HasPrefix(string(h), "Basic ")
}
func (h authheader) IsNegotiate() bool {
return strings.HasPrefix(string(h), "Negotiate")
}
func (h authheader) GetData() ([]byte, error) {
p := strings.Split(string(h), " ")
if len(p) < 2 {
return nil, nil
}
return base64.StdEncoding.DecodeString(string(p[1]))
}
func (h authheader) GetBasicCreds() (username, password string, err error) {
d, err := h.GetData()
if err != nil {
return "", "", err
}
parts := strings.SplitN(string(d), ":", 2)
return parts[0], parts[1], nil
}

17
vendor/github.com/Azure/go-ntlmssp/avids.go generated vendored Normal file
View file

@ -0,0 +1,17 @@
package ntlmssp
type avID uint16
const (
avIDMsvAvEOL avID = iota
avIDMsvAvNbComputerName
avIDMsvAvNbDomainName
avIDMsvAvDNSComputerName
avIDMsvAvDNSDomainName
avIDMsvAvDNSTreeName
avIDMsvAvFlags
avIDMsvAvTimestamp
avIDMsvAvSingleHost
avIDMsvAvTargetName
avIDMsvChannelBindings
)

View file

@ -0,0 +1,82 @@
package ntlmssp
import (
"bytes"
"encoding/binary"
"fmt"
)
type challengeMessageFields struct {
messageHeader
TargetName varField
NegotiateFlags negotiateFlags
ServerChallenge [8]byte
_ [8]byte
TargetInfo varField
}
func (m challengeMessageFields) IsValid() bool {
return m.messageHeader.IsValid() && m.MessageType == 2
}
type challengeMessage struct {
challengeMessageFields
TargetName string
TargetInfo map[avID][]byte
TargetInfoRaw []byte
}
func (m *challengeMessage) UnmarshalBinary(data []byte) error {
r := bytes.NewReader(data)
err := binary.Read(r, binary.LittleEndian, &m.challengeMessageFields)
if err != nil {
return err
}
if !m.challengeMessageFields.IsValid() {
return fmt.Errorf("Message is not a valid challenge message: %+v", m.challengeMessageFields.messageHeader)
}
if m.challengeMessageFields.TargetName.Len > 0 {
m.TargetName, err = m.challengeMessageFields.TargetName.ReadStringFrom(data, m.NegotiateFlags.Has(negotiateFlagNTLMSSPNEGOTIATEUNICODE))
if err != nil {
return err
}
}
if m.challengeMessageFields.TargetInfo.Len > 0 {
d, err := m.challengeMessageFields.TargetInfo.ReadFrom(data)
m.TargetInfoRaw = d
if err != nil {
return err
}
m.TargetInfo = make(map[avID][]byte)
r := bytes.NewReader(d)
for {
var id avID
var l uint16
err = binary.Read(r, binary.LittleEndian, &id)
if err != nil {
return err
}
if id == avIDMsvAvEOL {
break
}
err = binary.Read(r, binary.LittleEndian, &l)
if err != nil {
return err
}
value := make([]byte, l)
n, err := r.Read(value)
if err != nil {
return err
}
if n != int(l) {
return fmt.Errorf("Expected to read %d bytes, got only %d", l, n)
}
m.TargetInfo[id] = value
}
}
return nil
}

21
vendor/github.com/Azure/go-ntlmssp/messageheader.go generated vendored Normal file
View file

@ -0,0 +1,21 @@
package ntlmssp
import (
"bytes"
)
var signature = [8]byte{'N', 'T', 'L', 'M', 'S', 'S', 'P', 0}
type messageHeader struct {
Signature [8]byte
MessageType uint32
}
func (h messageHeader) IsValid() bool {
return bytes.Equal(h.Signature[:], signature[:]) &&
h.MessageType > 0 && h.MessageType < 4
}
func newMessageHeader(messageType uint32) messageHeader {
return messageHeader{signature, messageType}
}

44
vendor/github.com/Azure/go-ntlmssp/negotiate_flags.go generated vendored Normal file
View file

@ -0,0 +1,44 @@
package ntlmssp
type negotiateFlags uint32
const (
/*A*/ negotiateFlagNTLMSSPNEGOTIATEUNICODE negotiateFlags = 1 << 0
/*B*/ negotiateFlagNTLMNEGOTIATEOEM = 1 << 1
/*C*/ negotiateFlagNTLMSSPREQUESTTARGET = 1 << 2
/*D*/ negotiateFlagNTLMSSPNEGOTIATESIGN = 1 << 4
/*E*/ negotiateFlagNTLMSSPNEGOTIATESEAL = 1 << 5
/*F*/ negotiateFlagNTLMSSPNEGOTIATEDATAGRAM = 1 << 6
/*G*/ negotiateFlagNTLMSSPNEGOTIATELMKEY = 1 << 7
/*H*/ negotiateFlagNTLMSSPNEGOTIATENTLM = 1 << 9
/*J*/ negotiateFlagANONYMOUS = 1 << 11
/*K*/ negotiateFlagNTLMSSPNEGOTIATEOEMDOMAINSUPPLIED = 1 << 12
/*L*/ negotiateFlagNTLMSSPNEGOTIATEOEMWORKSTATIONSUPPLIED = 1 << 13
/*M*/ negotiateFlagNTLMSSPNEGOTIATEALWAYSSIGN = 1 << 15
/*N*/ negotiateFlagNTLMSSPTARGETTYPEDOMAIN = 1 << 16
/*O*/ negotiateFlagNTLMSSPTARGETTYPESERVER = 1 << 17
/*P*/ negotiateFlagNTLMSSPNEGOTIATEEXTENDEDSESSIONSECURITY = 1 << 19
/*Q*/ negotiateFlagNTLMSSPNEGOTIATEIDENTIFY = 1 << 20
/*R*/ negotiateFlagNTLMSSPREQUESTNONNTSESSIONKEY = 1 << 22
/*S*/ negotiateFlagNTLMSSPNEGOTIATETARGETINFO = 1 << 23
/*T*/ negotiateFlagNTLMSSPNEGOTIATEVERSION = 1 << 25
/*U*/ negotiateFlagNTLMSSPNEGOTIATE128 = 1 << 29
/*V*/ negotiateFlagNTLMSSPNEGOTIATEKEYEXCH = 1 << 30
/*W*/ negotiateFlagNTLMSSPNEGOTIATE56 = 1 << 31
)
func (field negotiateFlags) Has(flags negotiateFlags) bool {
return field&flags == flags
}
func (field *negotiateFlags) Unset(flags negotiateFlags) {
*field = *field ^ (*field & flags)
}

View file

@ -0,0 +1,31 @@
package ntlmssp
import (
"bytes"
"encoding/binary"
)
type negotiateMessageFields struct {
messageHeader
NegotiateFlags negotiateFlags
}
//NewNegotiateMessage creates a new NEGOTIATE message with the
//flags that this package supports.
func NewNegotiateMessage() []byte {
m := negotiateMessageFields{
messageHeader: newMessageHeader(1),
}
m.NegotiateFlags = negotiateFlagNTLMSSPREQUESTTARGET |
negotiateFlagNTLMSSPNEGOTIATENTLM |
negotiateFlagNTLMSSPNEGOTIATEALWAYSSIGN |
negotiateFlagNTLMSSPNEGOTIATEUNICODE
b := bytes.Buffer{}
err := binary.Write(&b, binary.LittleEndian, &m)
if err != nil {
panic(err)
}
return b.Bytes()
}

110
vendor/github.com/Azure/go-ntlmssp/negotiator.go generated vendored Normal file
View file

@ -0,0 +1,110 @@
package ntlmssp
import (
"bytes"
"encoding/base64"
"io/ioutil"
"net/http"
)
//Negotiator is a http.Roundtripper decorator that automatically
//converts basic authentication to NTLM/Negotiate authentication when appropriate.
type Negotiator struct{ http.RoundTripper }
//RoundTrip sends the request to the server, handling any authentication
//re-sends as needed.
func (l Negotiator) RoundTrip(req *http.Request) (res *http.Response, err error) {
// Use default round tripper if not provided
rt := l.RoundTripper
if rt == nil {
rt = http.DefaultTransport
}
// If it is not basic auth, just round trip the request as usual
reqauth := authheader(req.Header.Get("Authorization"))
if !reqauth.IsBasic() {
return rt.RoundTrip(req)
}
// Save request body
body := bytes.Buffer{}
if req.Body != nil {
_, err = body.ReadFrom(req.Body)
if err != nil {
return nil, err
}
req.Body.Close()
req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
}
// first try anonymous, in case the server still finds us
// authenticated from previous traffic
req.Header.Del("Authorization")
res, err = rt.RoundTrip(req)
if err != nil {
return nil, err
}
if res.StatusCode != http.StatusUnauthorized {
return res, err
}
resauth := authheader(res.Header.Get("Www-Authenticate"))
if !resauth.IsNegotiate() {
// Unauthorized, Negotiate not requested, let's try with basic auth
req.Header.Set("Authorization", string(reqauth))
res.Body.Close()
req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
res, err = rt.RoundTrip(req)
if err != nil {
return nil, err
}
if res.StatusCode != http.StatusUnauthorized {
return res, err
}
resauth = authheader(res.Header.Get("Www-Authenticate"))
}
if resauth.IsNegotiate() {
// 401 with request:Basic and response:Negotiate
res.Body.Close()
// recycle credentials
u, p, err := reqauth.GetBasicCreds()
if err != nil {
return nil, err
}
// send negotiate
negotiateMessage := NewNegotiateMessage()
req.Header.Set("Authorization", "Negotiate "+base64.StdEncoding.EncodeToString(negotiateMessage))
req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
res, err = rt.RoundTrip(req)
if err != nil {
return nil, err
}
// receive challenge?
resauth = authheader(res.Header.Get("Www-Authenticate"))
challengeMessage, err := resauth.GetData()
if err != nil {
return nil, err
}
if !resauth.IsNegotiate() || len(challengeMessage) == 0 {
// Negotiation failed, let client deal with response
return res, nil
}
res.Body.Close()
// send authenticate
authenticateMessage, err := ProcessChallenge(challengeMessage, u, p)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Negotiate "+base64.StdEncoding.EncodeToString(authenticateMessage))
req.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
res, err = rt.RoundTrip(req)
}
return res, err
}

51
vendor/github.com/Azure/go-ntlmssp/nlmp.go generated vendored Normal file
View file

@ -0,0 +1,51 @@
// Package ntlmssp provides NTLM/Negotiate authentication over HTTP
//
// Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx,
// implementation hints from http://davenport.sourceforge.net/ntlm.html .
// This package only implements authentication, no key exchange or encryption. It
// only supports Unicode (UTF16LE) encoding of protocol strings, no OEM encoding.
// This package implements NTLMv2.
package ntlmssp
import (
"crypto/hmac"
"crypto/md5"
"golang.org/x/crypto/md4"
"strings"
)
func getNtlmV2Hash(password, username, target string) []byte {
return hmacMd5(getNtlmHash(password), toUnicode(strings.ToUpper(username)+target))
}
func getNtlmHash(password string) []byte {
hash := md4.New()
hash.Write(toUnicode(password))
return hash.Sum(nil)
}
func computeNtlmV2Response(ntlmV2Hash, serverChallenge, clientChallenge,
timestamp, targetInfo []byte) []byte {
temp := []byte{1, 1, 0, 0, 0, 0, 0, 0}
temp = append(temp, timestamp...)
temp = append(temp, clientChallenge...)
temp = append(temp, 0, 0, 0, 0)
temp = append(temp, targetInfo...)
temp = append(temp, 0, 0, 0, 0)
NTProofStr := hmacMd5(ntlmV2Hash, serverChallenge, temp)
return append(NTProofStr, temp...)
}
func computeLmV2Response(ntlmV2Hash, serverChallenge, clientChallenge []byte) []byte {
return append(hmacMd5(ntlmV2Hash, serverChallenge, clientChallenge), clientChallenge...)
}
func hmacMd5(key []byte, data ...[]byte) []byte {
mac := hmac.New(md5.New, key)
for _, d := range data {
mac.Write(d)
}
return mac.Sum(nil)
}

71
vendor/github.com/Azure/go-ntlmssp/nlmp_test.go generated vendored Normal file
View file

@ -0,0 +1,71 @@
package ntlmssp
import (
"bytes"
"testing"
)
// test cases from http://davenport.sourceforge.net/ntlm.html
var username = "user"
var password = "SecREt01"
var target = "DOMAIN"
var challenge = []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}
func TestCalculateNTLMv2Response(t *testing.T) {
NTLMv2Hash := getNtlmV2Hash(password, username, target)
ClientChallenge := []byte{0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44}
Time := []byte{0x00, 0x90, 0xd3, 0x36, 0xb7, 0x34, 0xc3, 0x01}
targetInfo := []byte{0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x45, 0x00, 0x52, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x04, 0x00, 0x14, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x03, 0x00, 0x22, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00}
v := computeNtlmV2Response(NTLMv2Hash, challenge, ClientChallenge, Time, targetInfo)
if expected := []byte{
0xcb, 0xab, 0xbc, 0xa7, 0x13, 0xeb, 0x79, 0x5d, 0x04, 0xc9, 0x7a, 0xbc, 0x01, 0xee, 0x49, 0x83,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xd3, 0x36, 0xb7, 0x34, 0xc3, 0x01,
0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00,
0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x01, 0x00, 0x0c, 0x00,
0x53, 0x00, 0x45, 0x00, 0x52, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x04, 0x00, 0x14, 0x00,
0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00,
0x6f, 0x00, 0x6d, 0x00, 0x03, 0x00, 0x22, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00,
0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00,
0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
}; !bytes.Equal(v, expected) {
t.Fatalf("expected %x, got %x", expected, v)
}
}
func TestCalculateLMv2Response(t *testing.T) {
NTLMv2Hash := getNtlmV2Hash(password, username, target)
ClientChallenge := []byte{0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44}
v := computeLmV2Response(NTLMv2Hash, challenge, ClientChallenge)
if expected := []byte{
0xd6, 0xe6, 0x15, 0x2e, 0xa2, 0x5d, 0x03, 0xb7, 0xc6, 0xba, 0x66, 0x29, 0xc2, 0xd6, 0xaa, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44,
}; !bytes.Equal(v, expected) {
t.Fatalf("expected %x, got %x", expected, v)
}
}
func TestToUnicode(t *testing.T) {
v := toUnicode(password)
if expected := []byte{0x53, 0x00, 0x65, 0x00, 0x63, 0x00, 0x52, 0x00, 0x45, 0x00, 0x74, 0x00, 0x30, 0x00, 0x31, 0x00}; !bytes.Equal(v, expected) {
t.Fatalf("expected %v, got %v", expected, v)
}
}
func TestNTLMhash(t *testing.T) {
v := getNtlmHash(password)
if expected := []byte{0xcd, 0x06, 0xca, 0x7c, 0x7e, 0x10, 0xc9, 0x9b, 0x1d, 0x33, 0xb7, 0x48, 0x5a, 0x2e, 0xd8, 0x08}; !bytes.Equal(v, expected) {
t.Fatalf("expected %v, got %v", expected, v)
}
}
func TestNTLMv2Hash(t *testing.T) {
v := getNtlmV2Hash(password, username, target)
if expected := []byte{0x04, 0xb8, 0xe0, 0xba, 0x74, 0x28, 0x9c, 0xc5, 0x40, 0x82, 0x6b, 0xab, 0x1d, 0xee, 0x63, 0xae}; !bytes.Equal(v, expected) {
t.Fatalf("expected %v, got %v", expected, v)
}
}

29
vendor/github.com/Azure/go-ntlmssp/unicode.go generated vendored Normal file
View file

@ -0,0 +1,29 @@
package ntlmssp
import (
"bytes"
"encoding/binary"
"errors"
"unicode/utf16"
)
// helper func's for dealing with Windows Unicode (UTF16LE)
func fromUnicode(d []byte) (string, error) {
if len(d)%2 > 0 {
return "", errors.New("Unicode (UTF 16 LE) specified, but uneven data length")
}
s := make([]uint16, len(d)/2)
err := binary.Read(bytes.NewReader(d), binary.LittleEndian, &s)
if err != nil {
return "", err
}
return string(utf16.Decode(s)), nil
}
func toUnicode(s string) []byte {
uints := utf16.Encode([]rune(s))
b := bytes.Buffer{}
binary.Write(&b, binary.LittleEndian, &uints)
return b.Bytes()
}

40
vendor/github.com/Azure/go-ntlmssp/varfield.go generated vendored Normal file
View file

@ -0,0 +1,40 @@
package ntlmssp
import (
"errors"
)
type varField struct {
Len uint16
MaxLen uint16
BufferOffset uint32
}
func (f varField) ReadFrom(buffer []byte) ([]byte, error) {
if len(buffer) < int(f.BufferOffset+uint32(f.Len)) {
return nil, errors.New("Error reading data, varField extends beyond buffer")
}
return buffer[f.BufferOffset : f.BufferOffset+uint32(f.Len)], nil
}
func (f varField) ReadStringFrom(buffer []byte, unicode bool) (string, error) {
d, err := f.ReadFrom(buffer)
if err != nil {
return "", err
}
if unicode { // UTF-16LE encoding scheme
return fromUnicode(d)
}
// OEM encoding, close enough to ASCII, since no code page is specified
return string(d), err
}
func newVarField(ptr *int, fieldsize int) varField {
f := varField{
Len: uint16(fieldsize),
MaxLen: uint16(fieldsize),
BufferOffset: uint32(*ptr),
}
*ptr += fieldsize
return f
}

118
vendor/golang.org/x/crypto/md4/md4.go generated vendored Normal file
View file

@ -0,0 +1,118 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
package md4
import (
"crypto"
"hash"
)
func init() {
crypto.RegisterHash(crypto.MD4, New)
}
// The size of an MD4 checksum in bytes.
const Size = 16
// The blocksize of MD4 in bytes.
const BlockSize = 64
const (
_Chunk = 64
_Init0 = 0x67452301
_Init1 = 0xEFCDAB89
_Init2 = 0x98BADCFE
_Init3 = 0x10325476
)
// digest represents the partial evaluation of a checksum.
type digest struct {
s [4]uint32
x [_Chunk]byte
nx int
len uint64
}
func (d *digest) Reset() {
d.s[0] = _Init0
d.s[1] = _Init1
d.s[2] = _Init2
d.s[3] = _Init3
d.nx = 0
d.len = 0
}
// New returns a new hash.Hash computing the MD4 checksum.
func New() hash.Hash {
d := new(digest)
d.Reset()
return d
}
func (d *digest) Size() int { return Size }
func (d *digest) BlockSize() int { return BlockSize }
func (d *digest) Write(p []byte) (nn int, err error) {
nn = len(p)
d.len += uint64(nn)
if d.nx > 0 {
n := len(p)
if n > _Chunk-d.nx {
n = _Chunk - d.nx
}
for i := 0; i < n; i++ {
d.x[d.nx+i] = p[i]
}
d.nx += n
if d.nx == _Chunk {
_Block(d, d.x[0:])
d.nx = 0
}
p = p[n:]
}
n := _Block(d, p)
p = p[n:]
if len(p) > 0 {
d.nx = copy(d.x[:], p)
}
return
}
func (d0 *digest) Sum(in []byte) []byte {
// Make a copy of d0, so that caller can keep writing and summing.
d := new(digest)
*d = *d0
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
len := d.len
var tmp [64]byte
tmp[0] = 0x80
if len%64 < 56 {
d.Write(tmp[0 : 56-len%64])
} else {
d.Write(tmp[0 : 64+56-len%64])
}
// Length in bits.
len <<= 3
for i := uint(0); i < 8; i++ {
tmp[i] = byte(len >> (8 * i))
}
d.Write(tmp[0:8])
if d.nx != 0 {
panic("d.nx != 0")
}
for _, s := range d.s {
in = append(in, byte(s>>0))
in = append(in, byte(s>>8))
in = append(in, byte(s>>16))
in = append(in, byte(s>>24))
}
return in
}

89
vendor/golang.org/x/crypto/md4/md4block.go generated vendored Normal file
View file

@ -0,0 +1,89 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// MD4 block step.
// In its own file so that a faster assembly or C version
// can be substituted easily.
package md4
var shift1 = []uint{3, 7, 11, 19}
var shift2 = []uint{3, 5, 9, 13}
var shift3 = []uint{3, 9, 11, 15}
var xIndex2 = []uint{0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15}
var xIndex3 = []uint{0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}
func _Block(dig *digest, p []byte) int {
a := dig.s[0]
b := dig.s[1]
c := dig.s[2]
d := dig.s[3]
n := 0
var X [16]uint32
for len(p) >= _Chunk {
aa, bb, cc, dd := a, b, c, d
j := 0
for i := 0; i < 16; i++ {
X[i] = uint32(p[j]) | uint32(p[j+1])<<8 | uint32(p[j+2])<<16 | uint32(p[j+3])<<24
j += 4
}
// If this needs to be made faster in the future,
// the usual trick is to unroll each of these
// loops by a factor of 4; that lets you replace
// the shift[] lookups with constants and,
// with suitable variable renaming in each
// unrolled body, delete the a, b, c, d = d, a, b, c
// (or you can let the optimizer do the renaming).
//
// The index variables are uint so that % by a power
// of two can be optimized easily by a compiler.
// Round 1.
for i := uint(0); i < 16; i++ {
x := i
s := shift1[i%4]
f := ((c ^ d) & b) ^ d
a += f + X[x]
a = a<<s | a>>(32-s)
a, b, c, d = d, a, b, c
}
// Round 2.
for i := uint(0); i < 16; i++ {
x := xIndex2[i]
s := shift2[i%4]
g := (b & c) | (b & d) | (c & d)
a += g + X[x] + 0x5a827999
a = a<<s | a>>(32-s)
a, b, c, d = d, a, b, c
}
// Round 3.
for i := uint(0); i < 16; i++ {
x := xIndex3[i]
s := shift3[i%4]
h := b ^ c ^ d
a += h + X[x] + 0x6ed9eba1
a = a<<s | a>>(32-s)
a, b, c, d = d, a, b, c
}
a += aa
b += bb
c += cc
d += dd
p = p[_Chunk:]
n += _Chunk
}
dig.s[0] = a
dig.s[1] = b
dig.s[2] = c
dig.s[3] = d
return n
}

50
vendor/golang.org/x/crypto/pkcs12/bmp-string.go generated vendored Normal file
View file

@ -0,0 +1,50 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import (
"errors"
"unicode/utf16"
)
// bmpString returns s encoded in UCS-2 with a zero terminator.
func bmpString(s string) ([]byte, error) {
// References:
// https://tools.ietf.org/html/rfc7292#appendix-B.1
// http://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
// - non-BMP characters are encoded in UTF 16 by using a surrogate pair of 16-bit codes
// EncodeRune returns 0xfffd if the rune does not need special encoding
// - the above RFC provides the info that BMPStrings are NULL terminated.
ret := make([]byte, 0, 2*len(s)+2)
for _, r := range s {
if t, _ := utf16.EncodeRune(r); t != 0xfffd {
return nil, errors.New("pkcs12: string contains characters that cannot be encoded in UCS-2")
}
ret = append(ret, byte(r/256), byte(r%256))
}
return append(ret, 0, 0), nil
}
func decodeBMPString(bmpString []byte) (string, error) {
if len(bmpString)%2 != 0 {
return "", errors.New("pkcs12: odd-length BMP string")
}
// strip terminator if present
if l := len(bmpString); l >= 2 && bmpString[l-1] == 0 && bmpString[l-2] == 0 {
bmpString = bmpString[:l-2]
}
s := make([]uint16, 0, len(bmpString)/2)
for len(bmpString) > 0 {
s = append(s, uint16(bmpString[0])<<8+uint16(bmpString[1]))
bmpString = bmpString[2:]
}
return string(utf16.Decode(s)), nil
}

131
vendor/golang.org/x/crypto/pkcs12/crypto.go generated vendored Normal file
View file

@ -0,0 +1,131 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import (
"bytes"
"crypto/cipher"
"crypto/des"
"crypto/x509/pkix"
"encoding/asn1"
"errors"
"golang.org/x/crypto/pkcs12/internal/rc2"
)
var (
oidPBEWithSHAAnd3KeyTripleDESCBC = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 12, 1, 3})
oidPBEWithSHAAnd40BitRC2CBC = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 12, 1, 6})
)
// pbeCipher is an abstraction of a PKCS#12 cipher.
type pbeCipher interface {
// create returns a cipher.Block given a key.
create(key []byte) (cipher.Block, error)
// deriveKey returns a key derived from the given password and salt.
deriveKey(salt, password []byte, iterations int) []byte
// deriveKey returns an IV derived from the given password and salt.
deriveIV(salt, password []byte, iterations int) []byte
}
type shaWithTripleDESCBC struct{}
func (shaWithTripleDESCBC) create(key []byte) (cipher.Block, error) {
return des.NewTripleDESCipher(key)
}
func (shaWithTripleDESCBC) deriveKey(salt, password []byte, iterations int) []byte {
return pbkdf(sha1Sum, 20, 64, salt, password, iterations, 1, 24)
}
func (shaWithTripleDESCBC) deriveIV(salt, password []byte, iterations int) []byte {
return pbkdf(sha1Sum, 20, 64, salt, password, iterations, 2, 8)
}
type shaWith40BitRC2CBC struct{}
func (shaWith40BitRC2CBC) create(key []byte) (cipher.Block, error) {
return rc2.New(key, len(key)*8)
}
func (shaWith40BitRC2CBC) deriveKey(salt, password []byte, iterations int) []byte {
return pbkdf(sha1Sum, 20, 64, salt, password, iterations, 1, 5)
}
func (shaWith40BitRC2CBC) deriveIV(salt, password []byte, iterations int) []byte {
return pbkdf(sha1Sum, 20, 64, salt, password, iterations, 2, 8)
}
type pbeParams struct {
Salt []byte
Iterations int
}
func pbDecrypterFor(algorithm pkix.AlgorithmIdentifier, password []byte) (cipher.BlockMode, int, error) {
var cipherType pbeCipher
switch {
case algorithm.Algorithm.Equal(oidPBEWithSHAAnd3KeyTripleDESCBC):
cipherType = shaWithTripleDESCBC{}
case algorithm.Algorithm.Equal(oidPBEWithSHAAnd40BitRC2CBC):
cipherType = shaWith40BitRC2CBC{}
default:
return nil, 0, NotImplementedError("algorithm " + algorithm.Algorithm.String() + " is not supported")
}
var params pbeParams
if err := unmarshal(algorithm.Parameters.FullBytes, &params); err != nil {
return nil, 0, err
}
key := cipherType.deriveKey(params.Salt, password, params.Iterations)
iv := cipherType.deriveIV(params.Salt, password, params.Iterations)
block, err := cipherType.create(key)
if err != nil {
return nil, 0, err
}
return cipher.NewCBCDecrypter(block, iv), block.BlockSize(), nil
}
func pbDecrypt(info decryptable, password []byte) (decrypted []byte, err error) {
cbc, blockSize, err := pbDecrypterFor(info.Algorithm(), password)
if err != nil {
return nil, err
}
encrypted := info.Data()
if len(encrypted) == 0 {
return nil, errors.New("pkcs12: empty encrypted data")
}
if len(encrypted)%blockSize != 0 {
return nil, errors.New("pkcs12: input is not a multiple of the block size")
}
decrypted = make([]byte, len(encrypted))
cbc.CryptBlocks(decrypted, encrypted)
psLen := int(decrypted[len(decrypted)-1])
if psLen == 0 || psLen > blockSize {
return nil, ErrDecryption
}
if len(decrypted) < psLen {
return nil, ErrDecryption
}
ps := decrypted[len(decrypted)-psLen:]
decrypted = decrypted[:len(decrypted)-psLen]
if bytes.Compare(ps, bytes.Repeat([]byte{byte(psLen)}, psLen)) != 0 {
return nil, ErrDecryption
}
return
}
// decryptable abstracts a object that contains ciphertext.
type decryptable interface {
Algorithm() pkix.AlgorithmIdentifier
Data() []byte
}

23
vendor/golang.org/x/crypto/pkcs12/errors.go generated vendored Normal file
View file

@ -0,0 +1,23 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import "errors"
var (
// ErrDecryption represents a failure to decrypt the input.
ErrDecryption = errors.New("pkcs12: decryption error, incorrect padding")
// ErrIncorrectPassword is returned when an incorrect password is detected.
// Usually, P12/PFX data is signed to be able to verify the password.
ErrIncorrectPassword = errors.New("pkcs12: decryption password incorrect")
)
// NotImplementedError indicates that the input is not currently supported.
type NotImplementedError string
func (e NotImplementedError) Error() string {
return "pkcs12: " + string(e)
}

274
vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go generated vendored Normal file
View file

@ -0,0 +1,274 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package rc2 implements the RC2 cipher
/*
https://www.ietf.org/rfc/rfc2268.txt
http://people.csail.mit.edu/rivest/pubs/KRRR98.pdf
This code is licensed under the MIT license.
*/
package rc2
import (
"crypto/cipher"
"encoding/binary"
)
// The rc2 block size in bytes
const BlockSize = 8
type rc2Cipher struct {
k [64]uint16
}
// New returns a new rc2 cipher with the given key and effective key length t1
func New(key []byte, t1 int) (cipher.Block, error) {
// TODO(dgryski): error checking for key length
return &rc2Cipher{
k: expandKey(key, t1),
}, nil
}
func (*rc2Cipher) BlockSize() int { return BlockSize }
var piTable = [256]byte{
0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad,
}
func expandKey(key []byte, t1 int) [64]uint16 {
l := make([]byte, 128)
copy(l, key)
var t = len(key)
var t8 = (t1 + 7) / 8
var tm = byte(255 % uint(1<<(8+uint(t1)-8*uint(t8))))
for i := len(key); i < 128; i++ {
l[i] = piTable[l[i-1]+l[uint8(i-t)]]
}
l[128-t8] = piTable[l[128-t8]&tm]
for i := 127 - t8; i >= 0; i-- {
l[i] = piTable[l[i+1]^l[i+t8]]
}
var k [64]uint16
for i := range k {
k[i] = uint16(l[2*i]) + uint16(l[2*i+1])*256
}
return k
}
func rotl16(x uint16, b uint) uint16 {
return (x >> (16 - b)) | (x << b)
}
func (c *rc2Cipher) Encrypt(dst, src []byte) {
r0 := binary.LittleEndian.Uint16(src[0:])
r1 := binary.LittleEndian.Uint16(src[2:])
r2 := binary.LittleEndian.Uint16(src[4:])
r3 := binary.LittleEndian.Uint16(src[6:])
var j int
for j <= 16 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
j++
}
r0 = r0 + c.k[r3&63]
r1 = r1 + c.k[r0&63]
r2 = r2 + c.k[r1&63]
r3 = r3 + c.k[r2&63]
for j <= 40 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
j++
}
r0 = r0 + c.k[r3&63]
r1 = r1 + c.k[r0&63]
r2 = r2 + c.k[r1&63]
r3 = r3 + c.k[r2&63]
for j <= 60 {
// mix r0
r0 = r0 + c.k[j] + (r3 & r2) + ((^r3) & r1)
r0 = rotl16(r0, 1)
j++
// mix r1
r1 = r1 + c.k[j] + (r0 & r3) + ((^r0) & r2)
r1 = rotl16(r1, 2)
j++
// mix r2
r2 = r2 + c.k[j] + (r1 & r0) + ((^r1) & r3)
r2 = rotl16(r2, 3)
j++
// mix r3
r3 = r3 + c.k[j] + (r2 & r1) + ((^r2) & r0)
r3 = rotl16(r3, 5)
j++
}
binary.LittleEndian.PutUint16(dst[0:], r0)
binary.LittleEndian.PutUint16(dst[2:], r1)
binary.LittleEndian.PutUint16(dst[4:], r2)
binary.LittleEndian.PutUint16(dst[6:], r3)
}
func (c *rc2Cipher) Decrypt(dst, src []byte) {
r0 := binary.LittleEndian.Uint16(src[0:])
r1 := binary.LittleEndian.Uint16(src[2:])
r2 := binary.LittleEndian.Uint16(src[4:])
r3 := binary.LittleEndian.Uint16(src[6:])
j := 63
for j >= 44 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--
}
r3 = r3 - c.k[r2&63]
r2 = r2 - c.k[r1&63]
r1 = r1 - c.k[r0&63]
r0 = r0 - c.k[r3&63]
for j >= 20 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--
}
r3 = r3 - c.k[r2&63]
r2 = r2 - c.k[r1&63]
r1 = r1 - c.k[r0&63]
r0 = r0 - c.k[r3&63]
for j >= 0 {
// unmix r3
r3 = rotl16(r3, 16-5)
r3 = r3 - c.k[j] - (r2 & r1) - ((^r2) & r0)
j--
// unmix r2
r2 = rotl16(r2, 16-3)
r2 = r2 - c.k[j] - (r1 & r0) - ((^r1) & r3)
j--
// unmix r1
r1 = rotl16(r1, 16-2)
r1 = r1 - c.k[j] - (r0 & r3) - ((^r0) & r2)
j--
// unmix r0
r0 = rotl16(r0, 16-1)
r0 = r0 - c.k[j] - (r3 & r2) - ((^r3) & r1)
j--
}
binary.LittleEndian.PutUint16(dst[0:], r0)
binary.LittleEndian.PutUint16(dst[2:], r1)
binary.LittleEndian.PutUint16(dst[4:], r2)
binary.LittleEndian.PutUint16(dst[6:], r3)
}

45
vendor/golang.org/x/crypto/pkcs12/mac.go generated vendored Normal file
View file

@ -0,0 +1,45 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import (
"crypto/hmac"
"crypto/sha1"
"crypto/x509/pkix"
"encoding/asn1"
)
type macData struct {
Mac digestInfo
MacSalt []byte
Iterations int `asn1:"optional,default:1"`
}
// from PKCS#7:
type digestInfo struct {
Algorithm pkix.AlgorithmIdentifier
Digest []byte
}
var (
oidSHA1 = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26})
)
func verifyMac(macData *macData, message, password []byte) error {
if !macData.Mac.Algorithm.Algorithm.Equal(oidSHA1) {
return NotImplementedError("unknown digest algorithm: " + macData.Mac.Algorithm.Algorithm.String())
}
key := pbkdf(sha1Sum, 20, 64, macData.MacSalt, password, macData.Iterations, 3, 20)
mac := hmac.New(sha1.New, key)
mac.Write(message)
expectedMAC := mac.Sum(nil)
if !hmac.Equal(macData.Mac.Digest, expectedMAC) {
return ErrIncorrectPassword
}
return nil
}

170
vendor/golang.org/x/crypto/pkcs12/pbkdf.go generated vendored Normal file
View file

@ -0,0 +1,170 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import (
"bytes"
"crypto/sha1"
"math/big"
)
var (
one = big.NewInt(1)
)
// sha1Sum returns the SHA-1 hash of in.
func sha1Sum(in []byte) []byte {
sum := sha1.Sum(in)
return sum[:]
}
// fillWithRepeats returns v*ceiling(len(pattern) / v) bytes consisting of
// repeats of pattern.
func fillWithRepeats(pattern []byte, v int) []byte {
if len(pattern) == 0 {
return nil
}
outputLen := v * ((len(pattern) + v - 1) / v)
return bytes.Repeat(pattern, (outputLen+len(pattern)-1)/len(pattern))[:outputLen]
}
func pbkdf(hash func([]byte) []byte, u, v int, salt, password []byte, r int, ID byte, size int) (key []byte) {
// implementation of https://tools.ietf.org/html/rfc7292#appendix-B.2 , RFC text verbatim in comments
// Let H be a hash function built around a compression function f:
// Z_2^u x Z_2^v -> Z_2^u
// (that is, H has a chaining variable and output of length u bits, and
// the message input to the compression function of H is v bits). The
// values for u and v are as follows:
// HASH FUNCTION VALUE u VALUE v
// MD2, MD5 128 512
// SHA-1 160 512
// SHA-224 224 512
// SHA-256 256 512
// SHA-384 384 1024
// SHA-512 512 1024
// SHA-512/224 224 1024
// SHA-512/256 256 1024
// Furthermore, let r be the iteration count.
// We assume here that u and v are both multiples of 8, as are the
// lengths of the password and salt strings (which we denote by p and s,
// respectively) and the number n of pseudorandom bits required. In
// addition, u and v are of course non-zero.
// For information on security considerations for MD5 [19], see [25] and
// [1], and on those for MD2, see [18].
// The following procedure can be used to produce pseudorandom bits for
// a particular "purpose" that is identified by a byte called "ID".
// This standard specifies 3 different values for the ID byte:
// 1. If ID=1, then the pseudorandom bits being produced are to be used
// as key material for performing encryption or decryption.
// 2. If ID=2, then the pseudorandom bits being produced are to be used
// as an IV (Initial Value) for encryption or decryption.
// 3. If ID=3, then the pseudorandom bits being produced are to be used
// as an integrity key for MACing.
// 1. Construct a string, D (the "diversifier"), by concatenating v/8
// copies of ID.
var D []byte
for i := 0; i < v; i++ {
D = append(D, ID)
}
// 2. Concatenate copies of the salt together to create a string S of
// length v(ceiling(s/v)) bits (the final copy of the salt may be
// truncated to create S). Note that if the salt is the empty
// string, then so is S.
S := fillWithRepeats(salt, v)
// 3. Concatenate copies of the password together to create a string P
// of length v(ceiling(p/v)) bits (the final copy of the password
// may be truncated to create P). Note that if the password is the
// empty string, then so is P.
P := fillWithRepeats(password, v)
// 4. Set I=S||P to be the concatenation of S and P.
I := append(S, P...)
// 5. Set c=ceiling(n/u).
c := (size + u - 1) / u
// 6. For i=1, 2, ..., c, do the following:
A := make([]byte, c*20)
var IjBuf []byte
for i := 0; i < c; i++ {
// A. Set A2=H^r(D||I). (i.e., the r-th hash of D||1,
// H(H(H(... H(D||I))))
Ai := hash(append(D, I...))
for j := 1; j < r; j++ {
Ai = hash(Ai)
}
copy(A[i*20:], Ai[:])
if i < c-1 { // skip on last iteration
// B. Concatenate copies of Ai to create a string B of length v
// bits (the final copy of Ai may be truncated to create B).
var B []byte
for len(B) < v {
B = append(B, Ai[:]...)
}
B = B[:v]
// C. Treating I as a concatenation I_0, I_1, ..., I_(k-1) of v-bit
// blocks, where k=ceiling(s/v)+ceiling(p/v), modify I by
// setting I_j=(I_j+B+1) mod 2^v for each j.
{
Bbi := new(big.Int).SetBytes(B)
Ij := new(big.Int)
for j := 0; j < len(I)/v; j++ {
Ij.SetBytes(I[j*v : (j+1)*v])
Ij.Add(Ij, Bbi)
Ij.Add(Ij, one)
Ijb := Ij.Bytes()
// We expect Ijb to be exactly v bytes,
// if it is longer or shorter we must
// adjust it accordingly.
if len(Ijb) > v {
Ijb = Ijb[len(Ijb)-v:]
}
if len(Ijb) < v {
if IjBuf == nil {
IjBuf = make([]byte, v)
}
bytesShort := v - len(Ijb)
for i := 0; i < bytesShort; i++ {
IjBuf[i] = 0
}
copy(IjBuf[bytesShort:], Ijb)
Ijb = IjBuf
}
copy(I[j*v:(j+1)*v], Ijb)
}
}
}
}
// 7. Concatenate A_1, A_2, ..., A_c together to form a pseudorandom
// bit string, A.
// 8. Use the first n bits of A as the output of this entire process.
return A[:size]
// If the above process is being used to generate a DES key, the process
// should be used to create 64 random bits, and the key's parity bits
// should be set after the 64 bits have been produced. Similar concerns
// hold for 2-key and 3-key triple-DES keys, for CDMF keys, and for any
// similar keys with parity bits "built into them".
}

342
vendor/golang.org/x/crypto/pkcs12/pkcs12.go generated vendored Normal file
View file

@ -0,0 +1,342 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package pkcs12 implements some of PKCS#12.
//
// This implementation is distilled from https://tools.ietf.org/html/rfc7292
// and referenced documents. It is intended for decoding P12/PFX-stored
// certificates and keys for use with the crypto/tls package.
package pkcs12
import (
"crypto/ecdsa"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/hex"
"encoding/pem"
"errors"
)
var (
oidDataContentType = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 7, 1})
oidEncryptedDataContentType = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 7, 6})
oidFriendlyName = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 9, 20})
oidLocalKeyID = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 9, 21})
oidMicrosoftCSPName = asn1.ObjectIdentifier([]int{1, 3, 6, 1, 4, 1, 311, 17, 1})
)
type pfxPdu struct {
Version int
AuthSafe contentInfo
MacData macData `asn1:"optional"`
}
type contentInfo struct {
ContentType asn1.ObjectIdentifier
Content asn1.RawValue `asn1:"tag:0,explicit,optional"`
}
type encryptedData struct {
Version int
EncryptedContentInfo encryptedContentInfo
}
type encryptedContentInfo struct {
ContentType asn1.ObjectIdentifier
ContentEncryptionAlgorithm pkix.AlgorithmIdentifier
EncryptedContent []byte `asn1:"tag:0,optional"`
}
func (i encryptedContentInfo) Algorithm() pkix.AlgorithmIdentifier {
return i.ContentEncryptionAlgorithm
}
func (i encryptedContentInfo) Data() []byte { return i.EncryptedContent }
type safeBag struct {
Id asn1.ObjectIdentifier
Value asn1.RawValue `asn1:"tag:0,explicit"`
Attributes []pkcs12Attribute `asn1:"set,optional"`
}
type pkcs12Attribute struct {
Id asn1.ObjectIdentifier
Value asn1.RawValue `asn1:"set"`
}
type encryptedPrivateKeyInfo struct {
AlgorithmIdentifier pkix.AlgorithmIdentifier
EncryptedData []byte
}
func (i encryptedPrivateKeyInfo) Algorithm() pkix.AlgorithmIdentifier {
return i.AlgorithmIdentifier
}
func (i encryptedPrivateKeyInfo) Data() []byte {
return i.EncryptedData
}
// PEM block types
const (
certificateType = "CERTIFICATE"
privateKeyType = "PRIVATE KEY"
)
// unmarshal calls asn1.Unmarshal, but also returns an error if there is any
// trailing data after unmarshaling.
func unmarshal(in []byte, out interface{}) error {
trailing, err := asn1.Unmarshal(in, out)
if err != nil {
return err
}
if len(trailing) != 0 {
return errors.New("pkcs12: trailing data found")
}
return nil
}
// ConvertToPEM converts all "safe bags" contained in pfxData to PEM blocks.
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) {
encodedPassword, err := bmpString(password)
if err != nil {
return nil, ErrIncorrectPassword
}
bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)
blocks := make([]*pem.Block, 0, len(bags))
for _, bag := range bags {
block, err := convertBag(&bag, encodedPassword)
if err != nil {
return nil, err
}
blocks = append(blocks, block)
}
return blocks, nil
}
func convertBag(bag *safeBag, password []byte) (*pem.Block, error) {
block := &pem.Block{
Headers: make(map[string]string),
}
for _, attribute := range bag.Attributes {
k, v, err := convertAttribute(&attribute)
if err != nil {
return nil, err
}
block.Headers[k] = v
}
switch {
case bag.Id.Equal(oidCertBag):
block.Type = certificateType
certsData, err := decodeCertBag(bag.Value.Bytes)
if err != nil {
return nil, err
}
block.Bytes = certsData
case bag.Id.Equal(oidPKCS8ShroundedKeyBag):
block.Type = privateKeyType
key, err := decodePkcs8ShroudedKeyBag(bag.Value.Bytes, password)
if err != nil {
return nil, err
}
switch key := key.(type) {
case *rsa.PrivateKey:
block.Bytes = x509.MarshalPKCS1PrivateKey(key)
case *ecdsa.PrivateKey:
block.Bytes, err = x509.MarshalECPrivateKey(key)
if err != nil {
return nil, err
}
default:
return nil, errors.New("found unknown private key type in PKCS#8 wrapping")
}
default:
return nil, errors.New("don't know how to convert a safe bag of type " + bag.Id.String())
}
return block, nil
}
func convertAttribute(attribute *pkcs12Attribute) (key, value string, err error) {
isString := false
switch {
case attribute.Id.Equal(oidFriendlyName):
key = "friendlyName"
isString = true
case attribute.Id.Equal(oidLocalKeyID):
key = "localKeyId"
case attribute.Id.Equal(oidMicrosoftCSPName):
// This key is chosen to match OpenSSL.
key = "Microsoft CSP Name"
isString = true
default:
return "", "", errors.New("pkcs12: unknown attribute with OID " + attribute.Id.String())
}
if isString {
if err := unmarshal(attribute.Value.Bytes, &attribute.Value); err != nil {
return "", "", err
}
if value, err = decodeBMPString(attribute.Value.Bytes); err != nil {
return "", "", err
}
} else {
var id []byte
if err := unmarshal(attribute.Value.Bytes, &id); err != nil {
return "", "", err
}
value = hex.EncodeToString(id)
}
return key, value, nil
}
// Decode extracts a certificate and private key from pfxData. This function
// assumes that there is only one certificate and only one private key in the
// pfxData.
func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error) {
encodedPassword, err := bmpString(password)
if err != nil {
return nil, nil, err
}
bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)
if err != nil {
return nil, nil, err
}
if len(bags) != 2 {
err = errors.New("pkcs12: expected exactly two safe bags in the PFX PDU")
return
}
for _, bag := range bags {
switch {
case bag.Id.Equal(oidCertBag):
if certificate != nil {
err = errors.New("pkcs12: expected exactly one certificate bag")
}
certsData, err := decodeCertBag(bag.Value.Bytes)
if err != nil {
return nil, nil, err
}
certs, err := x509.ParseCertificates(certsData)
if err != nil {
return nil, nil, err
}
if len(certs) != 1 {
err = errors.New("pkcs12: expected exactly one certificate in the certBag")
return nil, nil, err
}
certificate = certs[0]
case bag.Id.Equal(oidPKCS8ShroundedKeyBag):
if privateKey != nil {
err = errors.New("pkcs12: expected exactly one key bag")
}
if privateKey, err = decodePkcs8ShroudedKeyBag(bag.Value.Bytes, encodedPassword); err != nil {
return nil, nil, err
}
}
}
if certificate == nil {
return nil, nil, errors.New("pkcs12: certificate missing")
}
if privateKey == nil {
return nil, nil, errors.New("pkcs12: private key missing")
}
return
}
func getSafeContents(p12Data, password []byte) (bags []safeBag, updatedPassword []byte, err error) {
pfx := new(pfxPdu)
if err := unmarshal(p12Data, pfx); err != nil {
return nil, nil, errors.New("pkcs12: error reading P12 data: " + err.Error())
}
if pfx.Version != 3 {
return nil, nil, NotImplementedError("can only decode v3 PFX PDU's")
}
if !pfx.AuthSafe.ContentType.Equal(oidDataContentType) {
return nil, nil, NotImplementedError("only password-protected PFX is implemented")
}
// unmarshal the explicit bytes in the content for type 'data'
if err := unmarshal(pfx.AuthSafe.Content.Bytes, &pfx.AuthSafe.Content); err != nil {
return nil, nil, err
}
if len(pfx.MacData.Mac.Algorithm.Algorithm) == 0 {
return nil, nil, errors.New("pkcs12: no MAC in data")
}
if err := verifyMac(&pfx.MacData, pfx.AuthSafe.Content.Bytes, password); err != nil {
if err == ErrIncorrectPassword && len(password) == 2 && password[0] == 0 && password[1] == 0 {
// some implementations use an empty byte array
// for the empty string password try one more
// time with empty-empty password
password = nil
err = verifyMac(&pfx.MacData, pfx.AuthSafe.Content.Bytes, password)
}
if err != nil {
return nil, nil, err
}
}
var authenticatedSafe []contentInfo
if err := unmarshal(pfx.AuthSafe.Content.Bytes, &authenticatedSafe); err != nil {
return nil, nil, err
}
if len(authenticatedSafe) != 2 {
return nil, nil, NotImplementedError("expected exactly two items in the authenticated safe")
}
for _, ci := range authenticatedSafe {
var data []byte
switch {
case ci.ContentType.Equal(oidDataContentType):
if err := unmarshal(ci.Content.Bytes, &data); err != nil {
return nil, nil, err
}
case ci.ContentType.Equal(oidEncryptedDataContentType):
var encryptedData encryptedData
if err := unmarshal(ci.Content.Bytes, &encryptedData); err != nil {
return nil, nil, err
}
if encryptedData.Version != 0 {
return nil, nil, NotImplementedError("only version 0 of EncryptedData is supported")
}
if data, err = pbDecrypt(encryptedData.EncryptedContentInfo, password); err != nil {
return nil, nil, err
}
default:
return nil, nil, NotImplementedError("only data and encryptedData content types are supported in authenticated safe")
}
var safeContents []safeBag
if err := unmarshal(data, &safeContents); err != nil {
return nil, nil, err
}
bags = append(bags, safeContents...)
}
return bags, password, nil
}

57
vendor/golang.org/x/crypto/pkcs12/safebags.go generated vendored Normal file
View file

@ -0,0 +1,57 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pkcs12
import (
"crypto/x509"
"encoding/asn1"
"errors"
)
var (
// see https://tools.ietf.org/html/rfc7292#appendix-D
oidCertTypeX509Certificate = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 9, 22, 1})
oidPKCS8ShroundedKeyBag = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 12, 10, 1, 2})
oidCertBag = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 12, 10, 1, 3})
)
type certBag struct {
Id asn1.ObjectIdentifier
Data []byte `asn1:"tag:0,explicit"`
}
func decodePkcs8ShroudedKeyBag(asn1Data, password []byte) (privateKey interface{}, err error) {
pkinfo := new(encryptedPrivateKeyInfo)
if err = unmarshal(asn1Data, pkinfo); err != nil {
return nil, errors.New("pkcs12: error decoding PKCS#8 shrouded key bag: " + err.Error())
}
pkData, err := pbDecrypt(pkinfo, password)
if err != nil {
return nil, errors.New("pkcs12: error decrypting PKCS#8 shrouded key bag: " + err.Error())
}
ret := new(asn1.RawValue)
if err = unmarshal(pkData, ret); err != nil {
return nil, errors.New("pkcs12: error unmarshaling decrypted private key: " + err.Error())
}
if privateKey, err = x509.ParsePKCS8PrivateKey(pkData); err != nil {
return nil, errors.New("pkcs12: error parsing PKCS#8 private key: " + err.Error())
}
return privateKey, nil
}
func decodeCertBag(asn1Data []byte) (x509Certificates []byte, err error) {
bag := new(certBag)
if err := unmarshal(asn1Data, bag); err != nil {
return nil, errors.New("pkcs12: error decoding cert bag: " + err.Error())
}
if !bag.Id.Equal(oidCertTypeX509Certificate) {
return nil, NotImplementedError("only X509 certificates are supported")
}
return bag.Data, nil
}

2
vendor/golang.org/x/net/http2/.gitignore generated vendored Normal file
View file

@ -0,0 +1,2 @@
*~
h2i/h2i

51
vendor/golang.org/x/net/http2/Dockerfile generated vendored Normal file
View file

@ -0,0 +1,51 @@
#
# This Dockerfile builds a recent curl with HTTP/2 client support, using
# a recent nghttp2 build.
#
# See the Makefile for how to tag it. If Docker and that image is found, the
# Go tests use this curl binary for integration tests.
#
FROM ubuntu:trusty
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git-core build-essential wget
RUN apt-get install -y --no-install-recommends \
autotools-dev libtool pkg-config zlib1g-dev \
libcunit1-dev libssl-dev libxml2-dev libevent-dev \
automake autoconf
# The list of packages nghttp2 recommends for h2load:
RUN apt-get install -y --no-install-recommends make binutils \
autoconf automake autotools-dev \
libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \
libev-dev libevent-dev libjansson-dev libjemalloc-dev \
cython python3.4-dev python-setuptools
# Note: setting NGHTTP2_VER before the git clone, so an old git clone isn't cached:
ENV NGHTTP2_VER 895da9a
RUN cd /root && git clone https://github.com/tatsuhiro-t/nghttp2.git
WORKDIR /root/nghttp2
RUN git reset --hard $NGHTTP2_VER
RUN autoreconf -i
RUN automake
RUN autoconf
RUN ./configure
RUN make
RUN make install
WORKDIR /root
RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz
RUN tar -zxvf curl-7.45.0.tar.gz
WORKDIR /root/curl-7.45.0
RUN ./configure --with-ssl --with-nghttp2=/usr/local
RUN make
RUN make install
RUN ldconfig
CMD ["-h"]
ENTRYPOINT ["/usr/local/bin/curl"]

Some files were not shown because too many files have changed in this diff Show more