Merge pull request #1023 from dlorenc/152

Update to k8s 1.5.2
pull/1030/head
dlorenc 2017-01-19 10:01:40 -08:00 committed by GitHub
commit 5e5e2bd780
376 changed files with 10006 additions and 4014 deletions

2327
Godeps/Godeps.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ minikube start
--iso-url string Location of the minikube iso (default "https://storage.googleapis.com/minikube/iso/minikube-v1.0.3.iso") --iso-url string Location of the minikube iso (default "https://storage.googleapis.com/minikube/iso/minikube-v1.0.3.iso")
--keep-context This will keep the existing kubectl context and will create a minikube context. --keep-context This will keep the existing kubectl context and will create a minikube context.
--kubernetes-version string The kubernetes version that the minikube VM will use (ex: v1.2.3) --kubernetes-version string The kubernetes version that the minikube VM will use (ex: v1.2.3)
OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64) (default "v1.5.1") OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64) (default "v1.5.2")
--kvm-network string The KVM network name. (only supported with KVM driver) (default "default") --kvm-network string The KVM network name. (only supported with KVM driver) (default "default")
--memory int Amount of RAM allocated to the minikube VM (default 2048) --memory int Amount of RAM allocated to the minikube VM (default 2048)
--network-plugin string The name of the network plugin --network-plugin string The name of the network plugin

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -41,12 +42,19 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string)
return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)} return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the operation to create or update the availability set. // CreateOrUpdate create or update an availability set.
// //
// resourceGroupName is the name of the resource group. name is parameters // resourceGroupName is the name of the resource group. name is the name of
// supplied to the Create Availability Set operation. parameters is // the availability set. parameters is parameters supplied to the Create
// parameters supplied to the Create Availability Set operation. // Availability Set operation.
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) { func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.AvailabilitySetProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AvailabilitySetProperties.Statuses", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
if err != nil { 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")
@ -107,7 +115,7 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
return return
} }
// Delete the operation to delete the availability set. // Delete delete an availability set.
// //
// resourceGroupName is the name of the resource group. availabilitySetName is // resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set. // the name of the availability set.
@ -169,7 +177,7 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul
return return
} }
// Get the operation to get the availability set. // Get retrieves information about an availability set.
// //
// resourceGroupName is the name of the resource group. availabilitySetName is // resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set. // the name of the availability set.
@ -232,7 +240,7 @@ func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result A
return return
} }
// List the operation to list the availability sets. // List lists all availability sets in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) { func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) {

View File

@ -365,7 +365,7 @@ type APIErrorBase struct {
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`
} }
// AvailabilitySet is create or update Availability Set parameters. // AvailabilitySet is create or update availability set parameters.
type AvailabilitySet struct { type AvailabilitySet struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
@ -373,7 +373,7 @@ type AvailabilitySet struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *AvailabilitySetProperties `json:"properties,omitempty"` *AvailabilitySetProperties `json:"properties,omitempty"`
} }
// AvailabilitySetListResult is the List Availability Set operation response. // AvailabilitySetListResult is the List Availability Set operation response.
@ -477,7 +477,7 @@ type KeyVaultSecretReference struct {
SourceVault *SubResource `json:"sourceVault,omitempty"` SourceVault *SubResource `json:"sourceVault,omitempty"`
} }
// LinuxConfiguration is describes Windows Configuration of the OS Profile. // LinuxConfiguration is describes Windows configuration of the OS Profile.
type LinuxConfiguration struct { type LinuxConfiguration struct {
DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"`
SSH *SSHConfiguration `json:"ssh,omitempty"` SSH *SSHConfiguration `json:"ssh,omitempty"`
@ -523,7 +523,7 @@ type LongRunningOperationProperties struct {
// NetworkInterfaceReference is describes a network interface reference. // NetworkInterfaceReference is describes a network interface reference.
type NetworkInterfaceReference struct { type NetworkInterfaceReference struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` *NetworkInterfaceReferenceProperties `json:"properties,omitempty"`
} }
// NetworkInterfaceReferenceProperties is describes a network interface // NetworkInterfaceReferenceProperties is describes a network interface
@ -581,7 +581,7 @@ type PurchasePlan struct {
Product *string `json:"product,omitempty"` Product *string `json:"product,omitempty"`
} }
// Resource is // Resource is the resource model definition.
type Resource struct { type Resource struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
@ -668,7 +668,7 @@ type VirtualMachine struct {
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Plan *Plan `json:"plan,omitempty"` Plan *Plan `json:"plan,omitempty"`
Properties *VirtualMachineProperties `json:"properties,omitempty"` *VirtualMachineProperties `json:"properties,omitempty"`
Resources *[]VirtualMachineExtension `json:"resources,omitempty"` Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
} }
@ -691,7 +691,7 @@ type VirtualMachineCaptureParameters struct {
type VirtualMachineCaptureResult struct { type VirtualMachineCaptureResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Properties *VirtualMachineCaptureResultProperties `json:"properties,omitempty"` *VirtualMachineCaptureResultProperties `json:"properties,omitempty"`
} }
// VirtualMachineCaptureResultProperties is compute-specific operation // VirtualMachineCaptureResultProperties is compute-specific operation
@ -708,7 +708,7 @@ type VirtualMachineExtension struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` *VirtualMachineExtensionProperties `json:"properties,omitempty"`
} }
// VirtualMachineExtensionHandlerInstanceView is the instance view of a // VirtualMachineExtensionHandlerInstanceView is the instance view of a
@ -727,7 +727,7 @@ type VirtualMachineExtensionImage struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` *VirtualMachineExtensionImageProperties `json:"properties,omitempty"`
} }
// VirtualMachineExtensionImageProperties is describes the properties of a // VirtualMachineExtensionImageProperties is describes the properties of a
@ -771,7 +771,7 @@ type VirtualMachineImage struct {
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *VirtualMachineImageProperties `json:"properties,omitempty"` *VirtualMachineImageProperties `json:"properties,omitempty"`
} }
// VirtualMachineImageProperties is describes the properties of a Virtual // VirtualMachineImageProperties is describes the properties of a Virtual
@ -844,7 +844,7 @@ type VirtualMachineScaleSet struct {
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"` Sku *Sku `json:"sku,omitempty"`
Properties *VirtualMachineScaleSetProperties `json:"properties,omitempty"` *VirtualMachineScaleSetProperties `json:"properties,omitempty"`
} }
// VirtualMachineScaleSetExtension is describes a Virtual Machine Scale Set // VirtualMachineScaleSetExtension is describes a Virtual Machine Scale Set
@ -852,7 +852,7 @@ type VirtualMachineScaleSet struct {
type VirtualMachineScaleSetExtension struct { type VirtualMachineScaleSetExtension struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"`
} }
// VirtualMachineScaleSetExtensionProfile is describes a virtual machine scale // VirtualMachineScaleSetExtensionProfile is describes a virtual machine scale
@ -893,7 +893,7 @@ type VirtualMachineScaleSetInstanceViewStatusesSummary struct {
type VirtualMachineScaleSetIPConfiguration struct { type VirtualMachineScaleSetIPConfiguration struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"`
} }
// VirtualMachineScaleSetIPConfigurationProperties is describes a virtual // VirtualMachineScaleSetIPConfigurationProperties is describes a virtual
@ -970,7 +970,7 @@ func (client VirtualMachineScaleSetListWithLinkResult) VirtualMachineScaleSetLis
type VirtualMachineScaleSetNetworkConfiguration struct { type VirtualMachineScaleSetNetworkConfiguration struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"`
} }
// VirtualMachineScaleSetNetworkConfigurationProperties is describes a virtual // VirtualMachineScaleSetNetworkConfigurationProperties is describes a virtual
@ -1015,7 +1015,7 @@ type VirtualMachineScaleSetProperties struct {
UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"`
VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"` ProvisioningState *string `json:"provisioningState,omitempty"`
OverProvision *bool `json:"overProvision,omitempty"` Overprovision *bool `json:"overprovision,omitempty"`
} }
// VirtualMachineScaleSetSku is describes an available virtual machine scale // VirtualMachineScaleSetSku is describes an available virtual machine scale
@ -1052,7 +1052,7 @@ type VirtualMachineScaleSetVM struct {
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
InstanceID *string `json:"instanceId,omitempty"` InstanceID *string `json:"instanceId,omitempty"`
Sku *Sku `json:"sku,omitempty"` Sku *Sku `json:"sku,omitempty"`
Properties *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"`
Plan *Plan `json:"plan,omitempty"` Plan *Plan `json:"plan,omitempty"`
Resources *[]VirtualMachineExtension `json:"resources,omitempty"` Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
} }
@ -1064,14 +1064,14 @@ type VirtualMachineScaleSetVMExtensionsSummary struct {
StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"`
} }
// VirtualMachineScaleSetVMInstanceIDs is specifies the list of virtual // VirtualMachineScaleSetVMInstanceIDs is specifies a list of virtual machine
// machine scale set instance IDs. // instance IDs from the VM scale set.
type VirtualMachineScaleSetVMInstanceIDs struct { type VirtualMachineScaleSetVMInstanceIDs struct {
InstanceIds *[]string `json:"instanceIds,omitempty"` InstanceIds *[]string `json:"instanceIds,omitempty"`
} }
// VirtualMachineScaleSetVMInstanceRequiredIDs is specifies the list of // VirtualMachineScaleSetVMInstanceRequiredIDs is specifies a list of virtual
// virtual machine scale set instance IDs. // machine instance IDs from the VM scale set.
type VirtualMachineScaleSetVMInstanceRequiredIDs struct { type VirtualMachineScaleSetVMInstanceRequiredIDs struct {
InstanceIds *[]string `json:"instanceIds,omitempty"` InstanceIds *[]string `json:"instanceIds,omitempty"`
} }

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -41,10 +42,18 @@ func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string)
return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// List lists compute usages for a subscription. // List gets, for the specified location, the current compute resource usage
// information as well as the limits for compute resources under the
// subscription.
// //
// location is the location upon which resource usage is queried. // location is the location for which resource usage is queried.
func (client UsageOperationsClient) List(location string) (result ListUsagesResult, err error) { func (client UsageOperationsClient) List(location string) (result ListUsagesResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.UsageOperationsClient", "List")
}
req, err := client.ListPreparer(location) req, err := client.ListPreparer(location)
if err != nil { 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")
@ -106,7 +115,7 @@ func (client UsageOperationsClient) ListResponder(resp *http.Response) (result L
func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) { func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
req, err := lastResults.ListUsagesResultPreparer() req, err := lastResults.ListUsagesResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -115,12 +124,12 @@ func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -23,9 +23,9 @@ import (
) )
const ( const (
major = "3" major = "7"
minor = "2" minor = "0"
patch = "0" patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org) // Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta" tag = "-beta"
semVerFormat = "%s.%s.%s%s" semVerFormat = "%s.%s.%s%s"

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -52,6 +53,13 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID
// extensionParameters is parameters supplied to the Create Virtual Machine // extensionParameters is parameters supplied to the Create Virtual Machine
// Extension operation. // Extension operation.
func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: extensionParameters,
Constraints: []validation.Constraint{{Target: "extensionParameters.VirtualMachineExtensionProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "extensionParameters.VirtualMachineExtensionProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters, cancel)
if err != nil { 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")

View File

@ -43,6 +43,9 @@ func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID str
// Get gets a virtual machine image. // Get gets a virtual machine image.
// //
// location is the name of a supported Azure region. publisherName is a valid
// image publisher. offer is a valid image publisher offer. skus is a valid
// image SKU. version is a valid image SKU version.
func (client VirtualMachineImagesClient) Get(location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err 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) req, err := client.GetPreparer(location, publisherName, offer, skus, version)
if err != nil { if err != nil {
@ -105,9 +108,12 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu
return return
} }
// List gets a list of virtual machine images. // List gets a list of all virtual machine image versions for the specified
// location, publisher, offer, and SKU.
// //
// filter is the filter to apply on the operation. // location is the name of a supported Azure region. publisherName is a valid
// image publisher. offer is a valid image publisher offer. skus is a valid
// image SKU. filter is the filter to apply on the operation.
func (client VirtualMachineImagesClient) List(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err 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) req, err := client.ListPreparer(location, publisherName, offer, skus, filter, top, orderby)
if err != nil { if err != nil {
@ -178,8 +184,11 @@ func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (res
return return
} }
// ListOffers gets a list of virtual machine image offers. // ListOffers gets a list of virtual machine image offers for the specified
// location and publisher.
// //
// location is the name of a supported Azure region. publisherName is a valid
// image publisher.
func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) { func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListOffersPreparer(location, publisherName) req, err := client.ListOffersPreparer(location, publisherName)
if err != nil { if err != nil {
@ -239,8 +248,10 @@ func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response
return return
} }
// ListPublishers gets a list of virtual machine image publishers. // ListPublishers gets a list of virtual machine image publishers for the
// specified Azure location.
// //
// location is the name of a supported Azure region.
func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) { func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListPublishersPreparer(location) req, err := client.ListPublishersPreparer(location)
if err != nil { if err != nil {
@ -299,8 +310,11 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp
return return
} }
// ListSkus gets a list of virtual machine image skus. // ListSkus gets a list of virtual machine image SKUs for the specified
// location, publisher, and offer.
// //
// location is the name of a supported Azure region. publisherName is a valid
// image publisher. offer is a valid image publisher offer.
func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListSkusPreparer(location, publisherName, offer) req, err := client.ListSkusPreparer(location, publisherName, offer)
if err != nil { if err != nil {

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -51,6 +52,14 @@ func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string)
// the virtual machine. parameters is parameters supplied to the Capture // the virtual machine. parameters is parameters supplied to the Capture
// Virtual Machine operation. // Virtual Machine operation.
func (client VirtualMachinesClient) Capture(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachinesClient) Capture(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "Capture")
}
req, err := client.CapturePreparer(resourceGroupName, vmName, parameters, cancel) req, err := client.CapturePreparer(resourceGroupName, vmName, parameters, cancel)
if err != nil { 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")
@ -121,6 +130,33 @@ func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (resul
// the virtual machine. parameters is parameters supplied to the Create // the virtual machine. parameters is parameters supplied to the Create
// Virtual Machine operation. // Virtual Machine operation.
func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
}},
{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.Vhd", Name: validation.Null, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.VirtualMachineProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.InstanceView", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.VMID", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
{Target: "parameters.Resources", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, parameters, cancel)
if err != nil { 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")
@ -182,9 +218,9 @@ func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response)
return return
} }
// Deallocate shuts down the Virtual Machine and releases the compute // Deallocate shuts down the virtual machine and releases the compute
// resources. You are not billed for the compute resources that this Virtual // resources. You are not billed for the compute resources that this virtual
// Machine uses. This method may poll for completion. Polling can be canceled // 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 // by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
@ -317,7 +353,7 @@ func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result
return return
} }
// Generalize sets the state of the VM as Generalized. // Generalize sets the state of the virtual machine to generalized.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.
@ -379,7 +415,8 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re
return return
} }
// Get the operation to get a virtual machine. // Get retrieves information about the model view or the instance view of a
// virtual machine.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // 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 // the virtual machine. expand is the expand expression to apply on the
@ -446,7 +483,9 @@ func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result Vi
return return
} }
// List the operation to list virtual machines under a resource group. // List lists all of the virtual machines in the specified resource group. Use
// the nextLink property in the response to get the next page of virtual
// machines.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, err error) { func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, err error) {
@ -511,7 +550,7 @@ func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result V
func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
req, err := lastResults.VirtualMachineListResultPreparer() req, err := lastResults.VirtualMachineListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -520,20 +559,20 @@ func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineLi
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll gets the list of Virtual Machines in the subscription. Use nextLink // ListAll lists all of the virtual machines in the specified subscription.
// property in the response to get the next page of Virtual Machines. Do this // Use the nextLink property in the response to get the next page of virtual
// till nextLink is not null to fetch all the Virtual Machines. // machines.
func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) { func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -595,7 +634,7 @@ func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (resul
func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
req, err := lastResults.VirtualMachineListResultPreparer() req, err := lastResults.VirtualMachineListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -604,19 +643,19 @@ func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachin
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAvailableSizes lists all available virtual machine sizes it can be // ListAvailableSizes lists all available virtual machine sizes to which the
// resized to for a virtual machine. // specified virtual machine can be resized.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.
@ -679,10 +718,12 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo
return return
} }
// PowerOff the operation to power off (stop) a virtual machine. This method // PowerOff the operation to power off (stop) a virtual machine. The virtual
// may poll for completion. Polling can be canceled by passing the cancel // machine can be restarted with the same provisioned resources. You are
// channel argument. The channel will be used to cancel polling and any // still charged for this virtual machine. This method may poll for
// outstanding HTTP requests. // 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 // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -41,16 +42,28 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID
return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate allows you to create or update a virtual machine scale set // CreateOrUpdate create or update a VM scale set. This method may poll for
// by providing parameters or a path to pre-configured parameter file. This // completion. Polling can be canceled by passing the cancel channel
// method may poll for completion. Polling can be canceled by passing the // argument. The channel will be used to cancel polling and any outstanding
// cancel channel argument. The channel will be used to cancel polling and // HTTP requests.
// any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. name is parameters // resourceGroupName is the name of the resource group. name is the name of
// supplied to the Create Virtual Machine Scale Set operation. parameters is // the VM scale set to create or update. parameters is the scale set object.
// parameters supplied to the Create Virtual Machine Scale Set operation.
func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.VirtualMachineProfile", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.VirtualMachineProfile.StorageProfile", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.VirtualMachineProfile.StorageProfile.OsDisk", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualMachineScaleSetProperties.VirtualMachineProfile.StorageProfile.OsDisk.Name", Name: validation.Null, Rule: true, Chain: nil}}},
}},
}},
{Target: "parameters.VirtualMachineScaleSetProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters, cancel)
if err != nil { 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")
@ -112,16 +125,16 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R
return return
} }
// Deallocate allows you to deallocate virtual machines in a virtual machine // Deallocate deallocates specific virtual machines in a VM scale set. Shuts
// scale set. Shuts down the virtual machines and releases the compute // down the virtual machines and releases the compute resources. You are not
// resources. You are not billed for the compute resources that this virtual // billed for the compute resources that this virtual machine scale set
// machine scale set uses. This method may poll for completion. Polling can // deallocates. This method may poll for completion. Polling can be canceled
// be canceled by passing the cancel channel argument. The channel will be // by passing the cancel channel argument. The channel will be used to cancel
// used to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { if err != nil {
@ -187,13 +200,12 @@ func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Respo
return return
} }
// Delete allows you to delete a virtual machine scale set. This method may // Delete deletes a VM scale set. This method may poll for completion. Polling
// poll for completion. Polling can be canceled by passing the cancel channel // can be canceled by passing the cancel channel argument. The channel will
// argument. The channel will be used to cancel polling and any outstanding // be used to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. // name of the VM scale set.
func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, cancel) req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, cancel)
if err != nil { if err != nil {
@ -254,15 +266,21 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response)
return return
} }
// DeleteInstances allows you to delete virtual machines in a virtual machine // DeleteInstances deletes virtual machines in a VM scale set. This method may
// scale set. This method may poll for completion. Polling can be canceled by // poll for completion. Polling can be canceled by passing the cancel channel
// passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: vmInstanceIDs,
Constraints: []validation.Constraint{{Target: "vmInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances")
}
req, err := client.DeleteInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel) req, err := client.DeleteInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { 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")
@ -327,7 +345,7 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.
// Get display information about a virtual machine scale set. // Get display information about a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. // name of the VM scale set.
func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSet, err error) { func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSet, err error) {
req, err := client.GetPreparer(resourceGroupName, vmScaleSetName) req, err := client.GetPreparer(resourceGroupName, vmScaleSetName)
if err != nil { if err != nil {
@ -387,10 +405,10 @@ func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (r
return return
} }
// GetInstanceView displays status of a virtual machine scale set instance. // GetInstanceView gets the status of a VM scale set instance.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. // name of the VM scale set.
func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) { func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) {
req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName) req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName)
if err != nil { if err != nil {
@ -450,7 +468,7 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.
return return
} }
// List lists all virtual machine scale sets under a resource group. // List gets a list of all VM scale sets under a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) { func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) {
@ -515,7 +533,7 @@ func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (
func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) { func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListResultPreparer() req, err := lastResults.VirtualMachineScaleSetListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -524,21 +542,21 @@ func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualM
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll lists all Virtual Machine Scale Sets in the subscription. Use // ListAll gets a list of all VM Scale Sets in the subscription, regardless of
// nextLink property in the response to get the next page of Virtual Machine // the associated resource group. Use nextLink property in the response to
// Scale Sets. Do this till nextLink is not null to fetch all the Virtual // get the next page of VM Scale Sets. Do this till nextLink is not null to
// Machine Scale Sets. // fetch all the VM Scale Sets.
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) { func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -600,7 +618,7 @@ func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response
func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) { func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer() req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -609,23 +627,22 @@ func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults Virtu
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListSkus displays available skus for your virtual machine scale set // ListSkus gets a list of SKUs available for your VM scale set, including the
// including the minimum and maximum vm instances allowed for a particular // minimum and maximum VM instances allowed for each SKU.
// sku.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. // name of the VM scale set.
func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) { func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, vmScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) {
req, err := client.ListSkusPreparer(resourceGroupName, vmScaleSetName) req, err := client.ListSkusPreparer(resourceGroupName, vmScaleSetName)
if err != nil { if err != nil {
@ -689,7 +706,7 @@ func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Respons
func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) { func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) {
req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer() req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -698,27 +715,27 @@ func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults Virt
resp, err := client.ListSkusSender(req) resp, err := client.ListSkusSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListSkusResponder(resp) result, err = client.ListSkusResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// PowerOff allows you to power off (stop) virtual machines in a virtual // PowerOff power off (stop) one or more virtual machines in a VM scale set.
// machine scale set. Note that resources are still attached and you are // Note that resources are still attached and you are getting charged for the
// getting charged for the resources. Use deallocate to release resources. // resources. Instead, use deallocate to release resources and avoid charges.
// This method may poll for completion. Polling can be canceled by passing // This method may poll for completion. Polling can be canceled by passing
// the cancel channel argument. The channel will be used to cancel polling // the cancel channel argument. The channel will be used to cancel polling
// and any outstanding HTTP requests. // and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { if err != nil {
@ -784,14 +801,13 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons
return return
} }
// Reimage allows you to re-image(update the version of the installed // Reimage reimages (upgrade the operating system) one or more virtual
// operating system) virtual machines in a virtual machine scale set. This // machines in a VM scale set. This method may poll for completion. Polling
// method may poll for completion. Polling can be canceled by passing the // can be canceled by passing the cancel channel argument. The channel will
// cancel channel argument. The channel will be used to cancel polling and // be used to cancel polling and any outstanding HTTP requests.
// any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. // name of the VM scale set.
func (client VirtualMachineScaleSetsClient) Reimage(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetsClient) Reimage(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, cancel) req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, cancel)
if err != nil { if err != nil {
@ -852,14 +868,14 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response
return return
} }
// Restart allows you to restart virtual machines in a virtual machine scale // Restart restarts one or more virtual machines in a VM scale set. This
// set. This method may poll for completion. Polling can be canceled by // method may poll for completion. Polling can be canceled by passing the
// passing the cancel channel argument. The channel will be used to cancel // cancel channel argument. The channel will be used to cancel polling and
// polling and any outstanding HTTP requests. // any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { if err != nil {
@ -925,14 +941,14 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response
return return
} }
// Start allows you to start virtual machines in a virtual machine scale set. // Start starts one or more virtual machines in a VM scale set. This method
// This method may poll for completion. Polling can be canceled by passing // may poll for completion. Polling can be canceled by passing the cancel
// the cancel channel argument. The channel will be used to cancel polling // channel argument. The channel will be used to cancel polling and any
// and any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { if err != nil {
@ -998,15 +1014,21 @@ func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response)
return return
} }
// UpdateInstances allows you to manually upgrade virtual machines in a // UpdateInstances upgrades one or more virtual machines to the latest SKU set
// virtual machine scale set. This method may poll for completion. Polling // in the VM scale set model. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will // can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests. // be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. vmInstanceIDs is the list of // name of the VM scale set. vmInstanceIDs is a list of virtual machine
// virtual machine scale set instance IDs. // instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: vmInstanceIDs,
Constraints: []validation.Constraint{{Target: "vmInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances")
}
req, err := client.UpdateInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel) req, err := client.UpdateInstancesPreparer(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancel)
if err != nil { 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")

View File

@ -41,16 +41,16 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// Deallocate allows you to deallocate a virtual machine scale set virtual // Deallocate deallocates a specific virtual machine in a VM scale set. Shuts
// machine. Shuts down the virtual machine and releases the compute // down the virtual machine and releases the compute resources it uses. You
// resources. You are not billed for the compute resources that this virtual // are not billed for the compute resources of this virtual machine once it
// machine uses. This method may poll for completion. Polling can be canceled // is deallocated. This method may poll for completion. Polling can be
// by passing the cancel channel argument. The channel will be used to cancel // canceled by passing the cancel channel argument. The channel will be used
// polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.DeallocatePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {
@ -112,14 +112,14 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res
return return
} }
// Delete allows you to delete a virtual machine scale set. This method may // Delete deletes a virtual machine from a VM scale set. This method may poll
// poll for completion. Polling can be canceled by passing the cancel channel // for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.DeletePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {
@ -181,11 +181,11 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons
return return
} }
// Get displays information about a virtual machine scale set virtual machine. // Get gets a virtual machine from a VM scale set.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) {
req, err := client.GetPreparer(resourceGroupName, vmScaleSetName, instanceID) req, err := client.GetPreparer(resourceGroupName, vmScaleSetName, instanceID)
if err != nil { if err != nil {
@ -246,12 +246,11 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response)
return return
} }
// GetInstanceView displays the status of a virtual machine scale set virtual // GetInstanceView gets the status of a virtual machine from a VM scale set.
// machine.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, vmScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) {
req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName, instanceID) req, err := client.GetInstanceViewPreparer(resourceGroupName, vmScaleSetName, instanceID)
if err != nil { if err != nil {
@ -312,13 +311,12 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *htt
return return
} }
// List lists all virtual machines in a VM scale sets. // List gets a list of all virtual machines in a VM scale sets.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set. // virtualMachineScaleSetName is the name of the VM scale set. filter is the
// filter is the filter to apply on the operation. selectParameter is the // filter to apply to the operation. selectParameter is the list parameters.
// list parameters. expand is the expand expression to apply on the // expand is the expand expression to apply to the operation.
// operation.
func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, err 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) req, err := client.ListPreparer(resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand)
if err != nil { if err != nil {
@ -391,7 +389,7 @@ func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response)
func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) { func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) {
req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer() req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -400,25 +398,27 @@ func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults Virtua
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// PowerOff allows you to power off (stop) a virtual machine in a VM scale // PowerOff power off (stop) a virtual machine in a VM scale set. Note that
// set. This method may poll for completion. Polling can be canceled by // resources are still attached and you are getting charged for the
// passing the cancel channel argument. The channel will be used to cancel // resources. Instead, use deallocate to release resources and avoid charges.
// polling and any outstanding HTTP requests. // 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 // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.PowerOffPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {
@ -480,15 +480,14 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo
return return
} }
// Reimage allows you to re-image(update the version of the installed // Reimage reimages (upgrade the operating system) a specific virtual machine
// operating system) a virtual machine scale set instance. This method may // in a VM scale set. This method may poll for completion. Polling can be
// poll for completion. Polling can be canceled by passing the cancel channel // canceled by passing the cancel channel argument. The channel will be used
// argument. The channel will be used to cancel polling and any outstanding // to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel) req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {
@ -550,14 +549,14 @@ func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Respon
return return
} }
// Restart allows you to restart a virtual machine in a VM scale set. This // Restart restarts a virtual machine in a VM scale set. This method may poll
// method may poll for completion. Polling can be canceled by passing the // for completion. Polling can be canceled by passing the cancel channel
// cancel channel argument. The channel will be used to cancel polling and // argument. The channel will be used to cancel polling and any outstanding
// any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.RestartPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {
@ -619,14 +618,14 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon
return return
} }
// Start allows you to start a virtual machine in a VM scale set. This method // Start starts a virtual machine in a VM scale set. This method may poll for
// may poll for completion. Polling can be canceled by passing the cancel // completion. Polling can be canceled by passing the cancel channel
// channel argument. The channel will be used to cancel polling and any // argument. The channel will be used to cancel polling and any outstanding
// outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the virtual machine scale set. instanceID is the instance id of // name of the VM scale set. instanceID is the instance ID of the virtual
// the virtual machine. // machine.
func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.StartPreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
if err != nil { if err != nil {

View File

@ -21,6 +21,7 @@ package compute
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -46,6 +47,12 @@ func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID stri
// //
// location is the location upon which virtual-machine-sizes is queried. // location is the location upon which virtual-machine-sizes is queried.
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) { func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineSizesClient", "List")
}
req, err := client.ListPreparer(location) req, err := client.ListPreparer(location)
if err != nil { 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")

View File

@ -0,0 +1,57 @@
// Package containerregistry implements the Azure ARM Containerregistry
// service API version 2016-06-27-preview.
//
package containerregistry
// 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.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// APIVersion is the version of the Containerregistry
APIVersion = "2016-06-27-preview"
// DefaultBaseURI is the default URI used for the service Containerregistry
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Containerregistry.
type ManagementClient struct {
autorest.Client
BaseURI string
APIVersion 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,
APIVersion: APIVersion,
SubscriptionID: subscriptionID,
}
}

View File

@ -0,0 +1,118 @@
package containerregistry
// 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.17.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/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// Registry is an object that represents a container registry.
type Registry struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*RegistryProperties `json:"properties,omitempty"`
}
// RegistryCredentials is the result of a request to get the administrator
// login credentials for a container registry.
type RegistryCredentials struct {
autorest.Response `json:"-"`
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
}
// RegistryListResult is the result of a request to list container registries.
type RegistryListResult struct {
autorest.Response `json:"-"`
Value *[]Registry `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// RegistryListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client RegistryListResult) RegistryListResultPreparer() (*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)))
}
// RegistryNameCheckRequest is a request to check whether the container
// registry name is available.
type RegistryNameCheckRequest struct {
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// RegistryNameStatus is the result of a request to check the availability of
// a container registry name.
type RegistryNameStatus struct {
autorest.Response `json:"-"`
NameAvailable *bool `json:"nameAvailable,omitempty"`
Reason *string `json:"reason,omitempty"`
Message *string `json:"message,omitempty"`
}
// RegistryProperties is the properties of a container registry.
type RegistryProperties struct {
LoginServer *string `json:"loginServer,omitempty"`
CreationDate *date.Time `json:"creationDate,omitempty"`
AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
}
// RegistryPropertiesUpdateParameters is the parameters for updating the
// properties of a container registry.
type RegistryPropertiesUpdateParameters struct {
AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
}
// RegistryUpdateParameters is the parameters for updating a container
// registry.
type RegistryUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
*RegistryPropertiesUpdateParameters `json:"properties,omitempty"`
}
// Resource is an Azure resource.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// StorageAccountProperties is the properties of a storage account for a
// container registry.
type StorageAccountProperties struct {
Name *string `json:"name,omitempty"`
AccessKey *string `json:"accessKey,omitempty"`
}

View File

@ -0,0 +1,685 @@
package containerregistry
// 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.17.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"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// RegistriesClient is the client for the Registries methods of the
// Containerregistry service.
type RegistriesClient struct {
ManagementClient
}
// NewRegistriesClient creates an instance of the RegistriesClient client.
func NewRegistriesClient(subscriptionID string) RegistriesClient {
return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient
// client.
func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient {
return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CheckNameAvailability checks whether the container registry name is
// available for use. The name must contain only alphanumeric characters, be
// globally unique, and between 5 and 60 characters in length.
//
// registryNameCheckRequest is the object containing information for the
// availability request.
func (client RegistriesClient) CheckNameAvailability(registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: registryNameCheckRequest,
Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CheckNameAvailability")
}
req, err := client.CheckNameAvailabilityPreparer(registryNameCheckRequest)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request")
}
resp, err := client.CheckNameAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request")
}
result, err = client.CheckNameAvailabilityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request")
}
return
}
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
func (client RegistriesClient) CheckNameAvailabilityPreparer(registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters),
autorest.WithJSON(registryNameCheckRequest),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
// closes the http.Response Body.
func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateOrUpdate creates or updates a container registry with the specified
// parameters.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
// registry is the parameters for creating or updating a container registry.
func (client RegistriesClient) CreateOrUpdate(resourceGroupName string, registryName string, registry Registry) (result Registry, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: registry,
Constraints: []validation.Constraint{{Target: "registry.RegistryProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "registry.RegistryProperties.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil},
}},
{Target: "registry.RegistryProperties.LoginServer", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "registry.RegistryProperties.CreationDate", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, registryName, registry)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RegistriesClient) CreateOrUpdatePreparer(resourceGroupName string, registryName string, registry Registry) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
autorest.WithJSON(registry),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result Registry, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a container registry.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
func (client RegistriesClient) Delete(resourceGroupName string, registryName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, registryName)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client RegistriesClient) DeletePreparer(resourceGroupName string, registryName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// GetCredentials gets the administrator login credentials for the specified
// container registry.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
func (client RegistriesClient) GetCredentials(resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
req, err := client.GetCredentialsPreparer(resourceGroupName, registryName)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", nil, "Failure preparing request")
}
resp, err := client.GetCredentialsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure sending request")
}
result, err = client.GetCredentialsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure responding to request")
}
return
}
// GetCredentialsPreparer prepares the GetCredentials request.
func (client RegistriesClient) GetCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getCredentials", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetCredentialsSender sends the GetCredentials request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) GetCredentialsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetCredentialsResponder handles the response to the GetCredentials request. The method always
// closes the http.Response Body.
func (client RegistriesClient) GetCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetProperties gets the properties of the specified container registry.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
func (client RegistriesClient) GetProperties(resourceGroupName string, registryName string) (result Registry, err error) {
req, err := client.GetPropertiesPreparer(resourceGroupName, registryName)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", nil, "Failure preparing request")
}
resp, err := client.GetPropertiesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure sending request")
}
result, err = client.GetPropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure responding to request")
}
return
}
// GetPropertiesPreparer prepares the GetProperties request.
func (client RegistriesClient) GetPropertiesPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetPropertiesSender sends the GetProperties request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetPropertiesResponder handles the response to the GetProperties request. The method always
// closes the http.Response Body.
func (client RegistriesClient) GetPropertiesResponder(resp *http.Response) (result Registry, 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 lists all the available container registries under the specified
// subscription.
func (client RegistriesClient) List() (result RegistryListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client RegistriesClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) ListNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
req, err := lastResults.RegistryListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroup lists all the available container registries under the
// specified resource group.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs.
func (client RegistriesClient) ListByResourceGroup(resourceGroupName string) (result RegistryListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request")
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client RegistriesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client RegistriesClient) ListByResourceGroupNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
req, err := lastResults.RegistryListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// RegenerateCredentials regenerates the administrator login credentials for
// the specified container registry.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
func (client RegistriesClient) RegenerateCredentials(resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
req, err := client.RegenerateCredentialsPreparer(resourceGroupName, registryName)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", nil, "Failure preparing request")
}
resp, err := client.RegenerateCredentialsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure sending request")
}
result, err = client.RegenerateCredentialsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure responding to request")
}
return
}
// RegenerateCredentialsPreparer prepares the RegenerateCredentials request.
func (client RegistriesClient) RegenerateCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredentials", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// RegenerateCredentialsSender sends the RegenerateCredentials request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) RegenerateCredentialsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RegenerateCredentialsResponder handles the response to the RegenerateCredentials request. The method always
// closes the http.Response Body.
func (client RegistriesClient) RegenerateCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Update updates a container registry with the specified parameters.
//
// resourceGroupName is the name of the resource group to which the container
// registry belongs. registryName is the name of the container registry.
// registryUpdateParameters is the parameters for updating a container
// registry.
func (client RegistriesClient) Update(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) {
req, err := client.UpdatePreparer(resourceGroupName, registryName, registryUpdateParameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request")
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client RegistriesClient) UpdatePreparer(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"registryName": autorest.Encode("path", registryName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
autorest.WithJSON(registryUpdateParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client RegistriesClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -0,0 +1,43 @@
package containerregistry
// 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.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"fmt"
)
const (
major = "7"
minor = "0"
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(), "containerregistry", "2016-06-27-preview")
}
// 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

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// ApplicationGatewaysClient is the the Microsoft Azure Network management API // ApplicationGatewaysClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type ApplicationGatewaysClient struct { type ApplicationGatewaysClient struct {
@ -45,15 +46,96 @@ func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID stri
return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put ApplicationGateway operation creates/updates a // BackendHealth gets the backend health of the specified application gateway
// ApplicationGateway This method may poll for completion. Polling can be // in a resource group. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used // canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName // resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the ApplicationGateway. parameters is parameters supplied // is the name of the application gateway. expand is expands
// to the create/delete ApplicationGateway operation // BackendAddressPool and BackendHttpSettings referenced in backend health.
func (client ApplicationGatewaysClient) BackendHealth(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.BackendHealthPreparer(resourceGroupName, applicationGatewayName, expand, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request")
}
resp, err := client.BackendHealthSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure sending request")
}
result, err = client.BackendHealthResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure responding to request")
}
return
}
// BackendHealthPreparer prepares the BackendHealth request.
func (client ApplicationGatewaysClient) BackendHealthPreparer(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// BackendHealthSender sends the BackendHealth request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// BackendHealthResponder handles the response to the BackendHealth request. The method always
// closes the http.Response Body.
func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// CreateOrUpdate creates or updates the specified application gateway. 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. parameters is parameters supplied
// to the create or update application gateway operation.
func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.ApplicationGatewayPropertiesFormat.OperationalState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel)
if err != nil { 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")
@ -115,13 +197,13 @@ func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Respo
return return
} }
// Delete the delete applicationgateway operation deletes the specified // Delete deletes the specified application gateway. This method may poll for
// applicationgateway. This method may poll for completion. Polling can be // completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName // resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the applicationgateway. // is the name of the application gateway.
func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel) req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel)
if err != nil { if err != nil {
@ -182,11 +264,10 @@ func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (re
return return
} }
// Get the Get applicationgateway operation retreives information about the // Get gets the specified application gateway.
// specified applicationgateway.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName // resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the applicationgateway. // is the name of the application gateway.
func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
req, err := client.GetPreparer(resourceGroupName, applicationGatewayName) req, err := client.GetPreparer(resourceGroupName, applicationGatewayName)
if err != nil { if err != nil {
@ -246,8 +327,7 @@ func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (resul
return return
} }
// List the List ApplicationGateway operation retrieves all the // List lists all application gateways in a resource group.
// applicationgateways in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) { func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) {
@ -312,7 +392,7 @@ func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (resu
func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
req, err := lastResults.ApplicationGatewayListResultPreparer() req, err := lastResults.ApplicationGatewayListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -321,19 +401,18 @@ func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationG
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the List applicationgateway operation retrieves all the // ListAll gets all the application gateways in a subscription.
// applicationgateways in a subscription.
func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) { func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -395,7 +474,7 @@ func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (r
func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
req, err := lastResults.ApplicationGatewayListResultPreparer() req, err := lastResults.ApplicationGatewayListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -404,22 +483,21 @@ func (client ApplicationGatewaysClient) ListAllNextResults(lastResults Applicati
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// Start the Start ApplicationGateway operation starts application gatewayin // Start starts the specified application gateway. This method may poll for
// the specified resource group through Network resource provider. This // completion. Polling can be canceled by passing the cancel channel
// method may poll for completion. Polling can be canceled by passing the // argument. The channel will be used to cancel polling and any outstanding
// cancel channel argument. The channel will be used to cancel polling and // HTTP requests.
// any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName // resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the application gateway. // is the name of the application gateway.
@ -483,11 +561,10 @@ func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (res
return return
} }
// Stop the STOP ApplicationGateway operation stops application gatewayin the // Stop stops the specified application gateway in a resource group. This
// specified resource group through Network resource provider. This method // method may poll for completion. Polling can be canceled by passing the
// may poll for completion. Polling can be canceled by passing the cancel // cancel channel argument. The channel will be used to cancel polling and
// channel argument. The channel will be used to cancel polling and any // any outstanding HTTP requests.
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName // resourceGroupName is the name of the resource group. applicationGatewayName
// is the name of the application gateway. // is the name of the application gateway.

View File

@ -1,10 +1,10 @@
// Package network implements the Azure ARM Network service API version // Package network implements the Azure ARM Network service API version
// 2016-06-01. // 2016-09-01.
// //
// The Microsoft Azure Network management API provides a RESTful set of web // The Microsoft Azure Network management API provides a RESTful set of web
// services that interact with Microsoft Azure Networks service to manage // services that interact with Microsoft Azure Networks service to manage
// your network resrources. The API has entities that capture the // your network resources. The API has entities that capture the relationship
// relationship between an end user and the Microsoft Azure Networks service. // between an end user and the Microsoft Azure Networks service.
package network package network
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
@ -33,7 +33,7 @@ import (
const ( const (
// APIVersion is the version of the Network // APIVersion is the version of the Network
APIVersion = "2016-06-01" APIVersion = "2016-09-01"
// DefaultBaseURI is the default URI used for the service Network // DefaultBaseURI is the default URI used for the service Network
DefaultBaseURI = "https://management.azure.com" DefaultBaseURI = "https://management.azure.com"
@ -65,7 +65,7 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
// CheckDNSNameAvailability checks whether a domain name in the cloudapp.net // CheckDNSNameAvailability checks whether a domain name in the cloudapp.net
// zone is available for use. // zone is available for use.
// //
// location is the location of the domain name domainNameLabel is the domain // location is the location of the domain name. domainNameLabel is the domain
// name to be verified. It must conform to the following regular expression: // name to be verified. It must conform to the following regular expression:
// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. // ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {

View File

@ -26,8 +26,8 @@ import (
// ExpressRouteCircuitAuthorizationsClient is the the Microsoft Azure Network // ExpressRouteCircuitAuthorizationsClient is the the Microsoft Azure Network
// management API provides a RESTful set of web services that interact with // management API provides a RESTful set of web services that interact with
// Microsoft Azure Networks service to manage your network resrources. The // Microsoft Azure Networks service to manage your network resources. The API
// API has entities that capture the relationship between an end user and the // has entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type ExpressRouteCircuitAuthorizationsClient struct { type ExpressRouteCircuitAuthorizationsClient struct {
ManagementClient ManagementClient
@ -45,16 +45,15 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc
return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put Authorization operation creates/updates an // CreateOrUpdate creates or updates an authorization in the specified express
// authorization in thespecified ExpressRouteCircuits This method may poll // route circuit. This method may poll for completion. Polling can be
// for completion. Polling can be canceled by passing the cancel channel // canceled by passing the cancel channel argument. The channel will be used
// argument. The channel will be used to cancel polling and any outstanding // to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. authorizationName is the name of the // name of the express route circuit. authorizationName is the name of the
// authorization. authorizationParameters is parameters supplied to the // authorization. authorizationParameters is parameters supplied to the
// create/update ExpressRouteCircuitAuthorization operation // create or update express route circuit authorization operation.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel)
if err != nil { if err != nil {
@ -118,11 +117,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(re
return return
} }
// Delete the delete authorization operation deletes the specified // Delete deletes the specified authorization from the specified express route
// authorization from the specified ExpressRouteCircuit. This method may poll // circuit. This method may poll for completion. Polling can be canceled by
// for completion. Polling can be canceled by passing the cancel channel // passing the cancel channel argument. The channel will be used to cancel
// argument. The channel will be used to cancel polling and any outstanding // polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. authorizationName is the name of the // name of the express route circuit. authorizationName is the name of the
@ -188,8 +186,8 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http
return return
} }
// Get the GET authorization operation retrieves the specified authorization // Get gets the specified authorization from the specified express route
// from the specified ExpressRouteCircuit. // circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. authorizationName is the name of the // name of the express route circuit. authorizationName is the name of the
@ -254,11 +252,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Re
return return
} }
// List the List authorization operation retrieves all the authorizations in // List gets all authorizations in an express route circuit.
// an ExpressRouteCircuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the curcuit. // name of the circuit.
func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) { func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName) req, err := client.ListPreparer(resourceGroupName, circuitName)
if err != nil { if err != nil {
@ -322,7 +319,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.R
func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) { func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) {
req, err := lastResults.AuthorizationListResultPreparer() req, err := lastResults.AuthorizationListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -331,12 +328,12 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResult
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -26,8 +26,8 @@ import (
// ExpressRouteCircuitPeeringsClient is the the Microsoft Azure Network // ExpressRouteCircuitPeeringsClient is the the Microsoft Azure Network
// management API provides a RESTful set of web services that interact with // management API provides a RESTful set of web services that interact with
// Microsoft Azure Networks service to manage your network resrources. The // Microsoft Azure Networks service to manage your network resources. The API
// API has entities that capture the relationship between an end user and the // has entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type ExpressRouteCircuitPeeringsClient struct { type ExpressRouteCircuitPeeringsClient struct {
ManagementClient ManagementClient
@ -45,15 +45,15 @@ func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptio
return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put Pering operation creates/updates an peering in the // CreateOrUpdate creates or updates a peering in the specified express route
// specified ExpressRouteCircuits This method may poll for completion. // circuits. This method may poll for completion. Polling can be canceled by
// Polling can be canceled by passing the cancel channel argument. The // passing the cancel channel argument. The channel will be used to cancel
// channel will be used to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. peeringName is the name of the peering. // name of the express route circuit. peeringName is the name of the peering.
// peeringParameters is parameters supplied to the create/update // peeringParameters is parameters supplied to the create or update express
// ExpressRouteCircuit Peering operation // route circuit peering operation.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel)
if err != nil { if err != nil {
@ -117,10 +117,10 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *ht
return return
} }
// Delete the delete peering operation deletes the specified peering from the // Delete deletes the specified peering from the specified express route
// ExpressRouteCircuit. This method may poll for completion. Polling can be // circuit. This method may poll for completion. Polling can be canceled by
// canceled by passing the cancel channel argument. The channel will be used // passing the cancel channel argument. The channel will be used to cancel
// to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. peeringName is the name of the peering. // name of the express route circuit. peeringName is the name of the peering.
@ -185,8 +185,8 @@ func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Respo
return return
} }
// Get the GET peering operation retrieves the specified authorization from // Get gets the specified authorization from the specified express route
// the ExpressRouteCircuit. // circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route circuit. peeringName is the name of the peering. // name of the express route circuit. peeringName is the name of the peering.
@ -250,11 +250,10 @@ func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response
return return
} }
// List the List peering operation retrieves all the peerings in an // List gets all peerings in a specified express route circuit.
// ExpressRouteCircuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the curcuit. // name of the express route circuit.
func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) { func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName) req, err := client.ListPreparer(resourceGroupName, circuitName)
if err != nil { if err != nil {
@ -318,7 +317,7 @@ func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Respons
func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) { func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) {
req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer() req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -327,12 +326,12 @@ func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults Expr
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -26,7 +26,7 @@ import (
// ExpressRouteCircuitsClient is the the Microsoft Azure Network management // ExpressRouteCircuitsClient is the the Microsoft Azure Network management
// API provides a RESTful set of web services that interact with Microsoft // API provides a RESTful set of web services that interact with Microsoft
// Azure Networks service to manage your network resrources. The API has // Azure Networks service to manage your network resources. The API has
// entities that capture the relationship between an end user and the // entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type ExpressRouteCircuitsClient struct { type ExpressRouteCircuitsClient struct {
@ -45,14 +45,14 @@ func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID str
return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put ExpressRouteCircuit operation creates/updates a // CreateOrUpdate creates or updates an express route circuit. This method may
// ExpressRouteCircuit This method may poll for completion. Polling can be // poll for completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. parameters is parameters supplied to the // name of the circuit. parameters is parameters supplied to the create or
// create/delete ExpressRouteCircuit operation // update express route circuit operation.
func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel)
if err != nil { if err != nil {
@ -115,13 +115,13 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Resp
return return
} }
// Delete the delete ExpressRouteCircuit operation deletes the specified // Delete deletes the specified express route circuit. This method may poll
// ExpressRouteCircuit. This method may poll for completion. Polling can be // for completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the express route Circuit. // name of the express route circuit.
func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel) req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel)
if err != nil { if err != nil {
@ -182,11 +182,10 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
return return
} }
// Get the Get ExpressRouteCircuit operation retreives information about the // Get gets information about the specified express route circuit.
// specified ExpressRouteCircuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. // name of express route circuit.
func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName) req, err := client.GetPreparer(resourceGroupName, circuitName)
if err != nil { if err != nil {
@ -246,11 +245,11 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
return return
} }
// GetPeeringStats the Liststats ExpressRouteCircuit operation retrieves all // GetPeeringStats gets all stats from an express route circuit in a resource
// the stats from a ExpressRouteCircuits in a resource group. // group.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. peeringName is the name of the peering. // name of the express route circuit. peeringName is the name of the peering.
func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) {
req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName) req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName)
if err != nil { if err != nil {
@ -311,11 +310,11 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Res
return return
} }
// GetStats the Liststats ExpressRouteCircuit operation retrieves all the // GetStats gets all the stats from an express route circuit in a resource
// stats from a ExpressRouteCircuits in a resource group. // group.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. // name of the express route circuit.
func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) {
req, err := client.GetStatsPreparer(resourceGroupName, circuitName) req, err := client.GetStatsPreparer(resourceGroupName, circuitName)
if err != nil { if err != nil {
@ -375,8 +374,7 @@ func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response)
return return
} }
// List the List ExpressRouteCircuit operation retrieves all the // List gets all the express route circuits in a resource group.
// ExpressRouteCircuits in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) {
@ -441,7 +439,7 @@ func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (res
func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer() req, err := lastResults.ExpressRouteCircuitListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -450,19 +448,18 @@ func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRout
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the List ExpressRouteCircuit operation retrieves all the // ListAll gets all the express route circuits in a subscription.
// ExpressRouteCircuits in a subscription.
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -524,7 +521,7 @@ func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (
func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer() req, err := lastResults.ExpressRouteCircuitListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -533,27 +530,26 @@ func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressR
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListArpTable the ListArpTable from ExpressRouteCircuit operation retrieves // ListArpTable gets the currently advertised ARP table associated with the
// the currently advertised arp table associated with the // express route circuit in a resource group. This method may poll for
// ExpressRouteCircuits in a resource group. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. peeringName is the name of the peering. devicePath is // name of the express route circuit. peeringName is the name of the peering.
// the path of the device. // devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil { if err != nil {
@ -616,16 +612,15 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon
return return
} }
// ListRoutesTable the ListRoutesTable from ExpressRouteCircuit operation // ListRoutesTable gets the currently advertised routes table associated with
// retrieves the currently advertised routes table associated with the // the express route circuit in a resource group. This method may poll for
// ExpressRouteCircuits in a resource group. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. peeringName is the name of the peering. devicePath is // name of the express route circuit. peeringName is the name of the peering.
// the path of the device. // devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil { if err != nil {
@ -688,16 +683,15 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res
return return
} }
// ListRoutesTableSummary the ListRoutesTable from ExpressRouteCircuit // ListRoutesTableSummary gets the currently advertised routes table summary
// operation retrieves the currently advertised routes table associated with // associated with the express route circuit in a resource group. This method
// the ExpressRouteCircuits in a resource group. This method may poll for // may poll for completion. Polling can be canceled by passing the cancel
// completion. Polling can be canceled by passing the cancel channel // channel argument. The channel will be used to cancel polling and any
// argument. The channel will be used to cancel polling and any outstanding // outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the // resourceGroupName is the name of the resource group. circuitName is the
// name of the circuit. peeringName is the name of the peering. devicePath is // name of the express route circuit. peeringName is the name of the peering.
// the path of the device. // devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil { if err != nil {

View File

@ -26,8 +26,8 @@ import (
// ExpressRouteServiceProvidersClient is the the Microsoft Azure Network // ExpressRouteServiceProvidersClient is the the Microsoft Azure Network
// management API provides a RESTful set of web services that interact with // management API provides a RESTful set of web services that interact with
// Microsoft Azure Networks service to manage your network resrources. The // Microsoft Azure Networks service to manage your network resources. The API
// API has entities that capture the relationship between an end user and the // has entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type ExpressRouteServiceProvidersClient struct { type ExpressRouteServiceProvidersClient struct {
ManagementClient ManagementClient
@ -45,8 +45,7 @@ func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscripti
return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// List the List ExpressRouteServiceProvider operation retrieves all the // List gets all the available express route service providers.
// available ExpressRouteServiceProviders.
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) { func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) {
req, err := client.ListPreparer() req, err := client.ListPreparer()
if err != nil { if err != nil {
@ -108,7 +107,7 @@ func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Respon
func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) { func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) {
req, err := lastResults.ExpressRouteServiceProviderListResultPreparer() req, err := lastResults.ExpressRouteServiceProviderListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -117,12 +116,12 @@ func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults Exp
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// InterfacesClient is the the Microsoft Azure Network management API provides // InterfacesClient is the the Microsoft Azure Network management API provides
// a RESTful set of web services that interact with Microsoft Azure Networks // a RESTful set of web services that interact with Microsoft Azure Networks
// service to manage your network resrources. The API has entities that // service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure // capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type InterfacesClient struct { type InterfacesClient struct {
@ -44,15 +45,28 @@ func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) Inter
return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put NetworkInterface operation creates/updates a // CreateOrUpdate creates or updates a network interface. This method may poll
// networkInterface This method may poll for completion. Polling can be // for completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName // resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. parameters is parameters supplied to // is the name of the network interface. parameters is parameters supplied to
// the create/update NetworkInterface operation // the create or update network interface operation.
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) { func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.InterfacesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
if err != nil { 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")
@ -114,10 +128,10 @@ func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (res
return return
} }
// Delete the delete netwokInterface operation deletes the specified // Delete deletes the specified network interface. This method may poll for
// netwokInterface. This method may poll for completion. Polling can be // completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName // resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. // is the name of the network interface.
@ -181,11 +195,10 @@ func (client InterfacesClient) DeleteResponder(resp *http.Response) (result auto
return return
} }
// Get the Get ntework interface operation retreives information about the // Get gets information about the specified network interface.
// specified network interface.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName // resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. expand is expand references // is the name of the network interface. expand is expands referenced
// resources. // resources.
func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand) req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand)
@ -249,11 +262,10 @@ func (client InterfacesClient) GetResponder(resp *http.Response) (result Interfa
return return
} }
// GetEffectiveRouteTable the get effective routetable operation retrieves all // GetEffectiveRouteTable gets all route tables applied to a network
// the route tables applied on a networkInterface. This method may poll for // interface. This method may poll for completion. Polling can be canceled by
// completion. Polling can be canceled by passing the cancel channel // passing the cancel channel argument. The channel will be used to cancel
// argument. The channel will be used to cancel polling and any outstanding // polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName // resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. // is the name of the network interface.
@ -317,14 +329,13 @@ func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Respon
return return
} }
// GetVirtualMachineScaleSetNetworkInterface the Get ntework interface // GetVirtualMachineScaleSetNetworkInterface get the specified network
// operation retreives information about the specified network interface in a // interface in a virtual machine scale set.
// virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set. // virtualMachineScaleSetName is the name of the virtual machine scale set.
// virtualmachineIndex is the virtual machine index. networkInterfaceName is // virtualmachineIndex is the virtual machine index. networkInterfaceName is
// the name of the network interface. expand is expand references resources. // the name of the network interface. expand is expands referenced resources.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err 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) req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
if err != nil { if err != nil {
@ -389,8 +400,7 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponde
return return
} }
// List the List networkInterfaces operation retrieves all the // List gets all network interfaces in a resource group.
// networkInterfaces in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) { func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) {
@ -455,7 +465,7 @@ func (client InterfacesClient) ListResponder(resp *http.Response) (result Interf
func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer() req, err := lastResults.InterfaceListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -464,19 +474,18 @@ func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult)
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the List networkInterfaces operation retrieves all the // ListAll gets all network interfaces in a subscription.
// networkInterfaces in a subscription.
func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) { func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -538,7 +547,7 @@ func (client InterfacesClient) ListAllResponder(resp *http.Response) (result Int
func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer() req, err := lastResults.InterfaceListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -547,22 +556,21 @@ func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResul
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListEffectiveNetworkSecurityGroups the list effective network security // ListEffectiveNetworkSecurityGroups gets all network security groups applied
// group operation retrieves all the network security groups applied on a // to a network interface. This method may poll for completion. Polling can
// networkInterface. This method may poll for completion. Polling can be // be canceled by passing the cancel channel argument. The channel will be
// canceled by passing the cancel channel argument. The channel will be used // used to cancel polling and any outstanding HTTP requests.
// to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName // resourceGroupName is the name of the resource group. networkInterfaceName
// is the name of the network interface. // is the name of the network interface.
@ -626,9 +634,8 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp
return return
} }
// ListVirtualMachineScaleSetNetworkInterfaces the list network interface // ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in
// operation retrieves information about all network interfaces in a virtual // a virtual machine scale set.
// machine scale set.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set. // virtualMachineScaleSetName is the name of the virtual machine scale set.
@ -695,7 +702,7 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesRespon
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer() req, err := lastResults.InterfaceListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -704,20 +711,19 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextRe
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListVirtualMachineScaleSetVMNetworkInterfaces the list network interface // ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all
// operation retrieves information about all network interfaces in a virtual // network interfaces in a virtual machine in a virtual machine scale set.
// machine from a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualMachineScaleSetName is the name of the virtual machine scale set. // virtualMachineScaleSetName is the name of the virtual machine scale set.
@ -786,7 +792,7 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResp
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer() req, err := lastResults.InterfaceListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -795,12 +801,12 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNext
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -26,7 +26,7 @@ import (
// LoadBalancersClient is the the Microsoft Azure Network management API // LoadBalancersClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type LoadBalancersClient struct { type LoadBalancersClient struct {
@ -45,14 +45,14 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo
return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put LoadBalancer operation creates/updates a // CreateOrUpdate creates or updates a load balancer. This method may poll for
// LoadBalancer This method may poll for completion. Polling can be canceled // completion. Polling can be canceled by passing the cancel channel
// by passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is // resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer. parameters is parameters supplied to the // the name of the load balancer. parameters is parameters supplied to the
// create/delete LoadBalancer operation // create or update load balancer operation.
func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters, cancel)
if err != nil { if err != nil {
@ -115,13 +115,13 @@ func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (
return return
} }
// Delete the delete loadbalancer operation deletes the specified // Delete deletes the specified load balancer. This method may poll for
// loadbalancer. This method may poll for completion. Polling can be canceled // completion. Polling can be canceled by passing the cancel channel
// by passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is // resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer. // the name of the load balancer.
func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel) req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel)
if err != nil { if err != nil {
@ -182,11 +182,10 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a
return return
} }
// Get the Get ntework interface operation retreives information about the // Get gets the specified load balancer.
// specified network interface.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is // resourceGroupName is the name of the resource group. loadBalancerName is
// the name of the loadBalancer. expand is expand references resources. // the name of the load balancer. expand is expands referenced resources.
func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand) req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand)
if err != nil { if err != nil {
@ -249,8 +248,7 @@ func (client LoadBalancersClient) GetResponder(resp *http.Response) (result Load
return return
} }
// List the List loadBalancer operation retrieves all the loadbalancers in a // List gets all the load balancers in a resource group.
// resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) {
@ -315,7 +313,7 @@ func (client LoadBalancersClient) ListResponder(resp *http.Response) (result Loa
func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer() req, err := lastResults.LoadBalancerListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -324,19 +322,18 @@ func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListRe
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the List loadBalancer operation retrieves all the loadbalancers in // ListAll gets all the load balancers in a subscription.
// a subscription.
func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -398,7 +395,7 @@ func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result
func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer() req, err := lastResults.LoadBalancerListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -407,12 +404,12 @@ func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerLis
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// LocalNetworkGatewaysClient is the the Microsoft Azure Network management // LocalNetworkGatewaysClient is the the Microsoft Azure Network management
// API provides a RESTful set of web services that interact with Microsoft // API provides a RESTful set of web services that interact with Microsoft
// Azure Networks service to manage your network resrources. The API has // Azure Networks service to manage your network resources. The API has
// entities that capture the relationship between an end user and the // entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type LocalNetworkGatewaysClient struct { type LocalNetworkGatewaysClient struct {
@ -45,17 +46,25 @@ func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID str
return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put LocalNetworkGateway operation creates/updates a // CreateOrUpdate creates or updates a local network gateway in the specified
// local network gateway in the specified resource group through Network // resource group. This method may poll for completion. Polling can be
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used // canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// localNetworkGatewayName is the name of the local network gateway. // localNetworkGatewayName is the name of the local network gateway.
// parameters is parameters supplied to the Begin Create or update Local // parameters is parameters supplied to the create or update local network
// Network Gateway operation through Network resource provider. // gateway operation.
func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) { func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.LocalNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel)
if err != nil { 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")
@ -117,8 +126,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Resp
return return
} }
// Delete the Delete LocalNetworkGateway operation deletes the specifed local // Delete deletes the specified local network gateway. This method may poll
// network Gateway through Network resource provider. This method may poll
// for completion. Polling can be canceled by passing the cancel channel // for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
@ -185,8 +193,7 @@ func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (r
return return
} }
// Get the Get LocalNetworkGateway operation retrieves information about the // Get gets the specified local network gateway in a resource group.
// specified local network gateway through Network resource provider.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// localNetworkGatewayName is the name of the local network gateway. // localNetworkGatewayName is the name of the local network gateway.
@ -249,8 +256,7 @@ func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (resu
return return
} }
// List the List LocalNetworkGateways operation retrieves all the local // List gets all the local network gateways in a resource group.
// network gateways stored.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) { func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) {
@ -315,7 +321,7 @@ func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (res
func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) { func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) {
req, err := lastResults.LocalNetworkGatewayListResultPreparer() req, err := lastResults.LocalNetworkGatewayListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -324,12 +330,12 @@ func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetwor
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

File diff suppressed because it is too large Load Diff

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// PublicIPAddressesClient is the the Microsoft Azure Network management API // PublicIPAddressesClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type PublicIPAddressesClient struct { type PublicIPAddressesClient struct {
@ -45,15 +46,43 @@ func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string
return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)} return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put PublicIPAddress operation creates/updates a // CreateOrUpdate creates or updates a static or dynamic public IP address.
// stable/dynamic PublicIP address This method may poll for completion. // This method may poll for completion. Polling can be canceled by passing
// Polling can be canceled by passing the cancel channel argument. The // the cancel channel argument. The channel will be used to cancel polling
// channel will be used to cancel polling and any outstanding HTTP requests. // and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is // resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the publicIpAddress. parameters is parameters supplied to the // the name of the public IP address. parameters is parameters supplied to
// create/update PublicIPAddress operation // the create or update public IP address operation.
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (result autorest.Response, err error) { func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.IPConfigurations", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel)
if err != nil { 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")
@ -115,10 +144,10 @@ func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Respons
return return
} }
// Delete the delete publicIpAddress operation deletes the specified // Delete deletes the specified public IP address. This method may poll for
// publicIpAddress. This method may poll for completion. Polling can be // completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is // resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the subnet. // the name of the subnet.
@ -182,11 +211,10 @@ func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (resu
return return
} }
// Get the Get publicIpAddress operation retreives information about the // Get gets the specified public IP address in a specified resource group.
// specified pubicIpAddress
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is // resourceGroupName is the name of the resource group. publicIPAddressName is
// the name of the subnet. expand is expand references resources. // the name of the subnet. expand is expands referenced resources.
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand) req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand)
if err != nil { if err != nil {
@ -249,8 +277,7 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result
return return
} }
// List the List publicIpAddress operation retrieves all the publicIpAddresses // List gets all public IP addresses in a resource group.
// in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) {
@ -315,7 +342,7 @@ func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result
func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.PublicIPAddressListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -324,19 +351,18 @@ func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddres
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the List publicIpAddress operation retrieves all the // ListAll gets all the public IP addresses in a subscription.
// publicIpAddresses in a subscription.
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -398,7 +424,7 @@ func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (res
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.PublicIPAddressListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -407,12 +433,12 @@ func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAdd
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -26,7 +26,7 @@ import (
// RoutesClient is the the Microsoft Azure Network management API provides a // RoutesClient is the the Microsoft Azure Network management API provides a
// RESTful set of web services that interact with Microsoft Azure Networks // RESTful set of web services that interact with Microsoft Azure Networks
// service to manage your network resrources. The API has entities that // service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure // capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type RoutesClient struct { type RoutesClient struct {
@ -43,14 +43,15 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli
return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put route operation creates/updates a route in the // CreateOrUpdate creates or updates a route in the specified route table.
// specified route table This method may poll for completion. Polling can be // This method may poll for completion. Polling can be canceled by passing
// canceled by passing the cancel channel argument. The channel will be used // the cancel channel argument. The channel will be used to cancel polling
// to cancel polling and any outstanding HTTP requests. // and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. routeName is the name of the route. // name of the route table. routeName is the name of the route.
// routeParameters is parameters supplied to the create/update routeoperation // routeParameters is parameters supplied to the create or update route
// operation.
func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters, cancel)
if err != nil { if err != nil {
@ -114,10 +115,10 @@ func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result
return return
} }
// Delete the delete route operation deletes the specified route from a route // Delete deletes the specified route from a route table. This method may poll
// table. This method may poll for completion. Polling can be canceled by // for completion. Polling can be canceled by passing the cancel channel
// passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. routeName is the name of the route. // name of the route table. routeName is the name of the route.
@ -182,8 +183,7 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest
return return
} }
// Get the Get route operation retreives information about the specified route // Get gets the specified route from a route table.
// from the route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. routeName is the name of the route. // name of the route table. routeName is the name of the route.
@ -247,8 +247,7 @@ func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err
return return
} }
// List the List network security rule operation retrieves all the routes in a // List gets all routes in a route table.
// route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. // name of the route table.
@ -315,7 +314,7 @@ func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListR
func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) { func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) {
req, err := lastResults.RouteListResultPreparer() req, err := lastResults.RouteListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -324,12 +323,12 @@ func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// RouteTablesClient is the the Microsoft Azure Network management API // RouteTablesClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type RouteTablesClient struct { type RouteTablesClient struct {
@ -44,15 +45,22 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put RouteTable operation creates/updates a route tablein // CreateOrUpdate create or updates a route table in a specified resource
// the specified resource group. This method may poll for completion. Polling // group. This method may poll for completion. Polling can be canceled by
// can be canceled by passing the cancel channel argument. The channel will // passing the cancel channel argument. The channel will be used to cancel
// be used to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. parameters is parameters supplied to the // name of the route table. parameters is parameters supplied to the create
// create/update Route Table operation // or update route table operation.
func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (result autorest.Response, err error) { func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.RouteTablesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel)
if err != nil { 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")
@ -114,10 +122,10 @@ func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (re
return return
} }
// Delete the Delete RouteTable operation deletes the specifed Route Table // Delete deletes the specified route table. This method may poll for
// This method may poll for completion. Polling can be canceled by passing // completion. Polling can be canceled by passing the cancel channel
// the cancel channel argument. The channel will be used to cancel polling // argument. The channel will be used to cancel polling and any outstanding
// and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. // name of the route table.
@ -181,11 +189,10 @@ func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result aut
return return
} }
// Get the Get RouteTables operation retrieves information about the specified // Get gets the specified route table.
// route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the // resourceGroupName is the name of the resource group. routeTableName is the
// name of the route table. expand is expand references resources. // name of the route table. expand is expands referenced resources.
func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) {
req, err := client.GetPreparer(resourceGroupName, routeTableName, expand) req, err := client.GetPreparer(resourceGroupName, routeTableName, expand)
if err != nil { if err != nil {
@ -248,7 +255,7 @@ func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteT
return return
} }
// List the list RouteTables returns all route tables in a resource group // List gets all route tables in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) { func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) {
@ -313,7 +320,7 @@ func (client RouteTablesClient) ListResponder(resp *http.Response) (result Route
func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer() req, err := lastResults.RouteTableListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -322,18 +329,18 @@ func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the list RouteTables returns all route tables in a subscription // ListAll gets all route tables in a subscription.
func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) { func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -395,7 +402,7 @@ func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result Ro
func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer() req, err := lastResults.RouteTableListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -404,12 +411,12 @@ func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListRes
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// SecurityGroupsClient is the the Microsoft Azure Network management API // SecurityGroupsClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type SecurityGroupsClient struct { type SecurityGroupsClient struct {
@ -45,17 +46,25 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put NetworkSecurityGroup operation creates/updates a // CreateOrUpdate creates or updates a network security group in the specified
// network security groupin the specified resource group. This method may // resource group. This method may poll for completion. Polling can be
// poll for completion. Polling can be canceled by passing the cancel channel // canceled by passing the cancel channel argument. The channel will be used
// argument. The channel will be used to cancel polling and any outstanding // to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
// parameters is parameters supplied to the create/update Network Security // parameters is parameters supplied to the create or update network security
// Group operation // group operation.
func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (result autorest.Response, err error) { func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.SecurityGroupsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel)
if err != nil { 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")
@ -117,10 +126,10 @@ func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response)
return return
} }
// Delete the Delete NetworkSecurityGroup operation deletes the specifed // Delete deletes the specified network security group. This method may poll
// network security group This method may poll for completion. Polling can be // for completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
@ -184,12 +193,11 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result
return return
} }
// Get the Get NetworkSecurityGroups operation retrieves information about the // Get gets the specified network security group.
// specified network security group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. expand // networkSecurityGroupName is the name of the network security group. expand
// is expand references resources. // is expands referenced resources.
func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand) req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand)
if err != nil { if err != nil {
@ -252,8 +260,7 @@ func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result Sec
return return
} }
// List the list NetworkSecurityGroups returns all network security groups in // List gets all network security groups in a resource group.
// a resource group
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) {
@ -318,7 +325,7 @@ func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result Se
func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer() req, err := lastResults.SecurityGroupListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -327,19 +334,18 @@ func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupList
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the list NetworkSecurityGroups returns all network security groups // ListAll gets all network security groups in a subscription.
// in a subscription
func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -401,7 +407,7 @@ func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result
func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer() req, err := lastResults.SecurityGroupListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -410,12 +416,12 @@ func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupL
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// SecurityRulesClient is the the Microsoft Azure Network management API // SecurityRulesClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type SecurityRulesClient struct { type SecurityRulesClient struct {
@ -45,18 +46,26 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se
return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put network security rule operation creates/updates a // CreateOrUpdate creates or updates a security rule in the specified network
// security rule in the specified network security group This method may poll // security group. This method may poll for completion. Polling can be
// for completion. Polling can be canceled by passing the cancel channel // canceled by passing the cancel channel argument. The channel will be used
// argument. The channel will be used to cancel polling and any outstanding // to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
// securityRuleName is the name of the security rule. securityRuleParameters // securityRuleName is the name of the security rule. securityRuleParameters
// is parameters supplied to the create/update network security rule // is parameters supplied to the create or update network security rule
// operation // operation.
func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (result autorest.Response, err error) { func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: securityRuleParameters,
Constraints: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat.SourceAddressPrefix", Name: validation.Null, Rule: true, Chain: nil},
{Target: "securityRuleParameters.SecurityRulePropertiesFormat.DestinationAddressPrefix", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.SecurityRulesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel)
if err != nil { 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")
@ -119,10 +128,10 @@ func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (
return return
} }
// Delete the delete network security rule operation deletes the specified // Delete deletes the specified network security rule. This method may poll
// network security rule. This method may poll for completion. Polling can be // for completion. Polling can be canceled by passing the cancel channel
// canceled by passing the cancel channel argument. The channel will be used // argument. The channel will be used to cancel polling and any outstanding
// to cancel polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
@ -188,8 +197,7 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a
return return
} }
// Get the Get NetworkSecurityRule operation retreives information about the // Get get the specified network security rule.
// specified network security rule.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
@ -254,8 +262,7 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu
return return
} }
// List the List network security rule operation retrieves all the security // List gets all security rules in a network security group.
// rules in a network security group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// networkSecurityGroupName is the name of the network security group. // networkSecurityGroupName is the name of the network security group.
@ -322,7 +329,7 @@ func (client SecurityRulesClient) ListResponder(resp *http.Response) (result Sec
func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) {
req, err := lastResults.SecurityRuleListResultPreparer() req, err := lastResults.SecurityRuleListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -331,12 +338,12 @@ func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListRe
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// SubnetsClient is the the Microsoft Azure Network management API provides a // SubnetsClient is the the Microsoft Azure Network management API provides a
// RESTful set of web services that interact with Microsoft Azure Networks // RESTful set of web services that interact with Microsoft Azure Networks
// service to manage your network resrources. The API has entities that // service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure // capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type SubnetsClient struct { type SubnetsClient struct {
@ -43,16 +44,34 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC
return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)} return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put Subnet operation creates/updates a subnet in // CreateOrUpdate creates or updates a subnet in the specified virtual
// thespecified virtual network This method may poll for completion. Polling // network. This method may poll for completion. Polling can be canceled by
// can be canceled by passing the cancel channel argument. The channel will // passing the cancel channel argument. The channel will be used to cancel
// be used to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. subnetName is the name of the subnet. // the name of the virtual network. subnetName is the name of the subnet.
// subnetParameters is parameters supplied to the create/update Subnet // subnetParameters is parameters supplied to the create or update subnet
// operation // operation.
func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (result autorest.Response, err error) { func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: subnetParameters,
Constraints: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "subnetParameters.SubnetPropertiesFormat.IPConfigurations", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.SubnetsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel)
if err != nil { 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")
@ -115,10 +134,9 @@ func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result
return return
} }
// Delete the delete subnet operation deletes the specified subnet. This // Delete deletes the specified subnet. This method may poll for completion.
// method may poll for completion. Polling can be canceled by passing the // Polling can be canceled by passing the cancel channel argument. The
// cancel channel argument. The channel will be used to cancel polling and // channel will be used to cancel polling and any outstanding HTTP requests.
// any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. subnetName is the name of the subnet. // the name of the virtual network. subnetName is the name of the subnet.
@ -183,12 +201,11 @@ func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autores
return return
} }
// Get the Get subnet operation retreives information about the specified // Get gets the specified subnet by virtual network and resource group.
// subnet.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. subnetName is the name of the subnet. // the name of the virtual network. subnetName is the name of the subnet.
// expand is expand references resources. // expand is expands referenced resources.
func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err 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) req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, subnetName, expand)
if err != nil { if err != nil {
@ -252,8 +269,7 @@ func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, er
return return
} }
// List the List subnets operation retrieves all the subnets in a virtual // List gets all subnets in a virtual network.
// network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. // the name of the virtual network.
@ -320,7 +336,7 @@ func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetLis
func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) { func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) {
req, err := lastResults.SubnetListResultPreparer() req, err := lastResults.SubnetListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -329,12 +345,12 @@ func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (resul
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// UsagesClient is the the Microsoft Azure Network management API provides a // UsagesClient is the the Microsoft Azure Network management API provides a
// RESTful set of web services that interact with Microsoft Azure Networks // RESTful set of web services that interact with Microsoft Azure Networks
// service to manage your network resrources. The API has entities that // service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure // capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type UsagesClient struct { type UsagesClient struct {
@ -45,8 +46,14 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli
// List lists compute usages for a subscription. // List lists compute usages for a subscription.
// //
// location is the location upon which resource usage is queried. // location is the location where resource usage is queried.
func (client UsagesClient) List(location string) (result UsagesListResult, err error) { func (client UsagesClient) List(location string) (result UsagesListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.UsagesClient", "List")
}
req, err := client.ListPreparer(location) req, err := client.ListPreparer(location)
if err != nil { 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")
@ -108,7 +115,7 @@ func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesList
func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) { func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) {
req, err := lastResults.UsagesListResultPreparer() req, err := lastResults.UsagesListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -117,12 +124,12 @@ func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -23,9 +23,9 @@ import (
) )
const ( const (
major = "3" major = "7"
minor = "2" minor = "0"
patch = "0" patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org) // Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta" tag = "-beta"
semVerFormat = "%s.%s.%s%s" semVerFormat = "%s.%s.%s%s"
@ -34,7 +34,7 @@ const (
// UserAgent returns the UserAgent string to use when sending http.Requests. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "network", "2016-06-01") return fmt.Sprintf(userAgentFormat, Version(), "network", "2016-09-01")
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.

View File

@ -21,13 +21,14 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// VirtualNetworkGatewayConnectionsClient is the the Microsoft Azure Network // VirtualNetworkGatewayConnectionsClient is the the Microsoft Azure Network
// management API provides a RESTful set of web services that interact with // management API provides a RESTful set of web services that interact with
// Microsoft Azure Networks service to manage your network resrources. The // Microsoft Azure Networks service to manage your network resources. The API
// API has entities that capture the relationship between an end user and the // has entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type VirtualNetworkGatewayConnectionsClient struct { type VirtualNetworkGatewayConnectionsClient struct {
ManagementClient ManagementClient
@ -45,19 +46,46 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr
return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put VirtualNetworkGatewayConnection operation // CreateOrUpdate creates or updates a virtual network gateway connection in
// creates/updates a virtual network gateway connection in the specified // the specified resource group. This method may poll for completion. Polling
// resource group through Network resource provider. This method may poll for // can be canceled by passing the cancel channel argument. The channel will
// completion. Polling can be canceled by passing the cancel channel // be used to cancel polling and any outstanding HTTP requests.
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network // virtualNetworkGatewayConnectionName is the name of the virtual network
// gateway conenction. parameters is parameters supplied to the Begin Create // gateway connection. parameters is parameters supplied to the create or
// or update Virtual Network Gateway connection operation through Network // update virtual network gateway connection operation.
// resource provider.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.ConnectionStatus", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.TunnelConnectionStatus", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.EgressBytesTransferred", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.IngressBytesTransferred", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil { 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")
@ -119,11 +147,10 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(res
return return
} }
// Delete the Delete VirtualNetworkGatewayConnection operation deletes the // Delete deletes the specified virtual network Gateway connection. This
// specifed virtual network Gateway connection through Network resource // method may poll for completion. Polling can be canceled by passing the
// provider. This method may poll for completion. Polling can be canceled by // cancel channel argument. The channel will be used to cancel polling and
// passing the cancel channel argument. The channel will be used to cancel // any outstanding HTTP requests.
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network // virtualNetworkGatewayConnectionName is the name of the virtual network
@ -188,9 +215,7 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.
return return
} }
// Get the Get VirtualNetworkGatewayConnection operation retrieves information // Get gets the specified virtual network gateway connection by resource group.
// about the specified virtual network gateway connection through Network
// resource provider.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the name of the virtual network // virtualNetworkGatewayConnectionName is the name of the virtual network
@ -259,10 +284,10 @@ func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Res
// connection shared key through Network resource provider. // connection shared key through Network resource provider.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// connectionSharedKeyName is the virtual network gateway connection shared // virtualNetworkGatewayConnectionName is the virtual network gateway
// key name. // connection shared key name.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, connectionSharedKeyName string) (result ConnectionSharedKeyResult, err error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) {
req, err := client.GetSharedKeyPreparer(resourceGroupName, connectionSharedKeyName) req, err := client.GetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil { 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")
} }
@ -282,11 +307,11 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupN
} }
// GetSharedKeyPreparer prepares the GetSharedKey request. // GetSharedKeyPreparer prepares the GetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resourceGroupName string, connectionSharedKeyName string) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"connectionSharedKeyName": autorest.Encode("path", connectionSharedKeyName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
"virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName),
} }
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
@ -296,7 +321,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resour
preparer := autorest.CreatePreparer( preparer := autorest.CreatePreparer(
autorest.AsGet(), autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{connectionSharedKeyName}/sharedkey", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare(&http.Request{})
} }
@ -309,7 +334,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *htt
// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always // GetSharedKeyResponder handles the response to the GetSharedKey request. The method always
// closes the http.Response Body. // closes the http.Response Body.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKeyResult, err error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) {
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -386,7 +411,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Re
func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) {
req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer() req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -395,12 +420,12 @@ func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
@ -416,9 +441,18 @@ func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the virtual network gateway // virtualNetworkGatewayConnectionName is the virtual network gateway
// connection reset shared key Name. parameters is parameters supplied to the // connection reset shared key Name. parameters is parameters supplied to the
// Begin Reset Virtual Network Gateway connection shared key operation // begin reset virtual network gateway connection shared key operation
// through Network resource provider. // through network resource provider.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil},
{Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey")
}
req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil { 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")
@ -490,9 +524,15 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(res
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayConnectionName is the virtual network gateway // virtualNetworkGatewayConnectionName is the virtual network gateway
// connection name. parameters is parameters supplied to the Begin Set // connection name. parameters is parameters supplied to the Begin Set
// Virtual Network Gateway conection Shared key operation throughNetwork // Virtual Network Gateway connection Shared key operation throughNetwork
// resource provider. // resource provider.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey")
}
req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil { 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")

View File

@ -21,12 +21,13 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// VirtualNetworkGatewaysClient is the the Microsoft Azure Network management // VirtualNetworkGatewaysClient is the the Microsoft Azure Network management
// API provides a RESTful set of web services that interact with Microsoft // API provides a RESTful set of web services that interact with Microsoft
// Azure Networks service to manage your network resrources. The API has // Azure Networks service to manage your network resources. The API has
// entities that capture the relationship between an end user and the // entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type VirtualNetworkGatewaysClient struct { type VirtualNetworkGatewaysClient struct {
@ -45,17 +46,25 @@ func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID s
return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put VirtualNetworkGateway operation creates/updates a // CreateOrUpdate creates or updates a virtual network gateway in the
// virtual network gateway in the specified resource group through Network // specified resource group. This method may poll for completion. Polling can
// resource provider. This method may poll for completion. Polling can be // be canceled by passing the cancel channel argument. The channel will be
// canceled by passing the cancel channel argument. The channel will be used // used to cancel polling and any outstanding HTTP requests.
// to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway. // virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Create or update Virtual // parameters is parameters supplied to create or update virtual network
// Network Gateway operation through Network resource provider. // gateway operation.
func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel)
if err != nil { 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")
@ -117,9 +126,8 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Re
return return
} }
// Delete the Delete VirtualNetworkGateway operation deletes the specifed // Delete deletes the specified virtual network gateway. This method may poll
// virtual network Gateway through Network resource provider. This method may // for completion. Polling can be canceled by passing the cancel channel
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
@ -185,14 +193,13 @@ func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response)
return return
} }
// Generatevpnclientpackage the Generatevpnclientpackage operation generates // Generatevpnclientpackage generates VPN client package for P2S client of the
// Vpn client package for P2S client of the virtual network gateway in the // virtual network gateway in the specified resource group.
// specified resource group through Network resource provider.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway. // virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Generating Virtual Network // parameters is parameters supplied to the generate virtual network gateway
// Gateway Vpn client package operation through Network resource provider. // VPN client package operation.
func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) { func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) {
req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters) req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
if err != nil { if err != nil {
@ -254,8 +261,7 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(res
return return
} }
// Get the Get VirtualNetworkGateway operation retrieves information about the // Get gets the specified virtual network gateway by resource group.
// specified virtual network gateway through Network resource provider.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway. // virtualNetworkGatewayName is the name of the virtual network gateway.
@ -318,8 +324,7 @@ func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (re
return return
} }
// List the List VirtualNetworkGateways operation retrieves all the virtual // List gets all virtual network gateways by resource group.
// network gateways stored.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) { func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) {
@ -384,7 +389,7 @@ func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (r
func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) { func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) {
req, err := lastResults.VirtualNetworkGatewayListResultPreparer() req, err := lastResults.VirtualNetworkGatewayListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -393,29 +398,28 @@ func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNe
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// Reset the Reset VirtualNetworkGateway operation resets the primary of the // Reset resets the primary of the virtual network gateway in the specified
// virtual network gateway in the specified resource group through Network // resource group. This method may poll for completion. Polling can be
// resource provider. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used // canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
// virtualNetworkGatewayName is the name of the virtual network gateway. // virtualNetworkGatewayName is the name of the virtual network gateway.
// parameters is parameters supplied to the Begin Reset Virtual Network // gatewayVip is virtual network gateway vip address supplied to the begin
// Gateway operation through Network resource provider. // reset of the active-active feature enabled gateway.
func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel) req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, gatewayVip, cancel)
if err != nil { 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")
} }
@ -435,7 +439,7 @@ func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtu
} }
// ResetPreparer prepares the Reset request. // ResetPreparer prepares the Reset request.
func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -445,13 +449,14 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName strin
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
"api-version": client.APIVersion, "api-version": client.APIVersion,
} }
if len(gatewayVip) > 0 {
queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip)
}
preparer := autorest.CreatePreparer( preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(), autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare(&http.Request{Cancel: cancel})
} }

View File

@ -26,7 +26,7 @@ import (
// VirtualNetworkPeeringsClient is the the Microsoft Azure Network management // VirtualNetworkPeeringsClient is the the Microsoft Azure Network management
// API provides a RESTful set of web services that interact with Microsoft // API provides a RESTful set of web services that interact with Microsoft
// Azure Networks service to manage your network resrources. The API has // Azure Networks service to manage your network resources. The API has
// entities that capture the relationship between an end user and the // entities that capture the relationship between an end user and the
// Microsoft Azure Networks service. // Microsoft Azure Networks service.
type VirtualNetworkPeeringsClient struct { type VirtualNetworkPeeringsClient struct {
@ -45,16 +45,15 @@ func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID s
return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the Put virtual network peering operation creates/updates a // CreateOrUpdate creates or updates a peering in the specified virtual
// peering in the specified virtual network This method may poll for // network. This method may poll for completion. Polling can be canceled by
// completion. Polling can be canceled by passing the cancel channel // passing the cancel channel argument. The channel will be used to cancel
// argument. The channel will be used to cancel polling and any outstanding // polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. virtualNetworkPeeringName is the name of // the name of the virtual network. virtualNetworkPeeringName is the name of
// the peering. virtualNetworkPeeringParameters is parameters supplied to the // the peering. virtualNetworkPeeringParameters is parameters supplied to the
// create/update virtual network peering operation // create or update virtual network peering operation.
func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel)
if err != nil { if err != nil {
@ -118,10 +117,10 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Re
return return
} }
// Delete the delete virtual network peering operation deletes the specified // Delete deletes the specified virtual network peering. This method may poll
// peering. This method may poll for completion. Polling can be canceled by // for completion. Polling can be canceled by passing the cancel channel
// passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. virtualNetworkPeeringName is the name of // the name of the virtual network. virtualNetworkPeeringName is the name of
@ -187,8 +186,7 @@ func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response)
return return
} }
// Get the Get virtual network peering operation retreives information about // Get gets the specified virtual network peering.
// the specified virtual network peering.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. virtualNetworkPeeringName is the name of // the name of the virtual network. virtualNetworkPeeringName is the name of
@ -253,8 +251,7 @@ func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (re
return return
} }
// List the List virtual network peerings operation retrieves all the peerings // List gets all virtual network peerings in a virtual network.
// in a virtual network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. // the name of the virtual network.
@ -321,7 +318,7 @@ func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (r
func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) { func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) {
req, err := lastResults.VirtualNetworkPeeringListResultPreparer() req, err := lastResults.VirtualNetworkPeeringListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
@ -330,12 +327,12 @@ func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNe
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request")
} }
return return

View File

@ -26,7 +26,7 @@ import (
// VirtualNetworksClient is the the Microsoft Azure Network management API // VirtualNetworksClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure // provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resrources. The API has entities // Networks service to manage your network resources. The API has entities
// that capture the relationship between an end user and the Microsoft Azure // that capture the relationship between an end user and the Microsoft Azure
// Networks service. // Networks service.
type VirtualNetworksClient struct { type VirtualNetworksClient struct {
@ -45,7 +45,7 @@ func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string)
return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CheckIPAddressAvailability checks whether a private Ip address is available // CheckIPAddressAvailability checks whether a private IP address is available
// for use. // for use.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
@ -113,15 +113,14 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *ht
return return
} }
// CreateOrUpdate the Put VirtualNetwork operation creates/updates a virtual // CreateOrUpdate creates or updates a virtual network in the specified
// network in the specified resource group. This method may poll for // resource group. This method may poll for completion. Polling can be
// completion. Polling can be canceled by passing the cancel channel // canceled by passing the cancel channel argument. The channel will be used
// argument. The channel will be used to cancel polling and any outstanding // to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. parameters is parameters supplied to the // the name of the virtual network. parameters is parameters supplied to the
// create/update Virtual Network operation // create or update virtual network operation
func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (result autorest.Response, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel)
if err != nil { if err != nil {
@ -184,10 +183,10 @@ func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response)
return return
} }
// Delete the Delete VirtualNetwork operation deletes the specifed virtual // Delete deletes the specified virtual network. This method may poll for
// network This method may poll for completion. Polling can be canceled by // completion. Polling can be canceled by passing the cancel channel
// passing the cancel channel argument. The channel will be used to cancel // argument. The channel will be used to cancel polling and any outstanding
// polling and any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. // the name of the virtual network.
@ -251,11 +250,10 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result
return return
} }
// Get the Get VirtualNetwork operation retrieves information about the // Get gets the specified virtual network by resource group.
// specified virtual network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is // resourceGroupName is the name of the resource group. virtualNetworkName is
// the name of the virtual network. expand is expand references resources. // the name of the virtual network. expand is expands referenced resources.
func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand) req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand)
if err != nil { if err != nil {
@ -318,8 +316,7 @@ func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result Vi
return return
} }
// List the list VirtualNetwork returns all Virtual Networks in a resource // List gets all virtual networks in a resource group.
// group
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) {
@ -384,7 +381,7 @@ func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result V
func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer() req, err := lastResults.VirtualNetworkListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -393,19 +390,18 @@ func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkLi
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return
} }
// ListAll the list VirtualNetwork returns all Virtual Networks in a // ListAll gets all virtual networks in a subscription.
// subscription
func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -467,7 +463,7 @@ func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (resul
func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer() req, err := lastResults.VirtualNetworkListResultPreparer()
if err != nil { 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")
} }
if req == nil { if req == nil {
return return
@ -476,12 +472,12 @@ func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetwor
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = 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")
} }
return return

View File

@ -21,6 +21,7 @@ package storage
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -40,12 +41,20 @@ func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) Account
return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CheckNameAvailability checks that account name is valid and is not in use. // CheckNameAvailability checks that the storage account name is valid and is
// not already in use.
// //
// accountName is the name of the storage account within the specified // accountName is the name of the storage account within the specified
// resource group. Storage account names must be between 3 and 24 characters // resource group. Storage account names must be between 3 and 24 characters
// in length and use numbers and lower-case letters only. // in length and use numbers and lower-case letters only.
func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "accountName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "CheckNameAvailability")
}
req, err := client.CheckNameAvailabilityPreparer(accountName) req, err := client.CheckNameAvailabilityPreparer(accountName)
if err != nil { 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")
@ -105,13 +114,13 @@ func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response)
} }
// Create asynchronously creates a new storage account with the specified // Create asynchronously creates a new storage account with the specified
// parameters. If an account is already created and subsequent create request // parameters. If an account is already created and a subsequent create
// is issued with different properties, the account properties will be // request is issued with different properties, the account properties will
// updated. If an account is already created and subsequent create or update // be updated. If an account is already created and a subsequent create or
// request is issued with exact same set of properties, the request will // update request is issued with the exact same set of properties, the
// succeed. This method may poll for completion. Polling can be canceled by // request will succeed. This method may poll for completion. Polling can be
// passing the cancel channel argument. The channel will be used to cancel // canceled by passing the cancel channel argument. The channel will be used
// polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group within the user's // resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the storage account within the // subscription. accountName is the name of the storage account within the
@ -119,6 +128,28 @@ func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response)
// characters in length and use numbers and lower-case letters only. // characters in length and use numbers and lower-case letters only.
// parameters is the parameters to provide for the created account. // parameters is the parameters to provide for the created account.
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Sku.Tier", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.AccountPropertiesCreateParameters.Encryption", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.Services", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.Services.Blob", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.Services.Blob.LastEnabledTime", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "parameters.AccountPropertiesCreateParameters.Encryption.KeySource", Name: validation.Null, Rule: true, Chain: nil},
}},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create")
}
req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel)
if err != nil { 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")
@ -174,7 +205,7 @@ func (client AccountsClient) CreateResponder(resp *http.Response) (result autore
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -187,6 +218,13 @@ func (client AccountsClient) CreateResponder(resp *http.Response) (result autore
// specified resource group. Storage account names must be between 3 and 24 // specified resource group. Storage account names must be between 3 and 24
// characters in length and use numbers and lower-case letters only. // characters in length and use numbers and lower-case letters only.
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) { func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Delete")
}
req, err := client.DeletePreparer(resourceGroupName, accountName) req, err := client.DeletePreparer(resourceGroupName, accountName)
if err != nil { 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")
@ -245,14 +283,21 @@ func (client AccountsClient) DeleteResponder(resp *http.Response) (result autore
} }
// GetProperties returns the properties for the specified storage account // GetProperties returns the properties for the specified storage account
// including but not limited to name, account type, location, and account // including but not limited to name, SKU name, location, and account status.
// status. The ListKeys operation should be used to retrieve storage keys. // The ListKeys operation should be used to retrieve storage keys.
// //
// resourceGroupName is the name of the resource group within the user's // resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the storage account within the // subscription. accountName is the name of the storage account within the
// specified resource group. Storage account names must be between 3 and 24 // specified resource group. Storage account names must be between 3 and 24
// characters in length and use numbers and lower-case letters only. // characters in length and use numbers and lower-case letters only.
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) { func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "GetProperties")
}
req, err := client.GetPropertiesPreparer(resourceGroupName, accountName) req, err := client.GetPropertiesPreparer(resourceGroupName, accountName)
if err != nil { 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")
@ -436,9 +481,18 @@ func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (
// ListKeys lists the access keys for the specified storage account. // ListKeys lists the access keys for the specified storage account.
// //
// resourceGroupName is the name of the resource group. accountName is the // resourceGroupName is the name of the resource group within the user's
// name of the storage account. // 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) ListKeys(resourceGroupName string, accountName string) (result AccountListKeysResult, err error) { func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountListKeysResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListKeys")
}
req, err := client.ListKeysPreparer(resourceGroupName, accountName) req, err := client.ListKeysPreparer(resourceGroupName, accountName)
if err != nil { 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")
@ -497,15 +551,25 @@ func (client AccountsClient) ListKeysResponder(resp *http.Response) (result Acco
return return
} }
// RegenerateKey regenerates the access keys for the specified storage account. // RegenerateKey regenerates one of the access keys for the specified storage
// account.
// //
// resourceGroupName is the name of the resource group within the user's // resourceGroupName is the name of the resource group within the user's
// subscription. accountName is the name of the storage account within the // subscription. accountName is the name of the storage account within the
// specified resource group. Storage account names must be between 3 and 24 // specified resource group. Storage account names must be between 3 and 24
// characters in length and use numbers and lower-case letters only. // characters in length and use numbers and lower-case letters only.
// regenerateKey is specifies name of the key which should be regenerated. // regenerateKey is specifies name of the key which should be regenerated --
// key1 or key2 for the default keys // key1 or key2.
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: regenerateKey,
Constraints: []validation.Constraint{{Target: "regenerateKey.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "RegenerateKey")
}
req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey) req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey)
if err != nil { 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")
@ -566,14 +630,14 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result
return return
} }
// Update the update operation can be used to update the account type, // Update the update operation can be used to update the SKU, encryption,
// encryption, or tags for a storage account. It can also be used to map the // access tier, or tags for a storage account. It can also be used to map the
// account to a custom domain. Only one custom domain is supported per // account to a custom domain. Only one custom domain is supported per
// storage account and. replacement/change of custom domain is not supported. // storage account; the replacement/change of custom domain is not supported.
// In order to replace an old custom domain, the old value must be // In order to replace an old custom domain, the old value must be
// cleared/unregistered before a new value may be set. Update of multiple // cleared/unregistered before a new value can be set. The update of multiple
// properties is supported. This call does not change the storage keys for // properties is supported. This call does not change the storage keys for
// the account. If you want to change storage account keys, use the // the account. If you want to change the storage account keys, use the
// regenerate keys operation. The location and name of the storage account // regenerate keys operation. The location and name of the storage account
// cannot be changed after creation. // cannot be changed after creation.
// //
@ -583,6 +647,13 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result
// characters in length and use numbers and lower-case letters only. // characters in length and use numbers and lower-case letters only.
// parameters is the parameters to provide for the updated account. // parameters is the parameters to provide for the updated account.
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: accountName,
Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Update")
}
req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters)
if err != nil { 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")

View File

@ -139,7 +139,7 @@ type Account struct {
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Sku *Sku `json:"sku,omitempty"` Sku *Sku `json:"sku,omitempty"`
Kind Kind `json:"kind,omitempty"` Kind Kind `json:"kind,omitempty"`
Properties *AccountProperties `json:"properties,omitempty"` *AccountProperties `json:"properties,omitempty"`
} }
// AccountCheckNameAvailabilityParameters is // AccountCheckNameAvailabilityParameters is
@ -148,13 +148,14 @@ type AccountCheckNameAvailabilityParameters struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
} }
// AccountCreateParameters is the parameters to provide for the account. // AccountCreateParameters is the parameters used when creating a storage
// account.
type AccountCreateParameters struct { type AccountCreateParameters struct {
Sku *Sku `json:"sku,omitempty"` Sku *Sku `json:"sku,omitempty"`
Kind Kind `json:"kind,omitempty"` Kind Kind `json:"kind,omitempty"`
Location *string `json:"location,omitempty"` Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *AccountPropertiesCreateParameters `json:"properties,omitempty"` *AccountPropertiesCreateParameters `json:"properties,omitempty"`
} }
// AccountKey is an access key for the storage account. // AccountKey is an access key for the storage account.
@ -164,13 +165,13 @@ type AccountKey struct {
Permissions KeyPermission `json:"permissions,omitempty"` Permissions KeyPermission `json:"permissions,omitempty"`
} }
// AccountListKeysResult is the ListKeys operation response. // AccountListKeysResult is the response from the ListKeys operation.
type AccountListKeysResult struct { type AccountListKeysResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Keys *[]AccountKey `json:"keys,omitempty"` Keys *[]AccountKey `json:"keys,omitempty"`
} }
// AccountListResult is the list storage accounts operation response. // AccountListResult is the response from the List Storage Accounts operation.
type AccountListResult struct { type AccountListResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Value *[]Account `json:"value,omitempty"` Value *[]Account `json:"value,omitempty"`
@ -211,11 +212,12 @@ type AccountRegenerateKeyParameters struct {
KeyName *string `json:"keyName,omitempty"` KeyName *string `json:"keyName,omitempty"`
} }
// AccountUpdateParameters is the parameters to provide for the account. // AccountUpdateParameters is the parameters that can be provided when
// updating the storage account properties.
type AccountUpdateParameters struct { type AccountUpdateParameters struct {
Sku *Sku `json:"sku,omitempty"` Sku *Sku `json:"sku,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
Properties *AccountPropertiesUpdateParameters `json:"properties,omitempty"` *AccountPropertiesUpdateParameters `json:"properties,omitempty"`
} }
// CheckNameAvailabilityResult is the CheckNameAvailability operation response. // CheckNameAvailabilityResult is the CheckNameAvailability operation response.
@ -233,25 +235,26 @@ type CustomDomain struct {
UseSubDomain *bool `json:"useSubDomain,omitempty"` UseSubDomain *bool `json:"useSubDomain,omitempty"`
} }
// Encryption is the encryption settings on the account. // Encryption is the encryption settings on the storage account.
type Encryption struct { type Encryption struct {
Services *EncryptionServices `json:"services,omitempty"` Services *EncryptionServices `json:"services,omitempty"`
KeySource *string `json:"keySource,omitempty"` KeySource *string `json:"keySource,omitempty"`
} }
// EncryptionService is an encrypted service. // EncryptionService is a service that allows server-side encryption to be
// used.
type EncryptionService struct { type EncryptionService struct {
Enabled *bool `json:"enabled,omitempty"` Enabled *bool `json:"enabled,omitempty"`
LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"`
} }
// EncryptionServices is the encrypted services. // EncryptionServices is a list of services that support encryption.
type EncryptionServices struct { type EncryptionServices struct {
Blob *EncryptionService `json:"blob,omitempty"` Blob *EncryptionService `json:"blob,omitempty"`
} }
// Endpoints is the URIs that are used to perform a retrieval of a public // Endpoints is the URIs that are used to perform a retrieval of a public
// blob, queue or table object. // blob, queue, or table object.
type Endpoints struct { type Endpoints struct {
Blob *string `json:"blob,omitempty"` Blob *string `json:"blob,omitempty"`
Queue *string `json:"queue,omitempty"` Queue *string `json:"queue,omitempty"`
@ -282,13 +285,14 @@ type Usage struct {
Name *UsageName `json:"name,omitempty"` Name *UsageName `json:"name,omitempty"`
} }
// UsageListResult is the List Usages operation response. // UsageListResult is the response from the List Usages operation.
type UsageListResult struct { type UsageListResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Value *[]Usage `json:"value,omitempty"` Value *[]Usage `json:"value,omitempty"`
} }
// UsageName is the Usage Names. // UsageName is the usage names that can be used; currently limited to
// StorageAccount.
type UsageName struct { type UsageName struct {
Value *string `json:"value,omitempty"` Value *string `json:"value,omitempty"`
LocalizedValue *string `json:"localizedValue,omitempty"` LocalizedValue *string `json:"localizedValue,omitempty"`

View File

@ -23,9 +23,9 @@ import (
) )
const ( const (
major = "3" major = "7"
minor = "2" minor = "0"
patch = "0" patch = "1"
// Always begin a "tag" with a dash (as per http://semver.org) // Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta" tag = "-beta"
semVerFormat = "%s.%s.%s%s" semVerFormat = "%s.%s.%s%s"

View File

@ -0,0 +1,5 @@
# Azure Storage SDK for Go
The `github.com/Azure/azure-sdk-for-go/storage` package is used to perform operations in Azure Storage Service. To manage your storage accounts (Azure Resource Manager / ARM), use the [github.com/Azure/azure-sdk-for-go/arm/storage](../arm/storage) package. For your classic storage accounts (Azure Service Management / ASM), use [github.com/Azure/azure-sdk-for-go/management/storageservice](../management/storageservice) package.
This package includes support for [Azure Storage Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/)

View File

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
@ -256,6 +257,23 @@ const (
blobCopyStatusFailed = "failed" blobCopyStatusFailed = "failed"
) )
// lease constants.
const (
leaseHeaderPrefix = "x-ms-lease-"
leaseID = "x-ms-lease-id"
leaseAction = "x-ms-lease-action"
leaseBreakPeriod = "x-ms-lease-break-period"
leaseDuration = "x-ms-lease-duration"
leaseProposedID = "x-ms-proposed-lease-id"
leaseTime = "x-ms-lease-time"
acquireLease = "acquire"
renewLease = "renew"
changeLease = "change"
releaseLease = "release"
breakLease = "break"
)
// BlockListType is used to filter out types of blocks in a Get Blocks List call // BlockListType is used to filter out types of blocks in a Get Blocks List call
// for a block blob. // for a block blob.
// //
@ -284,6 +302,65 @@ const (
ContainerAccessTypeContainer ContainerAccessType = "container" ContainerAccessTypeContainer ContainerAccessType = "container"
) )
// ContainerAccessOptions are used when setting ACLs of containers (after creation)
type ContainerAccessOptions struct {
ContainerAccess ContainerAccessType
Timeout int
LeaseID string
}
// AccessPolicyDetails are used for SETTING policies
type AccessPolicyDetails struct {
ID string
StartTime time.Time
ExpiryTime time.Time
CanRead bool
CanWrite bool
CanDelete bool
}
// ContainerPermissions is used when setting permissions and Access Policies for containers.
type ContainerPermissions struct {
AccessOptions ContainerAccessOptions
AccessPolicy AccessPolicyDetails
}
// AccessPolicyDetailsXML has specifics about an access policy
// annotated with XML details.
type AccessPolicyDetailsXML struct {
StartTime time.Time `xml:"Start"`
ExpiryTime time.Time `xml:"Expiry"`
Permission string `xml:"Permission"`
}
// SignedIdentifier is a wrapper for a specific policy
type SignedIdentifier struct {
ID string `xml:"Id"`
AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"`
}
// SignedIdentifiers part of the response from GetPermissions call.
type SignedIdentifiers struct {
SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
}
// AccessPolicy is the response type from the GetPermissions call.
type AccessPolicy struct {
SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"`
}
// ContainerAccessResponse is returned for the GetContainerPermissions function.
// This contains both the permission and access policy for the container.
type ContainerAccessResponse struct {
ContainerAccess ContainerAccessType
AccessPolicy SignedIdentifiers
}
// ContainerAccessHeader references header used when setting/getting container ACL
const (
ContainerAccessHeader string = "x-ms-blob-public-access"
)
// Maximum sizes (per REST API) for various concepts // Maximum sizes (per REST API) for various concepts
const ( const (
MaxBlobBlockSize = 4 * 1024 * 1024 MaxBlobBlockSize = 4 * 1024 * 1024
@ -399,7 +476,7 @@ func (b BlobStorageClient) createContainer(name string, access ContainerAccessTy
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
if access != "" { if access != "" {
headers["x-ms-blob-public-access"] = string(access) headers[ContainerAccessHeader] = string(access)
} }
return b.client.exec(verb, uri, headers, nil) return b.client.exec(verb, uri, headers, nil)
} }
@ -421,6 +498,101 @@ func (b BlobStorageClient) ContainerExists(name string) (bool, error) {
return false, err return false, err
} }
// SetContainerPermissions sets up container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179391.aspx
func (b BlobStorageClient) SetContainerPermissions(container string, containerPermissions ContainerPermissions) (err error) {
params := url.Values{
"restype": {"container"},
"comp": {"acl"},
}
if containerPermissions.AccessOptions.Timeout > 0 {
params.Add("timeout", strconv.Itoa(containerPermissions.AccessOptions.Timeout))
}
uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params)
headers := b.client.getStandardHeaders()
if containerPermissions.AccessOptions.ContainerAccess != "" {
headers[ContainerAccessHeader] = string(containerPermissions.AccessOptions.ContainerAccess)
}
if containerPermissions.AccessOptions.LeaseID != "" {
headers[leaseID] = containerPermissions.AccessOptions.LeaseID
}
// generate the XML for the SharedAccessSignature if required.
accessPolicyXML, err := generateAccessPolicy(containerPermissions.AccessPolicy)
if err != nil {
return err
}
var resp *storageResponse
if accessPolicyXML != "" {
headers["Content-Length"] = strconv.Itoa(len(accessPolicyXML))
resp, err = b.client.exec("PUT", uri, headers, strings.NewReader(accessPolicyXML))
} else {
resp, err = b.client.exec("PUT", uri, headers, nil)
}
if err != nil {
return err
}
if resp != nil {
defer func() {
err = resp.body.Close()
}()
if resp.statusCode != http.StatusOK {
return errors.New("Unable to set permissions")
}
}
return nil
}
// GetContainerPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx
// If timeout is 0 then it will not be passed to Azure
// leaseID will only be passed to Azure if populated
// Returns permissionResponse which is combined permissions and AccessPolicy
func (b BlobStorageClient) GetContainerPermissions(container string, timeout int, leaseID string) (permissionResponse *ContainerAccessResponse, err error) {
params := url.Values{"restype": {"container"},
"comp": {"acl"}}
if timeout > 0 {
params.Add("timeout", strconv.Itoa(timeout))
}
uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params)
headers := b.client.getStandardHeaders()
if leaseID != "" {
headers[leaseID] = leaseID
}
resp, err := b.client.exec("GET", uri, headers, nil)
if err != nil {
return nil, err
}
// containerAccess. Blob, Container, empty
containerAccess := resp.headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader))
defer func() {
err = resp.body.Close()
}()
var out AccessPolicy
err = xmlUnmarshal(resp.body, &out.SignedIdentifiersList)
if err != nil {
return nil, err
}
permissionResponse = &ContainerAccessResponse{}
permissionResponse.AccessPolicy = out.SignedIdentifiersList
permissionResponse.ContainerAccess = ContainerAccessType(containerAccess)
return permissionResponse, nil
}
// DeleteContainer deletes the container with given name on the storage // DeleteContainer deletes the container with given name on the storage
// account. If the container does not exist returns error. // account. If the container does not exist returns error.
// //
@ -560,6 +732,174 @@ func (b BlobStorageClient) getBlobRange(container, name, bytesRange string, extr
return resp, err return resp, err
} }
// leasePut is common PUT code for the various aquire/release/break etc functions.
func (b BlobStorageClient) leaseCommonPut(container string, name string, headers map[string]string, expectedStatus int) (http.Header, error) {
params := url.Values{"comp": {"lease"}}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
resp, err := b.client.exec("PUT", uri, headers, nil)
if err != nil {
return nil, err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{expectedStatus}); err != nil {
return nil, err
}
return resp.headers, nil
}
// SnapshotBlob creates a snapshot for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx
func (b BlobStorageClient) SnapshotBlob(container string, name string, timeout int, extraHeaders map[string]string) (snapshotTimestamp *time.Time, err error) {
headers := b.client.getStandardHeaders()
params := url.Values{"comp": {"snapshot"}}
if timeout > 0 {
params.Add("timeout", strconv.Itoa(timeout))
}
for k, v := range extraHeaders {
headers[k] = v
}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
resp, err := b.client.exec("PUT", uri, headers, nil)
if err != nil {
return nil, err
}
if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil {
return nil, err
}
snapshotResponse := resp.headers.Get(http.CanonicalHeaderKey("x-ms-snapshot"))
if snapshotResponse != "" {
snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse)
if err != nil {
return nil, err
}
return &snapshotTimestamp, nil
}
return nil, errors.New("Snapshot not created")
}
// AcquireLease creates a lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
// returns leaseID acquired
func (b BlobStorageClient) AcquireLease(container string, name string, leaseTimeInSeconds int, proposedLeaseID string) (returnedLeaseID string, err error) {
headers := b.client.getStandardHeaders()
headers[leaseAction] = acquireLease
if leaseTimeInSeconds > 0 {
headers[leaseDuration] = strconv.Itoa(leaseTimeInSeconds)
}
if proposedLeaseID != "" {
headers[leaseProposedID] = proposedLeaseID
}
respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusCreated)
if err != nil {
return "", err
}
returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID))
if returnedLeaseID != "" {
return returnedLeaseID, nil
}
return "", errors.New("LeaseID not returned")
}
// BreakLease breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
// Returns the timeout remaining in the lease in seconds
func (b BlobStorageClient) BreakLease(container string, name string) (breakTimeout int, err error) {
headers := b.client.getStandardHeaders()
headers[leaseAction] = breakLease
return b.breakLeaseCommon(container, name, headers)
}
// BreakLeaseWithBreakPeriod breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
// breakPeriodInSeconds is used to determine how long until new lease can be created.
// Returns the timeout remaining in the lease in seconds
func (b BlobStorageClient) BreakLeaseWithBreakPeriod(container string, name string, breakPeriodInSeconds int) (breakTimeout int, err error) {
headers := b.client.getStandardHeaders()
headers[leaseAction] = breakLease
headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds)
return b.breakLeaseCommon(container, name, headers)
}
// breakLeaseCommon is common code for both version of BreakLease (with and without break period)
func (b BlobStorageClient) breakLeaseCommon(container string, name string, headers map[string]string) (breakTimeout int, err error) {
respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusAccepted)
if err != nil {
return 0, err
}
breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime))
if breakTimeoutStr != "" {
breakTimeout, err = strconv.Atoi(breakTimeoutStr)
if err != nil {
return 0, err
}
}
return breakTimeout, nil
}
// ChangeLease changes a lease ID for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
// Returns the new LeaseID acquired
func (b BlobStorageClient) ChangeLease(container string, name string, currentLeaseID string, proposedLeaseID string) (newLeaseID string, err error) {
headers := b.client.getStandardHeaders()
headers[leaseAction] = changeLease
headers[leaseID] = currentLeaseID
headers[leaseProposedID] = proposedLeaseID
respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil {
return "", err
}
newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID))
if newLeaseID != "" {
return newLeaseID, nil
}
return "", errors.New("LeaseID not returned")
}
// ReleaseLease releases the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
func (b BlobStorageClient) ReleaseLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders()
headers[leaseAction] = releaseLease
headers[leaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil {
return err
}
return nil
}
// RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
func (b BlobStorageClient) RenewLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders()
headers[leaseAction] = renewLease
headers[leaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil {
return err
}
return nil
}
// GetBlobProperties provides various information about the specified // GetBlobProperties provides various information about the specified
// blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx // blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) { func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) {
@ -961,15 +1301,20 @@ func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, ext
// //
// See https://msdn.microsoft.com/en-us/library/azure/dd894037.aspx // See https://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
func (b BlobStorageClient) CopyBlob(container, name, sourceBlob string) error { func (b BlobStorageClient) CopyBlob(container, name, sourceBlob string) error {
copyID, err := b.startBlobCopy(container, name, sourceBlob) copyID, err := b.StartBlobCopy(container, name, sourceBlob)
if err != nil { if err != nil {
return err return err
} }
return b.waitForBlobCopy(container, name, copyID) return b.WaitForBlobCopy(container, name, copyID)
} }
func (b BlobStorageClient) startBlobCopy(container, name, sourceBlob string) (string, error) { // StartBlobCopy starts a blob copy operation.
// sourceBlob parameter must be a canonical URL to the blob (can be
// obtained using GetBlobURL method.)
//
// See https://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
func (b BlobStorageClient) StartBlobCopy(container, name, sourceBlob string) (string, error) {
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
@ -992,7 +1337,39 @@ func (b BlobStorageClient) startBlobCopy(container, name, sourceBlob string) (st
return copyID, nil return copyID, nil
} }
func (b BlobStorageClient) waitForBlobCopy(container, name, copyID string) error { // AbortBlobCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function.
// copyID is generated from StartBlobCopy function.
// currentLeaseID is required IF the destination blob has an active lease on it.
// As defined in https://msdn.microsoft.com/en-us/library/azure/jj159098.aspx
func (b BlobStorageClient) AbortBlobCopy(container, name, copyID, currentLeaseID string, timeout int) error {
params := url.Values{"comp": {"copy"}, "copyid": {copyID}}
if timeout > 0 {
params.Add("timeout", strconv.Itoa(timeout))
}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
headers := b.client.getStandardHeaders()
headers["x-ms-copy-action"] = "abort"
if currentLeaseID != "" {
headers[leaseID] = currentLeaseID
}
resp, err := b.client.exec("PUT", uri, headers, nil)
if err != nil {
return err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil {
return err
}
return nil
}
// WaitForBlobCopy loops until a BlobCopy operation is completed (or fails with error)
func (b BlobStorageClient) WaitForBlobCopy(container, name, copyID string) error {
for { for {
props, err := b.GetBlobProperties(container, name) props, err := b.GetBlobProperties(container, name)
if err != nil { if err != nil {
@ -1036,10 +1413,12 @@ func (b BlobStorageClient) DeleteBlob(container, name string, extraHeaders map[s
// See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx // See https://msdn.microsoft.com/en-us/library/azure/dd179413.aspx
func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeaders map[string]string) (bool, error) { func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeaders map[string]string) (bool, error) {
resp, err := b.deleteBlob(container, name, extraHeaders) resp, err := b.deleteBlob(container, name, extraHeaders)
if resp != nil && (resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound) { if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil return resp.statusCode == http.StatusAccepted, nil
} }
defer resp.body.Close() }
return false, err return false, err
} }
@ -1065,17 +1444,18 @@ func pathForBlob(container, name string) string {
return fmt.Sprintf("/%s/%s", container, name) return fmt.Sprintf("/%s/%s", container, name)
} }
// GetBlobSASURI creates an URL to the specified blob which contains the Shared // GetBlobSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared
// Access Signature with specified permissions and expiration time. // Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed procotols.
// If old API version is used but no signedIP is passed (ie empty string) then this should still work.
// We only populate the signedIP when it non-empty.
// //
// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx // See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx
func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Time, permissions string) (string, error) { func (b BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol(container, name string, expiry time.Time, permissions string, signedIPRange string, HTTPSOnly bool) (string, error) {
var ( var (
signedPermissions = permissions signedPermissions = permissions
blobURL = b.GetBlobURL(container, name) blobURL = b.GetBlobURL(container, name)
) )
canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL) canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -1087,7 +1467,6 @@ func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Tim
// We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component). // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component).
canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1) canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1)
canonicalizedResource, err = url.QueryUnescape(canonicalizedResource) canonicalizedResource, err = url.QueryUnescape(canonicalizedResource)
if err != nil { if err != nil {
return "", err return "", err
@ -1096,7 +1475,11 @@ func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Tim
signedExpiry := expiry.UTC().Format(time.RFC3339) signedExpiry := expiry.UTC().Format(time.RFC3339)
signedResource := "b" signedResource := "b"
stringToSign, err := blobSASStringToSign(b.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions) protocols := "https,http"
if HTTPSOnly {
protocols = "https"
}
stringToSign, err := blobSASStringToSign(b.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions, signedIPRange, protocols)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -1110,6 +1493,13 @@ func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Tim
"sig": {sig}, "sig": {sig},
} }
if b.client.apiVersion >= "2015-04-05" {
sasParams.Add("spr", protocols)
if signedIPRange != "" {
sasParams.Add("sip", signedIPRange)
}
}
sasURL, err := url.Parse(blobURL) sasURL, err := url.Parse(blobURL)
if err != nil { if err != nil {
return "", err return "", err
@ -1118,16 +1508,89 @@ func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Tim
return sasURL.String(), nil return sasURL.String(), nil
} }
func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, signedPermissions string) (string, error) { // GetBlobSASURI creates an URL to the specified blob which contains the Shared
// Access Signature with specified permissions and expiration time.
//
// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx
func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Time, permissions string) (string, error) {
url, err := b.GetBlobSASURIWithSignedIPAndProtocol(container, name, expiry, permissions, "", false)
return url, err
}
func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, signedPermissions string, signedIP string, protocols string) (string, error) {
var signedStart, signedIdentifier, rscc, rscd, rsce, rscl, rsct string var signedStart, signedIdentifier, rscc, rscd, rsce, rscl, rsct string
if signedVersion >= "2015-02-21" { if signedVersion >= "2015-02-21" {
canonicalizedResource = "/blob" + canonicalizedResource canonicalizedResource = "/blob" + canonicalizedResource
} }
// https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12
if signedVersion >= "2015-04-05" {
return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, rscc, rscd, rsce, rscl, rsct), nil
}
// reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx
if signedVersion >= "2013-08-15" { if signedVersion >= "2013-08-15" {
return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil
} }
return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15") return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15")
} }
func generatePermissions(accessPolicy AccessPolicyDetails) (permissions string) {
// generate the permissions string (rwd).
// still want the end user API to have bool flags.
permissions = ""
if accessPolicy.CanRead {
permissions += "r"
}
if accessPolicy.CanWrite {
permissions += "w"
}
if accessPolicy.CanDelete {
permissions += "d"
}
return permissions
}
// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the
// AccessPolicy struct which will get converted to XML.
func convertAccessPolicyToXMLStructs(accessPolicy AccessPolicyDetails) SignedIdentifiers {
return SignedIdentifiers{
SignedIdentifiers: []SignedIdentifier{
{
ID: accessPolicy.ID,
AccessPolicy: AccessPolicyDetailsXML{
StartTime: accessPolicy.StartTime.UTC().Round(time.Second),
ExpiryTime: accessPolicy.ExpiryTime.UTC().Round(time.Second),
Permission: generatePermissions(accessPolicy),
},
},
},
}
}
// generateAccessPolicy generates the XML access policy used as the payload for SetContainerPermissions.
func generateAccessPolicy(accessPolicy AccessPolicyDetails) (accessPolicyXML string, err error) {
if accessPolicy.ID != "" {
signedIdentifiers := convertAccessPolicyToXMLStructs(accessPolicy)
body, _, err := xmlMarshal(signedIdentifiers)
if err != nil {
return "", err
}
xmlByteArray, err := ioutil.ReadAll(body)
if err != nil {
return "", err
}
accessPolicyXML = string(xmlByteArray)
return accessPolicyXML, nil
}
return "", nil
}

View File

@ -128,6 +128,7 @@ func NewBasicClient(accountName, accountKey string) (Client, error) {
return NewEmulatorClient() return NewEmulatorClient()
} }
return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS) return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS)
} }
//NewEmulatorClient contructs a Client intended to only work with Azure //NewEmulatorClient contructs a Client intended to only work with Azure
@ -305,7 +306,7 @@ func (c Client) buildCanonicalizedResourceTable(uri string) (string, error) {
cr := "/" + c.getCanonicalizedAccountName() cr := "/" + c.getCanonicalizedAccountName()
if len(u.Path) > 0 { if len(u.Path) > 0 {
cr += u.Path cr += u.EscapedPath()
} }
return cr, nil return cr, nil

View File

@ -1,9 +1,14 @@
package storage package storage
import ( import (
"encoding/xml"
"errors"
"fmt" "fmt"
"io"
"net/http" "net/http"
"net/url" "net/url"
"strconv"
"strings"
) )
// FileServiceClient contains operations for Microsoft Azure File Service. // FileServiceClient contains operations for Microsoft Azure File Service.
@ -11,31 +16,486 @@ type FileServiceClient struct {
client Client client Client
} }
// pathForFileShare returns the URL path segment for a File Share resource // A Share is an entry in ShareListResponse.
func pathForFileShare(name string) string { type Share struct {
return fmt.Sprintf("/%s", name) Name string `xml:"Name"`
Properties ShareProperties `xml:"Properties"`
} }
// CreateShare operation creates a new share under the specified account. If the // A Directory is an entry in DirsAndFilesListResponse.
// share with the same name already exists, the operation fails. type Directory struct {
Name string `xml:"Name"`
}
// A File is an entry in DirsAndFilesListResponse.
type File struct {
Name string `xml:"Name"`
Properties FileProperties `xml:"Properties"`
}
// ShareProperties contains various properties of a share returned from
// various endpoints like ListShares.
type ShareProperties struct {
LastModified string `xml:"Last-Modified"`
Etag string `xml:"Etag"`
Quota string `xml:"Quota"`
}
// DirectoryProperties contains various properties of a directory returned
// from various endpoints like GetDirectoryProperties.
type DirectoryProperties struct {
LastModified string `xml:"Last-Modified"`
Etag string `xml:"Etag"`
}
// FileProperties contains various properties of a file returned from
// various endpoints like ListDirsAndFiles.
type FileProperties struct {
CacheControl string `header:"x-ms-cache-control"`
ContentLength uint64 `xml:"Content-Length"`
ContentType string `header:"x-ms-content-type"`
CopyCompletionTime string
CopyID string
CopySource string
CopyProgress string
CopyStatusDesc string
CopyStatus string
Disposition string `header:"x-ms-content-disposition"`
Encoding string `header:"x-ms-content-encoding"`
Etag string
Language string `header:"x-ms-content-language"`
LastModified string
MD5 string `header:"x-ms-content-md5"`
}
// FileStream contains file data returned from a call to GetFile.
type FileStream struct {
Body io.ReadCloser
Properties *FileProperties
Metadata map[string]string
}
// ShareListResponse contains the response fields from
// ListShares call.
// //
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx // See https://msdn.microsoft.com/en-us/library/azure/dn167009.aspx
func (f FileServiceClient) CreateShare(name string) error { type ShareListResponse struct {
resp, err := f.createShare(name) XMLName xml.Name `xml:"EnumerationResults"`
Xmlns string `xml:"xmlns,attr"`
Prefix string `xml:"Prefix"`
Marker string `xml:"Marker"`
NextMarker string `xml:"NextMarker"`
MaxResults int64 `xml:"MaxResults"`
Shares []Share `xml:"Shares>Share"`
}
// ListSharesParameters defines the set of customizable parameters to make a
// List Shares call.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn167009.aspx
type ListSharesParameters struct {
Prefix string
Marker string
Include string
MaxResults uint
Timeout uint
}
// DirsAndFilesListResponse contains the response fields from
// a List Files and Directories call.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx
type DirsAndFilesListResponse struct {
XMLName xml.Name `xml:"EnumerationResults"`
Xmlns string `xml:"xmlns,attr"`
Marker string `xml:"Marker"`
MaxResults int64 `xml:"MaxResults"`
Directories []Directory `xml:"Entries>Directory"`
Files []File `xml:"Entries>File"`
NextMarker string `xml:"NextMarker"`
}
// FileRanges contains a list of file range information for a file.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx
type FileRanges struct {
ContentLength uint64
LastModified string
ETag string
FileRanges []FileRange `xml:"Range"`
}
// FileRange contains range information for a file.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx
type FileRange struct {
Start uint64 `xml:"Start"`
End uint64 `xml:"End"`
}
// ListDirsAndFilesParameters defines the set of customizable parameters to
// make a List Files and Directories call.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx
type ListDirsAndFilesParameters struct {
Marker string
MaxResults uint
Timeout uint
}
// ShareHeaders contains various properties of a file and is an entry
// in SetShareProperties
type ShareHeaders struct {
Quota string `header:"x-ms-share-quota"`
}
type compType string
const (
compNone compType = ""
compList compType = "list"
compMetadata compType = "metadata"
compProperties compType = "properties"
compRangeList compType = "rangelist"
)
func (ct compType) String() string {
return string(ct)
}
type resourceType string
const (
resourceDirectory resourceType = "directory"
resourceFile resourceType = ""
resourceShare resourceType = "share"
)
func (rt resourceType) String() string {
return string(rt)
}
func (p ListSharesParameters) getParameters() url.Values {
out := url.Values{}
if p.Prefix != "" {
out.Set("prefix", p.Prefix)
}
if p.Marker != "" {
out.Set("marker", p.Marker)
}
if p.Include != "" {
out.Set("include", p.Include)
}
if p.MaxResults != 0 {
out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults))
}
if p.Timeout != 0 {
out.Set("timeout", fmt.Sprintf("%v", p.Timeout))
}
return out
}
func (p ListDirsAndFilesParameters) getParameters() url.Values {
out := url.Values{}
if p.Marker != "" {
out.Set("marker", p.Marker)
}
if p.MaxResults != 0 {
out.Set("maxresults", fmt.Sprintf("%v", p.MaxResults))
}
if p.Timeout != 0 {
out.Set("timeout", fmt.Sprintf("%v", p.Timeout))
}
return out
}
func (fr FileRange) String() string {
return fmt.Sprintf("bytes=%d-%d", fr.Start, fr.End)
}
// ToPathSegment returns the URL path segment for the specified values
func ToPathSegment(parts ...string) string {
join := strings.Join(parts, "/")
if join[0] != '/' {
join = fmt.Sprintf("/%s", join)
}
return join
}
// returns url.Values for the specified types
func getURLInitValues(comp compType, res resourceType) url.Values {
values := url.Values{}
if comp != compNone {
values.Set("comp", comp.String())
}
if res != resourceFile {
values.Set("restype", res.String())
}
return values
}
// ListDirsAndFiles returns a list of files or directories under the specified share or
// directory. It also contains a pagination token and other response details.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx
func (f FileServiceClient) ListDirsAndFiles(path string, params ListDirsAndFilesParameters) (DirsAndFilesListResponse, error) {
q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory))
var out DirsAndFilesListResponse
resp, err := f.listContent(path, q, nil)
if err != nil {
return out, err
}
defer resp.body.Close()
err = xmlUnmarshal(resp.body, &out)
return out, err
}
// ListFileRanges returns the list of valid ranges for a file.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166984.aspx
func (f FileServiceClient) ListFileRanges(path string, listRange *FileRange) (FileRanges, error) {
params := url.Values{"comp": {"rangelist"}}
// add optional range to list
var headers map[string]string
if listRange != nil {
headers = make(map[string]string)
headers["Range"] = listRange.String()
}
var out FileRanges
resp, err := f.listContent(path, params, headers)
if err != nil {
return out, err
}
defer resp.body.Close()
var cl uint64
cl, err = strconv.ParseUint(resp.headers.Get("x-ms-content-length"), 10, 64)
if err != nil {
return out, err
}
out.ContentLength = cl
out.ETag = resp.headers.Get("ETag")
out.LastModified = resp.headers.Get("Last-Modified")
err = xmlUnmarshal(resp.body, &out)
return out, err
}
// ListShares returns the list of shares in a storage account along with
// pagination token and other response details.
//
// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
func (f FileServiceClient) ListShares(params ListSharesParameters) (ShareListResponse, error) {
q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}})
var out ShareListResponse
resp, err := f.listContent("", q, nil)
if err != nil {
return out, err
}
defer resp.body.Close()
err = xmlUnmarshal(resp.body, &out)
return out, err
}
// retrieves directory or share content
func (f FileServiceClient) listContent(path string, params url.Values, extraHeaders map[string]string) (*storageResponse, error) {
if err := f.checkForStorageEmulator(); err != nil {
return nil, err
}
uri := f.client.getEndpoint(fileServiceName, path, params)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
resp, err := f.client.exec(http.MethodGet, uri, headers, nil)
if err != nil {
return nil, err
}
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
resp.body.Close()
return nil, err
}
return resp, nil
}
// CreateDirectory operation creates a new directory with optional metadata in the
// specified share. If a directory with the same name already exists, the operation fails.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166993.aspx
func (f FileServiceClient) CreateDirectory(path string, metadata map[string]string) error {
return f.createResource(path, resourceDirectory, mergeMDIntoExtraHeaders(metadata, nil))
}
// CreateFile operation creates a new file with optional metadata or replaces an existing one.
// Note that this only initializes the file, call PutRange to add content.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn194271.aspx
func (f FileServiceClient) CreateFile(path string, maxSize uint64, metadata map[string]string) error {
extraHeaders := map[string]string{
"x-ms-content-length": strconv.FormatUint(maxSize, 10),
"x-ms-type": "file",
}
return f.createResource(path, resourceFile, mergeMDIntoExtraHeaders(metadata, extraHeaders))
}
// ClearRange releases the specified range of space in storage.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn194276.aspx
func (f FileServiceClient) ClearRange(path string, fileRange FileRange) error {
return f.modifyRange(path, nil, fileRange)
}
// PutRange writes a range of bytes to a file. Note that the length of bytes must
// match (rangeEnd - rangeStart) + 1 with a maximum size of 4MB.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn194276.aspx
func (f FileServiceClient) PutRange(path string, bytes io.Reader, fileRange FileRange) error {
return f.modifyRange(path, bytes, fileRange)
}
// modifies a range of bytes in the specified file
func (f FileServiceClient) modifyRange(path string, bytes io.Reader, fileRange FileRange) error {
if err := f.checkForStorageEmulator(); err != nil {
return err
}
if fileRange.End < fileRange.Start {
return errors.New("the value for rangeEnd must be greater than or equal to rangeStart")
}
if bytes != nil && fileRange.End-fileRange.Start > 4194304 {
return errors.New("range cannot exceed 4MB in size")
}
uri := f.client.getEndpoint(fileServiceName, path, url.Values{"comp": {"range"}})
// default to clear
write := "clear"
cl := uint64(0)
// if bytes is not nil then this is an update operation
if bytes != nil {
write = "update"
cl = (fileRange.End - fileRange.Start) + 1
}
extraHeaders := map[string]string{
"Content-Length": strconv.FormatUint(cl, 10),
"Range": fileRange.String(),
"x-ms-write": write,
}
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
resp, err := f.client.exec(http.MethodPut, uri, headers, bytes)
if err != nil { if err != nil {
return err return err
} }
defer resp.body.Close() defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusCreated}) return checkRespCode(resp.statusCode, []int{http.StatusCreated})
} }
// CreateShareIfNotExists creates a new share under the specified account if // GetFile operation reads or downloads a file from the system, including its
// it does not exist. Returns true if container is newly created or false if // metadata and properties.
// container already exists. //
// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file
func (f FileServiceClient) GetFile(path string, fileRange *FileRange) (*FileStream, error) {
var extraHeaders map[string]string
if fileRange != nil {
extraHeaders = map[string]string{
"Range": fileRange.String(),
}
}
resp, err := f.getResourceNoClose(path, compNone, resourceFile, http.MethodGet, extraHeaders)
if err != nil {
return nil, err
}
if err = checkRespCode(resp.statusCode, []int{http.StatusOK, http.StatusPartialContent}); err != nil {
resp.body.Close()
return nil, err
}
props, err := getFileProps(resp.headers)
md := getFileMDFromHeaders(resp.headers)
return &FileStream{Body: resp.body, Properties: props, Metadata: md}, nil
}
// CreateShare operation creates a new share with optional metadata under the specified account.
// If the share with the same name already exists, the operation fails.
// //
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx // See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
func (f FileServiceClient) CreateShareIfNotExists(name string) (bool, error) { func (f FileServiceClient) CreateShare(name string, metadata map[string]string) error {
resp, err := f.createShare(name) return f.createResource(ToPathSegment(name), resourceShare, mergeMDIntoExtraHeaders(metadata, nil))
}
// DirectoryExists returns true if the specified directory exists on the specified share.
func (f FileServiceClient) DirectoryExists(path string) (bool, error) {
return f.resourceExists(path, resourceDirectory)
}
// FileExists returns true if the specified file exists.
func (f FileServiceClient) FileExists(path string) (bool, error) {
return f.resourceExists(path, resourceFile)
}
// ShareExists returns true if a share with given name exists
// on the storage account, otherwise returns false.
func (f FileServiceClient) ShareExists(name string) (bool, error) {
return f.resourceExists(ToPathSegment(name), resourceShare)
}
// returns true if the specified directory or share exists
func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, error) {
if err := f.checkForStorageEmulator(); err != nil {
return false, err
}
uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res))
headers := f.client.getStandardHeaders()
resp, err := f.client.exec(http.MethodHead, uri, headers, nil)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound {
return resp.statusCode == http.StatusOK, nil
}
}
return false, err
}
// GetDirectoryURL gets the canonical URL to the directory with the specified name
// in the specified share. This method does not create a publicly accessible URL if
// the file is private and this method does not check if the directory exists.
func (f FileServiceClient) GetDirectoryURL(path string) string {
return f.client.getEndpoint(fileServiceName, path, url.Values{})
}
// GetShareURL gets the canonical URL to the share with the specified name in the
// specified container. This method does not create a publicly accessible URL if
// the file is private and this method does not check if the share exists.
func (f FileServiceClient) GetShareURL(name string) string {
return f.client.getEndpoint(fileServiceName, ToPathSegment(name), url.Values{})
}
// CreateDirectoryIfNotExists creates a new directory on the specified share
// if it does not exist. Returns true if directory is newly created or false
// if the directory already exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166993.aspx
func (f FileServiceClient) CreateDirectoryIfNotExists(path string) (bool, error) {
resp, err := f.createResourceNoClose(path, resourceDirectory, nil)
if resp != nil { if resp != nil {
defer resp.body.Close() defer resp.body.Close()
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict {
@ -45,14 +505,175 @@ func (f FileServiceClient) CreateShareIfNotExists(name string) (bool, error) {
return false, err return false, err
} }
// CreateShare creates a Azure File Share and returns its response // CreateShareIfNotExists creates a new share under the specified account if
func (f FileServiceClient) createShare(name string) (*storageResponse, error) { // it does not exist. Returns true if container is newly created or false if
// container already exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
func (f FileServiceClient) CreateShareIfNotExists(name string) (bool, error) {
resp, err := f.createResourceNoClose(ToPathSegment(name), resourceShare, nil)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict {
return resp.statusCode == http.StatusCreated, nil
}
}
return false, err
}
// creates a resource depending on the specified resource type
func (f FileServiceClient) createResource(path string, res resourceType, extraHeaders map[string]string) error {
resp, err := f.createResourceNoClose(path, res, extraHeaders)
if err != nil {
return err
}
defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusCreated})
}
// creates a resource depending on the specified resource type, doesn't close the response body
func (f FileServiceClient) createResourceNoClose(path string, res resourceType, extraHeaders map[string]string) (*storageResponse, error) {
if err := f.checkForStorageEmulator(); err != nil { if err := f.checkForStorageEmulator(); err != nil {
return nil, err return nil, err
} }
uri := f.client.getEndpoint(fileServiceName, pathForFileShare(name), url.Values{"restype": {"share"}})
headers := f.client.getStandardHeaders() values := getURLInitValues(compNone, res)
return f.client.exec("PUT", uri, headers, nil) uri := f.client.getEndpoint(fileServiceName, path, values)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
return f.client.exec(http.MethodPut, uri, headers, nil)
}
// GetDirectoryProperties provides various information about the specified directory.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn194272.aspx
func (f FileServiceClient) GetDirectoryProperties(path string) (*DirectoryProperties, error) {
headers, err := f.getResourceHeaders(path, compNone, resourceDirectory, http.MethodHead)
if err != nil {
return nil, err
}
return &DirectoryProperties{
LastModified: headers.Get("Last-Modified"),
Etag: headers.Get("Etag"),
}, nil
}
// GetFileProperties provides various information about the specified file.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166971.aspx
func (f FileServiceClient) GetFileProperties(path string) (*FileProperties, error) {
headers, err := f.getResourceHeaders(path, compNone, resourceFile, http.MethodHead)
if err != nil {
return nil, err
}
return getFileProps(headers)
}
// returns file properties from the specified HTTP header
func getFileProps(header http.Header) (*FileProperties, error) {
size, err := strconv.ParseUint(header.Get("Content-Length"), 10, 64)
if err != nil {
return nil, err
}
return &FileProperties{
CacheControl: header.Get("Cache-Control"),
ContentLength: size,
ContentType: header.Get("Content-Type"),
CopyCompletionTime: header.Get("x-ms-copy-completion-time"),
CopyID: header.Get("x-ms-copy-id"),
CopyProgress: header.Get("x-ms-copy-progress"),
CopySource: header.Get("x-ms-copy-source"),
CopyStatus: header.Get("x-ms-copy-status"),
CopyStatusDesc: header.Get("x-ms-copy-status-description"),
Disposition: header.Get("Content-Disposition"),
Encoding: header.Get("Content-Encoding"),
Etag: header.Get("ETag"),
Language: header.Get("Content-Language"),
LastModified: header.Get("Last-Modified"),
MD5: header.Get("Content-MD5"),
}, nil
}
// GetShareProperties provides various information about the specified
// file. See https://msdn.microsoft.com/en-us/library/azure/dn689099.aspx
func (f FileServiceClient) GetShareProperties(name string) (*ShareProperties, error) {
headers, err := f.getResourceHeaders(ToPathSegment(name), compNone, resourceShare, http.MethodHead)
if err != nil {
return nil, err
}
return &ShareProperties{
LastModified: headers.Get("Last-Modified"),
Etag: headers.Get("Etag"),
Quota: headers.Get("x-ms-share-quota"),
}, nil
}
// returns HTTP header data for the specified directory or share
func (f FileServiceClient) getResourceHeaders(path string, comp compType, res resourceType, verb string) (http.Header, error) {
resp, err := f.getResourceNoClose(path, comp, res, verb, nil)
if err != nil {
return nil, err
}
defer resp.body.Close()
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return nil, err
}
return resp.headers, nil
}
// gets the specified resource, doesn't close the response body
func (f FileServiceClient) getResourceNoClose(path string, comp compType, res resourceType, verb string, extraHeaders map[string]string) (*storageResponse, error) {
if err := f.checkForStorageEmulator(); err != nil {
return nil, err
}
params := getURLInitValues(comp, res)
uri := f.client.getEndpoint(fileServiceName, path, params)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
return f.client.exec(verb, uri, headers, nil)
}
// SetFileProperties operation sets system properties on the specified file.
//
// Some keys may be converted to Camel-Case before sending. All keys
// are returned in lower case by SetFileProperties. HTTP header names
// are case-insensitive so case munging should not matter to other
// applications either.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166975.aspx
func (f FileServiceClient) SetFileProperties(path string, props FileProperties) error {
return f.setResourceHeaders(path, compProperties, resourceFile, headersFromStruct(props))
}
// SetShareProperties replaces the ShareHeaders for the specified file.
//
// Some keys may be converted to Camel-Case before sending. All keys
// are returned in lower case by SetShareProperties. HTTP header names
// are case-insensitive so case munging should not matter to other
// applications either.
//
// See https://msdn.microsoft.com/en-us/library/azure/mt427368.aspx
func (f FileServiceClient) SetShareProperties(name string, shareHeaders ShareHeaders) error {
return f.setResourceHeaders(ToPathSegment(name), compProperties, resourceShare, headersFromStruct(shareHeaders))
}
// DeleteDirectory operation removes the specified empty directory.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166969.aspx
func (f FileServiceClient) DeleteDirectory(path string) error {
return f.deleteResource(path, resourceDirectory)
}
// DeleteFile operation immediately removes the file from the storage account.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn689085.aspx
func (f FileServiceClient) DeleteFile(path string) error {
return f.deleteResource(path, resourceFile)
} }
// DeleteShare operation marks the specified share for deletion. The share // DeleteShare operation marks the specified share for deletion. The share
@ -61,12 +682,7 @@ func (f FileServiceClient) createShare(name string) (*storageResponse, error) {
// //
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx // See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
func (f FileServiceClient) DeleteShare(name string) error { func (f FileServiceClient) DeleteShare(name string) error {
resp, err := f.deleteShare(name) return f.deleteResource(ToPathSegment(name), resourceShare)
if err != nil {
return err
}
defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusAccepted})
} }
// DeleteShareIfExists operation marks the specified share for deletion if it // DeleteShareIfExists operation marks the specified share for deletion if it
@ -76,7 +692,7 @@ func (f FileServiceClient) DeleteShare(name string) error {
// //
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx // See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
func (f FileServiceClient) DeleteShareIfExists(name string) (bool, error) { func (f FileServiceClient) DeleteShareIfExists(name string) (bool, error) {
resp, err := f.deleteShare(name) resp, err := f.deleteResourceNoClose(ToPathSegment(name), resourceShare)
if resp != nil { if resp != nil {
defer resp.body.Close() defer resp.body.Close()
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound {
@ -86,14 +702,170 @@ func (f FileServiceClient) DeleteShareIfExists(name string) (bool, error) {
return false, err return false, err
} }
// deleteShare makes the call to Delete Share operation endpoint and returns // deletes the resource and returns the response
// the response func (f FileServiceClient) deleteResource(path string, res resourceType) error {
func (f FileServiceClient) deleteShare(name string) (*storageResponse, error) { resp, err := f.deleteResourceNoClose(path, res)
if err != nil {
return err
}
defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusAccepted})
}
// deletes the resource and returns the response, doesn't close the response body
func (f FileServiceClient) deleteResourceNoClose(path string, res resourceType) (*storageResponse, error) {
if err := f.checkForStorageEmulator(); err != nil { if err := f.checkForStorageEmulator(); err != nil {
return nil, err return nil, err
} }
uri := f.client.getEndpoint(fileServiceName, pathForFileShare(name), url.Values{"restype": {"share"}})
return f.client.exec("DELETE", uri, f.client.getStandardHeaders(), nil) values := getURLInitValues(compNone, res)
uri := f.client.getEndpoint(fileServiceName, path, values)
return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil)
}
// SetDirectoryMetadata replaces the metadata for the specified directory.
//
// Some keys may be converted to Camel-Case before sending. All keys
// are returned in lower case by GetDirectoryMetadata. HTTP header names
// are case-insensitive so case munging should not matter to other
// applications either.
//
// See https://msdn.microsoft.com/en-us/library/azure/mt427370.aspx
func (f FileServiceClient) SetDirectoryMetadata(path string, metadata map[string]string) error {
return f.setResourceHeaders(path, compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(metadata, nil))
}
// SetFileMetadata replaces the metadata for the specified file.
//
// Some keys may be converted to Camel-Case before sending. All keys
// are returned in lower case by GetFileMetadata. HTTP header names
// are case-insensitive so case munging should not matter to other
// applications either.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn689097.aspx
func (f FileServiceClient) SetFileMetadata(path string, metadata map[string]string) error {
return f.setResourceHeaders(path, compMetadata, resourceFile, mergeMDIntoExtraHeaders(metadata, nil))
}
// SetShareMetadata replaces the metadata for the specified Share.
//
// Some keys may be converted to Camel-Case before sending. All keys
// are returned in lower case by GetShareMetadata. HTTP header names
// are case-insensitive so case munging should not matter to other
// applications either.
//
// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
func (f FileServiceClient) SetShareMetadata(name string, metadata map[string]string) error {
return f.setResourceHeaders(ToPathSegment(name), compMetadata, resourceShare, mergeMDIntoExtraHeaders(metadata, nil))
}
// merges metadata into extraHeaders and returns extraHeaders
func mergeMDIntoExtraHeaders(metadata, extraHeaders map[string]string) map[string]string {
if metadata == nil && extraHeaders == nil {
return nil
}
if extraHeaders == nil {
extraHeaders = make(map[string]string)
}
for k, v := range metadata {
extraHeaders[userDefinedMetadataHeaderPrefix+k] = v
}
return extraHeaders
}
// merges extraHeaders into headers and returns headers
func mergeHeaders(headers, extraHeaders map[string]string) map[string]string {
for k, v := range extraHeaders {
headers[k] = v
}
return headers
}
// sets extra header data for the specified resource
func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string) error {
if err := f.checkForStorageEmulator(); err != nil {
return err
}
params := getURLInitValues(comp, res)
uri := f.client.getEndpoint(fileServiceName, path, params)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
resp, err := f.client.exec(http.MethodPut, uri, headers, nil)
if err != nil {
return err
}
defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusOK})
}
// GetDirectoryMetadata returns all user-defined metadata for the specified directory.
//
// All metadata keys will be returned in lower case. (HTTP header
// names are case-insensitive.)
//
// See https://msdn.microsoft.com/en-us/library/azure/mt427371.aspx
func (f FileServiceClient) GetDirectoryMetadata(path string) (map[string]string, error) {
return f.getMetadata(path, resourceDirectory)
}
// GetFileMetadata returns all user-defined metadata for the specified file.
//
// All metadata keys will be returned in lower case. (HTTP header
// names are case-insensitive.)
//
// See https://msdn.microsoft.com/en-us/library/azure/dn689098.aspx
func (f FileServiceClient) GetFileMetadata(path string) (map[string]string, error) {
return f.getMetadata(path, resourceFile)
}
// GetShareMetadata returns all user-defined metadata for the specified share.
//
// All metadata keys will be returned in lower case. (HTTP header
// names are case-insensitive.)
//
// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
func (f FileServiceClient) GetShareMetadata(name string) (map[string]string, error) {
return f.getMetadata(ToPathSegment(name), resourceShare)
}
// gets metadata for the specified resource
func (f FileServiceClient) getMetadata(path string, res resourceType) (map[string]string, error) {
if err := f.checkForStorageEmulator(); err != nil {
return nil, err
}
headers, err := f.getResourceHeaders(path, compMetadata, res, http.MethodGet)
if err != nil {
return nil, err
}
return getFileMDFromHeaders(headers), nil
}
// returns a map of custom metadata values from the specified HTTP header
func getFileMDFromHeaders(header http.Header) map[string]string {
metadata := make(map[string]string)
for k, v := range header {
// Can't trust CanonicalHeaderKey() to munge case
// reliably. "_" is allowed in identifiers:
// https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
// https://msdn.microsoft.com/library/aa664670(VS.71).aspx
// http://tools.ietf.org/html/rfc7230#section-3.2
// ...but "_" is considered invalid by
// CanonicalMIMEHeaderKey in
// https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542
// so k can be "X-Ms-Meta-Foo" or "x-ms-meta-foo_bar".
k = strings.ToLower(k)
if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) {
continue
}
// metadata["foo"] = content of the last X-Ms-Meta-Foo header
k = k[len(userDefinedMetadataHeaderPrefix):]
metadata[k] = v[len(v)-1]
}
return metadata
} }
//checkForStorageEmulator determines if the client is setup for use with //checkForStorageEmulator determines if the client is setup for use with

View File

@ -82,6 +82,24 @@ func (p PeekMessagesParameters) getParameters() url.Values {
return out return out
} }
// UpdateMessageParameters is the set of options can be specified for Update Messsage
// operation. A zero struct does not use any preferences for the request.
type UpdateMessageParameters struct {
PopReceipt string
VisibilityTimeout int
}
func (p UpdateMessageParameters) getParameters() url.Values {
out := url.Values{}
if p.PopReceipt != "" {
out.Set("popreceipt", p.PopReceipt)
}
if p.VisibilityTimeout != 0 {
out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout))
}
return out
}
// GetMessagesResponse represents a response returned from Get Messages // GetMessagesResponse represents a response returned from Get Messages
// operation. // operation.
type GetMessagesResponse struct { type GetMessagesResponse struct {
@ -304,3 +322,23 @@ func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) e
defer resp.body.Close() defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
} }
// UpdateMessage operation deletes the specified message.
//
// See https://msdn.microsoft.com/en-us/library/azure/hh452234.aspx
func (c QueueServiceClient) UpdateMessage(queue string, messageID string, message string, params UpdateMessageParameters) error {
uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), params.getParameters())
req := putMessageRequest{MessageText: message}
body, nn, err := xmlMarshal(req)
if err != nil {
return err
}
headers := c.client.getStandardHeaders()
headers["Content-Length"] = fmt.Sprintf("%d", nn)
resp, err := c.client.exec("PUT", uri, headers, body)
if err != nil {
return err
}
defer resp.body.Close()
return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
}

View File

@ -10,6 +10,8 @@ import (
"reflect" "reflect"
) )
// Annotating as secure for gas scanning
/* #nosec */
const ( const (
partitionKeyNode = "PartitionKey" partitionKeyNode = "PartitionKey"
rowKeyNode = "RowKey" rowKeyNode = "RowKey"
@ -98,6 +100,10 @@ func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousCo
resp, err := c.client.execTable("GET", uri, headers, nil) resp, err := c.client.execTable("GET", uri, headers, nil)
if err != nil {
return nil, nil, err
}
contToken := extractContinuationTokenFromHeaders(resp.headers) contToken := extractContinuationTokenFromHeaders(resp.headers)
if err != nil { if err != nil {

View File

@ -77,7 +77,7 @@ func headersFromStruct(v interface{}) map[string]string {
for i := 0; i < value.NumField(); i++ { for i := 0; i < value.NumField(); i++ {
key := value.Type().Field(i).Tag.Get("header") key := value.Type().Field(i).Tag.Get("header")
val := value.Field(i).String() val := value.Field(i).String()
if val != "" { if key != "" && val != "" {
headers[key] = val headers[key] = val
} }
} }

View File

@ -33,6 +33,8 @@ type Environment struct {
TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"`
KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"`
ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"`
ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"`
ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"`
} }
var ( var (
@ -52,6 +54,8 @@ var (
TrafficManagerDNSSuffix: "trafficmanager.net", TrafficManagerDNSSuffix: "trafficmanager.net",
KeyVaultDNSSuffix: "vault.azure.net", KeyVaultDNSSuffix: "vault.azure.net",
ServiceBusEndpointSuffix: "servicebus.azure.com", ServiceBusEndpointSuffix: "servicebus.azure.com",
ServiceManagementVMDNSSuffix: "cloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.azure.com",
} }
// USGovernmentCloud is the cloud environment for the US Government // USGovernmentCloud is the cloud environment for the US Government
@ -70,6 +74,8 @@ var (
TrafficManagerDNSSuffix: "usgovtrafficmanager.net", TrafficManagerDNSSuffix: "usgovtrafficmanager.net",
KeyVaultDNSSuffix: "vault.usgovcloudapi.net", KeyVaultDNSSuffix: "vault.usgovcloudapi.net",
ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net",
ServiceManagementVMDNSSuffix: "usgovcloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us",
} }
// ChinaCloud is the cloud environment operated in China // ChinaCloud is the cloud environment operated in China
@ -88,6 +94,8 @@ var (
TrafficManagerDNSSuffix: "trafficmanager.cn", TrafficManagerDNSSuffix: "trafficmanager.cn",
KeyVaultDNSSuffix: "vault.azure.cn", KeyVaultDNSSuffix: "vault.azure.cn",
ServiceBusEndpointSuffix: "servicebus.chinacloudapi.net", ServiceBusEndpointSuffix: "servicebus.chinacloudapi.net",
ServiceManagementVMDNSSuffix: "chinacloudapp.cn",
ResourceManagerVMDNSSuffix: "cloudapp.azure.cn",
} }
// GermanCloud is the cloud environment operated in Germany // GermanCloud is the cloud environment operated in Germany
@ -106,6 +114,8 @@ var (
TrafficManagerDNSSuffix: "azuretrafficmanager.de", TrafficManagerDNSSuffix: "azuretrafficmanager.de",
KeyVaultDNSSuffix: "vault.microsoftazure.de", KeyVaultDNSSuffix: "vault.microsoftazure.de",
ServiceBusEndpointSuffix: "servicebus.cloudapi.de", ServiceBusEndpointSuffix: "servicebus.cloudapi.de",
ServiceManagementVMDNSSuffix: "azurecloudapp.de",
ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de",
} }
) )
@ -121,8 +131,13 @@ func EnvironmentFromName(name string) (Environment, error) {
// OAuthConfigForTenant returns an OAuthConfig with tenant specific urls // OAuthConfigForTenant returns an OAuthConfig with tenant specific urls
func (env Environment) OAuthConfigForTenant(tenantID string) (*OAuthConfig, error) { func (env Environment) OAuthConfigForTenant(tenantID string) (*OAuthConfig, error) {
return OAuthConfigForTenant(env.ActiveDirectoryEndpoint, tenantID)
}
// OAuthConfigForTenant returns an OAuthConfig with tenant specific urls for target cloud auth endpoint
func OAuthConfigForTenant(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) {
template := "%s/oauth2/%s?api-version=%s" template := "%s/oauth2/%s?api-version=%s"
u, err := url.Parse(env.ActiveDirectoryEndpoint) u, err := url.Parse(activeDirectoryEndpoint)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -91,7 +91,7 @@ type ServicePrincipalNoSecret struct {
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret // SetAuthenticationValues is a method of the interface ServicePrincipalSecret
// It only returns an error for the ServicePrincipalNoSecret type // It only returns an error for the ServicePrincipalNoSecret type
func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token.") return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token")
} }
// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form // ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form
@ -138,7 +138,7 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo
token := jwt.New(jwt.SigningMethodRS256) token := jwt.New(jwt.SigningMethodRS256)
token.Header["x5t"] = thumbprint token.Header["x5t"] = thumbprint
token.Claims = jwt.MapClaims{ token.Claims = jwt.MapClaims{
"aud": spt.oauthConfig.TokenEndpoint, "aud": spt.oauthConfig.TokenEndpoint.String(),
"iss": spt.clientID, "iss": spt.clientID,
"sub": spt.clientID, "sub": spt.clientID,
"jti": base64.URLEncoding.EncodeToString(jti), "jti": base64.URLEncoding.EncodeToString(jti),

View File

@ -20,9 +20,6 @@ const (
// DefaultRetryAttempts is number of attempts for retry status codes (5xx). // DefaultRetryAttempts is number of attempts for retry status codes (5xx).
DefaultRetryAttempts = 3 DefaultRetryAttempts = 3
// DefaultRetryDuration is a resonable delay for retry.
defaultRetryInterval = 30 * time.Second
) )
var statusCodesForRetry = []int{ var statusCodesForRetry = []int{
@ -130,6 +127,9 @@ type Client struct {
// RetryAttempts sets the default number of retry attempts for client. // RetryAttempts sets the default number of retry attempts for client.
RetryAttempts int RetryAttempts int
// RetryDuration sets the delay duration for retries.
RetryDuration time.Duration
// UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent // UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent
// through the Do method. // through the Do method.
UserAgent string UserAgent string
@ -144,6 +144,7 @@ func NewClientWithUserAgent(ua string) Client {
PollingDelay: DefaultPollingDelay, PollingDelay: DefaultPollingDelay,
PollingDuration: DefaultPollingDuration, PollingDuration: DefaultPollingDuration,
RetryAttempts: DefaultRetryAttempts, RetryAttempts: DefaultRetryAttempts,
RetryDuration: 30 * time.Second,
UserAgent: ua, UserAgent: ua,
} }
} }
@ -163,7 +164,7 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed") return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
} }
resp, err := SendWithSender(c.sender(), r, resp, err := SendWithSender(c.sender(), r,
DoRetryForStatusCodes(c.RetryAttempts, defaultRetryInterval, statusCodesForRetry...)) DoRetryForStatusCodes(c.RetryAttempts, c.RetryDuration, statusCodesForRetry...))
Respond(resp, Respond(resp,
c.ByInspecting()) c.ByInspecting())
return resp, err return resp, err

View File

@ -1,12 +1,17 @@
package date package date
import ( import (
"regexp"
"time" "time"
) )
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
const ( const (
azureUtcFormatJSON = `"2006-01-02T15:04:05.999999999"`
azureUtcFormat = "2006-01-02T15:04:05.999999999"
rfc3339JSON = `"` + time.RFC3339Nano + `"` rfc3339JSON = `"` + time.RFC3339Nano + `"`
rfc3339 = time.RFC3339Nano rfc3339 = time.RFC3339Nano
tzOffsetRegex = `(Z|z|\+|-)(\d+:\d+)*"*$`
) )
// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., // Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e.,
@ -36,7 +41,14 @@ func (t Time) MarshalJSON() (json []byte, err error) {
// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time // UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z). // (i.e., 2006-01-02T15:04:05Z).
func (t *Time) UnmarshalJSON(data []byte) (err error) { func (t *Time) UnmarshalJSON(data []byte) (err error) {
t.Time, err = ParseTime(rfc3339JSON, string(data)) timeFormat := azureUtcFormatJSON
match, err := regexp.Match(tzOffsetRegex, data)
if err != nil {
return err
} else if match {
timeFormat = rfc3339JSON
}
t.Time, err = ParseTime(timeFormat, string(data))
return err return err
} }
@ -49,7 +61,14 @@ func (t Time) MarshalText() (text []byte, err error) {
// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time // UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z). // (i.e., 2006-01-02T15:04:05Z).
func (t *Time) UnmarshalText(data []byte) (err error) { func (t *Time) UnmarshalText(data []byte) (err error) {
t.Time, err = ParseTime(rfc3339, string(data)) timeFormat := azureUtcFormat
match, err := regexp.Match(tzOffsetRegex, data)
if err != nil {
return err
} else if match {
timeFormat = rfc3339
}
t.Time, err = ParseTime(timeFormat, string(data))
return err return err
} }

View File

@ -4,7 +4,9 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"io/ioutil" "io/ioutil"
"mime/multipart"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@ -197,6 +199,64 @@ func WithFormData(v url.Values) PrepareDecorator {
} }
} }
// WithMultiPartFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) form parameters
// into the http.Request body.
func WithMultiPartFormData(formDataParameters map[string]interface{}) PrepareDecorator {
return func(p Preparer) Preparer {
return PreparerFunc(func(r *http.Request) (*http.Request, error) {
r, err := p.Prepare(r)
if err == nil {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
for key, value := range formDataParameters {
if rc, ok := value.(io.ReadCloser); ok {
var fd io.Writer
if fd, err = writer.CreateFormFile(key, key); err != nil {
return r, err
}
if _, err = io.Copy(fd, rc); err != nil {
return r, err
}
} else {
if err = writer.WriteField(key, ensureValueString(value)); err != nil {
return r, err
}
}
}
if err = writer.Close(); err != nil {
return r, err
}
if r.Header == nil {
r.Header = make(http.Header)
}
r.Header.Set(http.CanonicalHeaderKey(headerContentType), writer.FormDataContentType())
r.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes()))
r.ContentLength = int64(body.Len())
return r, err
}
return r, err
})
}
}
// WithFile returns a PrepareDecorator that sends file in request body.
func WithFile(f io.ReadCloser) PrepareDecorator {
return func(p Preparer) Preparer {
return PreparerFunc(func(r *http.Request) (*http.Request, error) {
r, err := p.Prepare(r)
if err == nil {
b, err := ioutil.ReadAll(f)
if err != nil {
return r, err
}
r.Body = ioutil.NopCloser(bytes.NewReader(b))
r.ContentLength = int64(len(b))
}
return r, err
})
}
}
// WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request // WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request
// and sets the Content-Length header. // and sets the Content-Length header.
func WithBool(v bool) PrepareDecorator { func WithBool(v bool) PrepareDecorator {

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/url" "net/url"
"reflect"
"sort" "sort"
"strings" "strings"
) )
@ -106,6 +107,22 @@ func ensureValueString(value interface{}) string {
} }
} }
// MapToValues method converts map[string]interface{} to url.Values.
func MapToValues(m map[string]interface{}) url.Values {
v := url.Values{}
for key, value := range m {
x := reflect.ValueOf(value)
if x.Kind() == reflect.Array || x.Kind() == reflect.Slice {
for i := 0; i < x.Len(); i++ {
v.Add(key, ensureValueString(x.Index(i)))
}
} else {
v.Add(key, ensureValueString(value))
}
}
return v
}
// String method converts interface v to string. If interface is a list, it // String method converts interface v to string. If interface is a list, it
// joins list elements using separator. // joins list elements using separator.
func String(v interface{}, sep ...string) string { func String(v interface{}, sep ...string) string {

View File

@ -0,0 +1,373 @@
/*
Package validation provides methods for validating parameter value using reflection.
*/
package validation
import (
"fmt"
"reflect"
"regexp"
"strings"
)
// Constraint stores constraint name, target field name
// Rule and chain validations.
type Constraint struct {
// Target field name for validation.
Target string
// Constraint name e.g. minLength, MaxLength, Pattern, etc.
Name string
// Rule for constraint e.g. greater than 10, less than 5 etc.
Rule interface{}
// Chain Validations for struct type
Chain []Constraint
}
// Validation stores parameter-wise validation.
type Validation struct {
TargetValue interface{}
Constraints []Constraint
}
// Constraint list
const (
Empty = "Empty"
Null = "Null"
ReadOnly = "ReadOnly"
Pattern = "Pattern"
MaxLength = "MaxLength"
MinLength = "MinLength"
MaxItems = "MaxItems"
MinItems = "MinItems"
MultipleOf = "MultipleOf"
UniqueItems = "UniqueItems"
InclusiveMaximum = "InclusiveMaximum"
ExclusiveMaximum = "ExclusiveMaximum"
ExclusiveMinimum = "ExclusiveMinimum"
InclusiveMinimum = "InclusiveMinimum"
)
// Validate method validates constraints on parameter
// passed in validation array.
func Validate(m []Validation) error {
for _, item := range m {
v := reflect.ValueOf(item.TargetValue)
for _, constraint := range item.Constraints {
var err error
switch v.Kind() {
case reflect.Ptr:
err = validatePtr(v, constraint)
case reflect.String:
err = validateString(v, constraint)
case reflect.Struct:
err = validateStruct(v, constraint)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
err = validateInt(v, constraint)
case reflect.Float32, reflect.Float64:
err = validateFloat(v, constraint)
case reflect.Array, reflect.Slice, reflect.Map:
err = validateArrayMap(v, constraint)
default:
err = createError(v, constraint, fmt.Sprintf("unknown type %v", v.Kind()))
}
if err != nil {
return err
}
}
}
return nil
}
func validateStruct(x reflect.Value, v Constraint, name ...string) error {
//Get field name from target name which is in format a.b.c
s := strings.Split(v.Target, ".")
f := x.FieldByName(s[len(s)-1])
if isZero(f) {
return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.Target))
}
if err := Validate([]Validation{
{
TargetValue: getInterfaceValue(f),
Constraints: []Constraint{v},
},
}); err != nil {
return err
}
return nil
}
func validatePtr(x reflect.Value, v Constraint) error {
if v.Name == ReadOnly {
if !x.IsNil() {
return createError(x.Elem(), v, "readonly parameter; must send as nil or empty in request")
}
return nil
}
if x.IsNil() {
return checkNil(x, v)
}
if v.Chain != nil {
return Validate([]Validation{
{
TargetValue: getInterfaceValue(x.Elem()),
Constraints: v.Chain,
},
})
}
return nil
}
func validateInt(x reflect.Value, v Constraint) error {
i := x.Int()
r, ok := v.Rule.(int)
if !ok {
return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule))
}
switch v.Name {
case MultipleOf:
if i%int64(r) != 0 {
return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r))
}
case ExclusiveMinimum:
if i <= int64(r) {
return createError(x, v, fmt.Sprintf("value must be greater than %v", r))
}
case ExclusiveMaximum:
if i >= int64(r) {
return createError(x, v, fmt.Sprintf("value must be less than %v", r))
}
case InclusiveMinimum:
if i < int64(r) {
return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r))
}
case InclusiveMaximum:
if i > int64(r) {
return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r))
}
default:
return createError(x, v, fmt.Sprintf("constraint %v is not applicable for type integer", v.Name))
}
return nil
}
func validateFloat(x reflect.Value, v Constraint) error {
f := x.Float()
r, ok := v.Rule.(float64)
if !ok {
return createError(x, v, fmt.Sprintf("rule must be float value for %v constraint; got: %v", v.Name, v.Rule))
}
switch v.Name {
case ExclusiveMinimum:
if f <= r {
return createError(x, v, fmt.Sprintf("value must be greater than %v", r))
}
case ExclusiveMaximum:
if f >= r {
return createError(x, v, fmt.Sprintf("value must be less than %v", r))
}
case InclusiveMinimum:
if f < r {
return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r))
}
case InclusiveMaximum:
if f > r {
return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r))
}
default:
return createError(x, v, fmt.Sprintf("constraint %s is not applicable for type float", v.Name))
}
return nil
}
func validateString(x reflect.Value, v Constraint) error {
s := x.String()
switch v.Name {
case Empty:
if len(s) == 0 {
return checkEmpty(x, v)
}
case Pattern:
reg, err := regexp.Compile(v.Rule.(string))
if err != nil {
return createError(x, v, err.Error())
}
if !reg.MatchString(s) {
return createError(x, v, fmt.Sprintf("value doesn't match pattern %v", v.Rule))
}
case MaxLength:
if _, ok := v.Rule.(int); !ok {
return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule))
}
if len(s) > v.Rule.(int) {
return createError(x, v, fmt.Sprintf("value length must be less than %v", v.Rule))
}
case MinLength:
if _, ok := v.Rule.(int); !ok {
return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule))
}
if len(s) < v.Rule.(int) {
return createError(x, v, fmt.Sprintf("value length must be greater than %v", v.Rule))
}
case ReadOnly:
if len(s) > 0 {
return createError(reflect.ValueOf(s), v, "readonly parameter; must send as nil or empty in request")
}
default:
return createError(x, v, fmt.Sprintf("constraint %s is not applicable to string type", v.Name))
}
if v.Chain != nil {
return Validate([]Validation{
{
TargetValue: getInterfaceValue(x),
Constraints: v.Chain,
},
})
}
return nil
}
func validateArrayMap(x reflect.Value, v Constraint) error {
switch v.Name {
case Null:
if x.IsNil() {
return checkNil(x, v)
}
case Empty:
if x.IsNil() || x.Len() == 0 {
return checkEmpty(x, v)
}
case MaxItems:
if _, ok := v.Rule.(int); !ok {
return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule))
}
if x.Len() > v.Rule.(int) {
return createError(x, v, fmt.Sprintf("maximum item limit is %v; got: %v", v.Rule, x.Len()))
}
case MinItems:
if _, ok := v.Rule.(int); !ok {
return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule))
}
if x.Len() < v.Rule.(int) {
return createError(x, v, fmt.Sprintf("minimum item limit is %v; got: %v", v.Rule, x.Len()))
}
case UniqueItems:
if x.Kind() == reflect.Array || x.Kind() == reflect.Slice {
if !checkForUniqueInArray(x) {
return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x))
}
} else if x.Kind() == reflect.Map {
if !checkForUniqueInMap(x) {
return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x))
}
} else {
return createError(x, v, fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", v.Name, x.Kind()))
}
case ReadOnly:
if x.Len() != 0 {
return createError(x, v, "readonly parameter; must send as nil or empty in request")
}
default:
return createError(x, v, fmt.Sprintf("constraint %v is not applicable to array, slice and map type", v.Name))
}
if v.Chain != nil {
return Validate([]Validation{
{
TargetValue: getInterfaceValue(x),
Constraints: v.Chain,
},
})
}
return nil
}
func checkNil(x reflect.Value, v Constraint) error {
if _, ok := v.Rule.(bool); !ok {
return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule))
}
if v.Rule.(bool) {
return createError(x, v, "value can not be null; required parameter")
}
return nil
}
func checkEmpty(x reflect.Value, v Constraint) error {
if _, ok := v.Rule.(bool); !ok {
return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule))
}
if v.Rule.(bool) {
return createError(x, v, "value can not be null or empty; required parameter")
}
return nil
}
func checkForUniqueInArray(x reflect.Value) bool {
if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 {
return false
}
arrOfInterface := make([]interface{}, x.Len())
for i := 0; i < x.Len(); i++ {
arrOfInterface[i] = x.Index(i).Interface()
}
m := make(map[interface{}]bool)
for _, val := range arrOfInterface {
if m[val] {
return false
}
m[val] = true
}
return true
}
func checkForUniqueInMap(x reflect.Value) bool {
if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 {
return false
}
mapOfInterface := make(map[interface{}]interface{}, x.Len())
keys := x.MapKeys()
for _, k := range keys {
mapOfInterface[k.Interface()] = x.MapIndex(k).Interface()
}
m := make(map[interface{}]bool)
for _, val := range mapOfInterface {
if m[val] {
return false
}
m[val] = true
}
return true
}
func getInterfaceValue(x reflect.Value) interface{} {
if x.Kind() == reflect.Invalid {
return nil
}
return x.Interface()
}
func isZero(x interface{}) bool {
return x == reflect.Zero(reflect.TypeOf(x)).Interface()
}
func createError(x reflect.Value, v Constraint, err string) error {
return fmt.Errorf("autorest/validation: validation failed: parameter=%s constraint=%s value=%#v details: %s",
v.Target, v.Name, getInterfaceValue(x), err)
}
// NewErrorWithValidationError appends package type and method name in
// validation error.
func NewErrorWithValidationError(err error, packageType, method string) error {
return fmt.Errorf("%s#%s: Invalid input: %v", packageType, method, err)
}

View File

@ -516,6 +516,10 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
volumeController.Run(wait.NeverStop) volumeController.Run(wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
if s.ReconcilerSyncLoopPeriod.Duration < time.Second {
return fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.")
}
attachDetachController, attachDetachControllerErr := attachDetachController, attachDetachControllerErr :=
attachdetach.NewAttachDetachController( attachdetach.NewAttachDetachController(
client("attachdetach-controller"), client("attachdetach-controller"),
@ -525,7 +529,10 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
sharedInformers.PersistentVolumes().Informer(), sharedInformers.PersistentVolumes().Informer(),
cloud, cloud,
ProbeAttachableVolumePlugins(s.VolumeConfiguration), ProbeAttachableVolumePlugins(s.VolumeConfiguration),
recorder) recorder,
s.DisableAttachDetachReconcilerSync,
s.ReconcilerSyncLoopPeriod.Duration,
)
if attachDetachControllerErr != nil { if attachDetachControllerErr != nil {
glog.Fatalf("Failed to start attach/detach controller: %v", attachDetachControllerErr) glog.Fatalf("Failed to start attach/detach controller: %v", attachDetachControllerErr)
} }

View File

@ -95,6 +95,7 @@ func NewCMServer() *CMServer {
ConcurrentGCSyncs: 20, ConcurrentGCSyncs: 20,
ClusterSigningCertFile: "/etc/kubernetes/ca/ca.pem", ClusterSigningCertFile: "/etc/kubernetes/ca/ca.pem",
ClusterSigningKeyFile: "/etc/kubernetes/ca/ca.key", ClusterSigningKeyFile: "/etc/kubernetes/ca/ca.key",
ReconcilerSyncLoopPeriod: unversioned.Duration{Duration: 5 * time.Second},
}, },
} }
s.LeaderElection.LeaderElect = true s.LeaderElection.LeaderElect = true
@ -181,6 +182,8 @@ func (s *CMServer) AddFlags(fs *pflag.FlagSet) {
fs.Float32Var(&s.SecondaryNodeEvictionRate, "secondary-node-eviction-rate", 0.01, "Number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters. This value is implicitly overridden to 0 if the cluster size is smaller than --large-cluster-size-threshold.") fs.Float32Var(&s.SecondaryNodeEvictionRate, "secondary-node-eviction-rate", 0.01, "Number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters. This value is implicitly overridden to 0 if the cluster size is smaller than --large-cluster-size-threshold.")
fs.Int32Var(&s.LargeClusterSizeThreshold, "large-cluster-size-threshold", 50, "Number of nodes from which NodeController treats the cluster as large for the eviction logic purposes. --secondary-node-eviction-rate is implicitly overridden to 0 for clusters this size or smaller.") fs.Int32Var(&s.LargeClusterSizeThreshold, "large-cluster-size-threshold", 50, "Number of nodes from which NodeController treats the cluster as large for the eviction logic purposes. --secondary-node-eviction-rate is implicitly overridden to 0 for clusters this size or smaller.")
fs.Float32Var(&s.UnhealthyZoneThreshold, "unhealthy-zone-threshold", 0.55, "Fraction of Nodes in a zone which needs to be not Ready (minimum 3) for zone to be treated as unhealthy. ") fs.Float32Var(&s.UnhealthyZoneThreshold, "unhealthy-zone-threshold", 0.55, "Fraction of Nodes in a zone which needs to be not Ready (minimum 3) for zone to be treated as unhealthy. ")
fs.BoolVar(&s.DisableAttachDetachReconcilerSync, "disable-attach-detach-reconcile-sync", false, "Disable volume attach detach reconciler sync. Disabling this may cause volumes to be mismatched with pods. Use wisely.")
fs.DurationVar(&s.ReconcilerSyncLoopPeriod.Duration, "attach-detach-reconcile-sync-period", s.ReconcilerSyncLoopPeriod.Duration, "The reconciler sync wait time between volume attach detach. This duration must be larger than one second, and increasing this value from the default may allow for volumes to be mismatched with pods.")
leaderelection.BindFlags(&s.LeaderElection, fs) leaderelection.BindFlags(&s.LeaderElection, fs)
config.DefaultFeatureGate.AddFlag(fs) config.DefaultFeatureGate.AddFlag(fs)

View File

@ -45,6 +45,7 @@ go_library(
"//pkg/cloudprovider/providers:go_default_library", "//pkg/cloudprovider/providers:go_default_library",
"//pkg/credentialprovider:go_default_library", "//pkg/credentialprovider:go_default_library",
"//pkg/credentialprovider/aws:go_default_library", "//pkg/credentialprovider/aws:go_default_library",
"//pkg/credentialprovider/azure:go_default_library",
"//pkg/credentialprovider/gcp:go_default_library", "//pkg/credentialprovider/gcp:go_default_library",
"//pkg/genericapiserver/authorizer:go_default_library", "//pkg/genericapiserver/authorizer:go_default_library",
"//pkg/healthz:go_default_library", "//pkg/healthz:go_default_library",

View File

@ -20,6 +20,7 @@ package app
import ( import (
// Credential providers // Credential providers
_ "k8s.io/kubernetes/pkg/credentialprovider/aws" _ "k8s.io/kubernetes/pkg/credentialprovider/aws"
_ "k8s.io/kubernetes/pkg/credentialprovider/azure"
_ "k8s.io/kubernetes/pkg/credentialprovider/gcp" _ "k8s.io/kubernetes/pkg/credentialprovider/gcp"
// Network plugins // Network plugins
"k8s.io/kubernetes/pkg/kubelet/network" "k8s.io/kubernetes/pkg/kubelet/network"

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

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