provider/azurerm: Bump AzureRM SDK to v8.0.1-beta (#11866)

* provider/azurerm: Bump AzureRM SDK to v8.0.1-beta

* provider/azurerm: Renaming SDK packages as per MSFT updates

* Bump azurerm sdk 8.0.1 (#12076)

* Updating the constructors to match the updated types

* Updating the Redis Client name

* ObjectID is now a string

* Updating to match the new Storage API specs
This commit is contained in:
Paul Stack 2017-02-23 18:14:55 +02:00 committed by GitHub
parent e0e3692076
commit 05e87be7d5
94 changed files with 3419 additions and 2460 deletions

View File

@ -40,7 +40,7 @@ type ArmClient struct {
rivieraClient *riviera.Client
availSetClient compute.AvailabilitySetsClient
usageOpsClient compute.UsageOperationsClient
usageOpsClient compute.UsageClient
vmExtensionImageClient compute.VirtualMachineExtensionImagesClient
vmExtensionClient compute.VirtualMachineExtensionsClient
vmScaleSetClient compute.VirtualMachineScaleSetsClient
@ -76,7 +76,7 @@ type ArmClient struct {
providers resources.ProvidersClient
resourceGroupClient resources.GroupsClient
tagsClient resources.TagsClient
resourceFindClient resources.Client
resourceFindClient resources.GroupClient
jobsClient scheduler.JobsClient
jobsCollectionsClient scheduler.JobCollectionsClient
@ -86,7 +86,7 @@ type ArmClient struct {
deploymentsClient resources.DeploymentsClient
redisClient redis.Client
redisClient redis.GroupClient
trafficManagerProfilesClient trafficmanager.ProfilesClient
trafficManagerEndpointsClient trafficmanager.EndpointsClient
@ -191,7 +191,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
asc.Sender = autorest.CreateSender(withRequestLogging())
client.availSetClient = asc
uoc := compute.NewUsageOperationsClientWithBaseURI(endpoint, c.SubscriptionID)
uoc := compute.NewUsageClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&uoc.Client)
uoc.Authorizer = spt
uoc.Sender = autorest.CreateSender(withRequestLogging())
@ -359,7 +359,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
tc.Sender = autorest.CreateSender(withRequestLogging())
client.tagsClient = tc
rf := resources.NewClientWithBaseURI(endpoint, c.SubscriptionID)
rf := resources.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&rf.Client)
rf.Authorizer = spt
rf.Sender = autorest.CreateSender(withRequestLogging())
@ -419,7 +419,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
tmec.Sender = autorest.CreateSender(withRequestLogging())
client.trafficManagerEndpointsClient = tmec
rdc := redis.NewClientWithBaseURI(endpoint, c.SubscriptionID)
rdc := redis.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&rdc.Client)
rdc.Authorizer = spt
rdc.Sender = autorest.CreateSender(withRequestLogging())

View File

@ -279,7 +279,7 @@ func expandKeyVaultAccessPolicies(d *schema.ResourceData) *[]keyvault.AccessPoli
tenantUUID := uuid.FromStringOrNil(policyRaw["tenant_id"].(string))
policy.TenantID = &tenantUUID
objectUUID := uuid.FromStringOrNil(policyRaw["object_id"].(string))
objectUUID := policyRaw["object_id"].(string)
policy.ObjectID = &objectUUID
result = append(result, policy)
@ -313,7 +313,7 @@ func flattenKeyVaultAccessPolicies(policies *[]keyvault.AccessPolicyEntry) []int
}
policyRaw["tenant_id"] = policy.TenantID.String()
policyRaw["object_id"] = policy.ObjectID.String()
policyRaw["object_id"] = policy.ObjectID
policyRaw["key_permissions"] = keyPermissionsRaw
policyRaw["secret_permissions"] = secretPermissionsRaw

View File

@ -240,7 +240,7 @@ func resourceArmRedisCacheUpdate(d *schema.ResourceData, meta interface{}) error
parameters.RedisConfiguration = redisConfiguration
}
_, err := client.Update(resGroup, name, parameters, make(chan struct{}))
_, err := client.Update(resGroup, name, parameters)
if err != nil {
return err
}
@ -344,7 +344,7 @@ func resourceArmRedisCacheDelete(d *schema.ResourceData, meta interface{}) error
return nil
}
func redisStateRefreshFunc(client redis.Client, resourceGroupName string, sgName string) resource.StateRefreshFunc {
func redisStateRefreshFunc(client redis.GroupClient, resourceGroupName string, sgName string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
res, err := client.Get(resourceGroupName, sgName)
if err != nil {

View File

@ -3,9 +3,7 @@ package azurerm
import (
"fmt"
"log"
// "strings"
"regexp"
"strconv"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/schema"
@ -66,10 +64,18 @@ func resourceArmStorageShareCreate(d *schema.ResourceData, meta interface{}) err
metaData := make(map[string]string) // TODO: support MetaData
log.Printf("[INFO] Creating share %q in storage account %q", name, storageAccountName)
err = fileClient.CreateShare(name, metaData)
reference := fileClient.GetShareReference(name)
err = reference.Create()
log.Printf("[INFO] Setting share %q metadata in storage account %q", name, storageAccountName)
reference.Metadata = metaData
reference.SetMetadata()
log.Printf("[INFO] Setting share %q properties in storage account %q", name, storageAccountName)
fileClient.SetShareProperties(name, storage.ShareHeaders{Quota: strconv.Itoa(d.Get("quota").(int))})
reference.Properties = storage.ShareProperties{
Quota: d.Get("quota").(int),
}
reference.SetProperties()
d.SetId(name)
return resourceArmStorageShareRead(d, meta)
@ -103,7 +109,8 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error
name := d.Get("name").(string)
url := fileClient.GetShareURL(name)
reference := fileClient.GetShareReference(name)
url := reference.URL()
if url == "" {
log.Printf("[INFO] URL for %q is empty", name)
}
@ -131,7 +138,8 @@ func resourceArmStorageShareExists(d *schema.ResourceData, meta interface{}) (bo
name := d.Get("name").(string)
log.Printf("[INFO] Checking for existence of share %q.", name)
exists, err := fileClient.ShareExists(name)
reference := fileClient.GetShareReference(name)
exists, err := reference.Exists()
if err != nil {
return false, fmt.Errorf("Error testing existence of share %q: %s", name, err)
}
@ -161,8 +169,10 @@ func resourceArmStorageShareDelete(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
log.Printf("[INFO] Deleting storage file %q", name)
if _, err = fileClient.DeleteShareIfExists(name); err != nil {
reference := fileClient.GetShareReference(name)
err = reference.Create()
if _, err = reference.DeleteIfExists(); err != nil {
return fmt.Errorf("Error deleting storage file %q: %s", name, err)
}

View File

@ -131,9 +131,11 @@ func testAccARMStorageShareDisappears(name string, sS *storage.Share) resource.T
return nil
}
_, err = fileClient.DeleteShareIfExists(sS.Name)
if err != nil {
return err
reference := fileClient.GetShareReference(sS.Name)
err = reference.Create()
if _, err = reference.DeleteIfExists(); err != nil {
return fmt.Errorf("Error deleting storage file %q: %s", name, err)
}
return nil

View File

@ -19,7 +19,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -61,9 +61,8 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
}
}
// CheckNameAvailability check the availability of a resource name without
// creating the resource. This is needed for resources where name is globally
// unique, such as a CDN endpoint.
// CheckNameAvailability check the availability of a resource name. This is
// needed for resources where name is globally unique, such as a CDN endpoint.
//
// checkNameAvailabilityInput is input to check.
func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) {
@ -128,6 +127,89 @@ func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Respons
return
}
// CheckResourceUsage check the quota and actual usage of the CDN profiles
// under the given subscription.
func (client ManagementClient) CheckResourceUsage() (result ResourceUsageListResult, err error) {
req, err := client.CheckResourceUsagePreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing request")
}
resp, err := client.CheckResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending request")
}
result, err = client.CheckResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to request")
}
return
}
// CheckResourceUsagePreparer prepares the CheckResourceUsage request.
func (client ManagementClient) CheckResourceUsagePreparer() (*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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CheckResourceUsageSender sends the CheckResourceUsage request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) CheckResourceUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckResourceUsageResponder handles the response to the CheckResourceUsage request. The method always
// closes the http.Response Body.
func (client ManagementClient) CheckResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CheckResourceUsageNextResults retrieves the next set of results, if any.
func (client ManagementClient) CheckResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) {
req, err := lastResults.ResourceUsageListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.CheckResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending next results request")
}
result, err = client.CheckResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to next results request")
}
return
}
// ListOperations lists all of the available CDN REST API operations.
func (client ManagementClient) ListOperations() (result OperationListResult, err error) {
req, err := client.ListOperationsPreparer()

View File

@ -14,7 +14,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -26,8 +26,8 @@ import (
)
// CustomDomainsClient is the use these APIs to manage Azure CDN resources
// through the Azure Resource Manager. You must make sure that requests made
// to these resources are secure.
// through the Azure Resource Manager. You must make sure that requests made to
// these resources are secure.
type CustomDomainsClient struct {
ManagementClient
}
@ -44,17 +44,17 @@ func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) Cu
return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create creates a new CDN custom domain within an endpoint. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// Create creates a new custom domain within an endpoint. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. customDomainName is name of the custom
// domain within an endpoint. customDomainProperties is custom domain
// properties required for creation.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint. customDomainProperties is properties required to create
// a new custom domain.
func (client CustomDomainsClient) Create(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -130,16 +130,16 @@ func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result a
return
}
// Delete deletes an existing CDN custom domain within an endpoint. 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.
// Delete deletes an existing custom domain within an endpoint. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. customDomainName is name of the custom
// domain within an endpoint.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint.
func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -210,13 +210,13 @@ func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result a
return
}
// Get gets an existing CDN custom domain within an endpoint.
// Get gets an exisitng custom domain within an endpoint.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. customDomainName is name of the custom
// domain within an endpoint.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint.
func (client CustomDomainsClient) Get(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -286,12 +286,12 @@ func (client CustomDomainsClient) GetResponder(resp *http.Response) (result Cust
return
}
// ListByEndpoint lists the existing CDN custom domains within an endpoint.
// ListByEndpoint lists all of the existing custom domains within an endpoint.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -0,0 +1,97 @@
package cdn
// 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 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// EdgeNodesClient is the use these APIs to manage Azure CDN resources through
// the Azure Resource Manager. You must make sure that requests made to these
// resources are secure.
type EdgeNodesClient struct {
ManagementClient
}
// NewEdgeNodesClient creates an instance of the EdgeNodesClient client.
func NewEdgeNodesClient(subscriptionID string) EdgeNodesClient {
return NewEdgeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewEdgeNodesClientWithBaseURI creates an instance of the EdgeNodesClient
// client.
func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNodesClient {
return EdgeNodesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all the edge nodes of a CDN service.
func (client EdgeNodesClient) List() (result EdgenodeResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client EdgeNodesClient) ListPreparer() (*http.Request, error) {
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.Cdn/edgenodes"),
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 EdgeNodesClient) 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 EdgeNodesClient) ListResponder(resp *http.Response) (result EdgenodeResult, 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

@ -14,7 +14,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -43,15 +43,16 @@ func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) Endpoi
return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create creates a new CDN endpoint with the specified parameters. 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.
// Create creates a new CDN endpoint with the specified endpoint name under the
// specified subscription, resource group and profile. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. endpoint is endpoint properties
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. endpoint is endpoint properties
func (client EndpointsClient) Create(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -60,11 +61,7 @@ func (client EndpointsClient) Create(resourceGroupName string, profileName strin
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: endpoint,
Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil},
{Target: "endpoint.EndpointProperties.HostName", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "endpoint.EndpointProperties.ResourceState", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "endpoint.EndpointProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create")
}
@ -130,15 +127,16 @@ func (client EndpointsClient) CreateResponder(resp *http.Response) (result autor
return
}
// Delete deletes an existing CDN endpoint with the specified parameters. 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.
// Delete deletes an existing CDN endpoint with the specified endpoint name
// under the specified subscription, resource group and profile. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -208,13 +206,13 @@ func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autor
return
}
// Get gets an existing CDN endpoint with the specified endpoint name under
// the specified subscription, resource group and profile.
// Get gets an existing CDN endpoint with the specified endpoint name under the
// specified subscription, resource group and profile.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -286,8 +284,8 @@ func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint
// ListByProfile lists existing CDN endpoints.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client EndpointsClient) ListByProfile(resourceGroupName string, profileName string) (result EndpointListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -379,16 +377,116 @@ func (client EndpointsClient) ListByProfileNextResults(lastResults EndpointListR
return
}
// LoadContent forcibly pre-loads CDN endpoint content. Available for Verizon
// Profiles. 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.
// ListResourceUsage checks the quota and usage of geo filters and custom
// domains under the given endpoint.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. contentFilePaths is the path to the
// content to be loaded. Path should describe a file.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) ListResourceUsage(resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ListResourceUsage")
}
req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName, endpointName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request")
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request")
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to request")
}
return
}
// ListResourceUsagePreparer prepares the ListResourceUsage request.
func (client EndpointsClient) ListResourceUsagePreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"endpointName": autorest.Encode("path", endpointName),
"profileName": autorest.Encode("path", profileName),
"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.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListResourceUsageSender sends the ListResourceUsage request. The method will close the
// http.Response Body if it receives an error.
func (client EndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always
// closes the http.Response Body.
func (client EndpointsClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListResourceUsageNextResults retrieves the next set of results, if any.
func (client EndpointsClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) {
req, err := lastResults.ResourceUsageListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending next results request")
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to next results request")
}
return
}
// LoadContent pre-loads a content to CDN. Available for Verizon Profiles. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. contentFilePaths is the path to the content to be
// loaded. Path should be a full URL, e.g. /pictires/city.png' which loads a
// single file
func (client EndpointsClient) LoadContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -462,17 +560,18 @@ func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result
return
}
// PurgeContent forcibly purges CDN endpoint content. 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.
// PurgeContent removes a content from CDN. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. contentFilePaths is the path to the
// content to be purged. Path can describe a file or directory using the
// wildcard. e.g. '/my/directory/*' or '/my/file.exe/'
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. contentFilePaths is the path to the content to be
// purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
// single file, or a directory with a wildcard, e.g. '/pictures/*' which
// removes all folders and files in the directory.
func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -546,15 +645,15 @@ func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result
return
}
// Start starts an existing stopped CDN endpoint. 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.
// Start starts an existing CDN endpoint that is on a stopped state. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -625,14 +724,14 @@ func (client EndpointsClient) StartResponder(resp *http.Response) (result autore
}
// Stop stops an existing running CDN endpoint. 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.
// 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -702,19 +801,19 @@ func (client EndpointsClient) StopResponder(resp *http.Response) (result autores
return
}
// Update updates an existing CDN endpoint with the specified parameters. Only
// tags and OriginHostHeader can be updated after creating an endpoint. To
// update origins, use the Update Origin operation. To update custom domains,
// use the Update Custom Domain operation. 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.
// Update updates an existing CDN endpoint with the specified endpoint name
// under the specified subscription, resource group and profile. Only tags and
// Origin HostHeader can be updated after creating an endpoint. To update
// origins, use the Update Origin operation. To update custom domains, use the
// Update Custom Domain operation. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. endpointUpdateProperties is endpoint
// update properties
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. endpointUpdateProperties is endpoint update
// properties
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -786,14 +885,14 @@ func (client EndpointsClient) UpdateResponder(resp *http.Response) (result autor
return
}
// ValidateCustomDomain validates a custom domain mapping to ensure it maps to
// the correct CNAME in DNS.
// ValidateCustomDomain validates the custom domain mapping to ensure it maps
// to the correct CDN endpoint in DNS.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. customDomainProperties is custom domain
// to validate.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainProperties is custom domain to be
// validated.
func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -78,11 +78,11 @@ const (
// OriginResourceStateActive specifies the origin resource state active
// state for origin resource state.
OriginResourceStateActive OriginResourceState = "Active"
// OriginResourceStateCreating specifies the origin resource state
// creating state for origin resource state.
// OriginResourceStateCreating specifies the origin resource state creating
// state for origin resource state.
OriginResourceStateCreating OriginResourceState = "Creating"
// OriginResourceStateDeleting specifies the origin resource state
// deleting state for origin resource state.
// OriginResourceStateDeleting specifies the origin resource state deleting
// state for origin resource state.
OriginResourceStateDeleting OriginResourceState = "Deleting"
)
@ -161,9 +161,14 @@ type CheckNameAvailabilityOutput struct {
Message *string `json:"message,omitempty"`
}
// CustomDomain is cDN CustomDomain represents a mapping between a
// user-specified domain name and a CDN endpoint. This is to use custom
// domain names to represent the URLs for branding purposes.
// CidrIPAddress is cIDR Ip address
type CidrIPAddress struct {
BaseIPAddress *string `json:"baseIpAddress,omitempty"`
PrefixLength *int32 `json:"prefixLength,omitempty"`
}
// CustomDomain is customer provided domain for branding purposes, e.g.
// www.consoto.com.
type CustomDomain struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
@ -175,8 +180,8 @@ type CustomDomain struct {
}
// CustomDomainListResult is result of the request to list custom domains. It
// contains a list of custom domain objects and a URL link to get the next
// set of results.
// contains a list of custom domain objects and a URL link to get the next set
// of results.
type CustomDomainListResult struct {
autorest.Response `json:"-"`
Value *[]CustomDomain `json:"value,omitempty"`
@ -216,24 +221,47 @@ type CustomDomainPropertiesParameters struct {
HostName *string `json:"hostName,omitempty"`
}
// DeepCreatedOrigin is origins to be added when creating a CDN endpoint.
// DeepCreatedOrigin is origin to be added when creating a CDN endpoint.
type DeepCreatedOrigin struct {
Name *string `json:"name,omitempty"`
*DeepCreatedOriginProperties `json:"properties,omitempty"`
}
// DeepCreatedOriginProperties is properties of origins Properties of the
// origin created on the CDN endpoint.
// DeepCreatedOriginProperties is properties of origin Properties of the origin
// created on the CDN endpoint.
type DeepCreatedOriginProperties struct {
HostName *string `json:"hostName,omitempty"`
HTTPPort *int32 `json:"httpPort,omitempty"`
HTTPSPort *int32 `json:"httpsPort,omitempty"`
}
// EdgeNode is edge node of CDN service.
type EdgeNode 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"`
*EdgeNodeProperties `json:"properties,omitempty"`
}
// EdgeNodeProperties is the JSON object that contains the properties required
// to create an edgenode.
type EdgeNodeProperties struct {
IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"`
}
// EdgenodeResult is result of the request to list CDN edgenodes. It contains a
// list of ip address group and a URL link to get the next set of results.
type EdgenodeResult struct {
autorest.Response `json:"-"`
Value *[]EdgeNode `json:"value,omitempty"`
}
// Endpoint is cDN endpoint is the entity within a CDN profile containing
// configuration information regarding caching behaviors and origins. The CDN
// endpoint is exposed using the URL format <endpointname>.azureedge.net by
// default, but custom domains can also be created.
// configuration information such as origin, protocol, content caching and
// delivery behavior. The CDN endpoint uses the URL format
// <endpointname>.azureedge.net.
type Endpoint struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
@ -244,9 +272,8 @@ type Endpoint struct {
*EndpointProperties `json:"properties,omitempty"`
}
// EndpointListResult is result of the request to list endpoints. It contains
// a list of endpoint objects and a URL link to get the the next set of
// results.
// EndpointListResult is result of the request to list endpoints. It contains a
// list of endpoint objects and a URL link to get the the next set of results.
type EndpointListResult struct {
autorest.Response `json:"-"`
Value *[]Endpoint `json:"value,omitempty"`
@ -265,8 +292,8 @@ func (client EndpointListResult) EndpointListResultPreparer() (*http.Request, er
autorest.WithBaseURL(to.String(client.NextLink)))
}
// EndpointProperties is the JSON object that contains the properties of the
// endpoint to create.
// EndpointProperties is the JSON object that contains the properties required
// to create an endpoint.
type EndpointProperties struct {
OriginHostHeader *string `json:"originHostHeader,omitempty"`
OriginPath *string `json:"originPath,omitempty"`
@ -298,8 +325,7 @@ type EndpointPropertiesUpdateParameters struct {
GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"`
}
// EndpointUpdateParameters is endpoint properties required for new endpoint
// creation.
// EndpointUpdateParameters is properties required to create a new endpoint.
type EndpointUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
*EndpointPropertiesUpdateParameters `json:"properties,omitempty"`
@ -312,14 +338,21 @@ type ErrorResponse struct {
Message *string `json:"message,omitempty"`
}
// GeoFilter is geo filter of a CDN endpoint.
// GeoFilter is rules defining user geo access within a CDN endpoint.
type GeoFilter struct {
RelativePath *string `json:"relativePath,omitempty"`
Action GeoFilterActions `json:"action,omitempty"`
CountryCodes *[]string `json:"countryCodes,omitempty"`
}
// LoadParameters is parameters required for endpoint load.
// IPAddressGroup is cDN Ip address group
type IPAddressGroup struct {
DeliveryRegion *string `json:"deliveryRegion,omitempty"`
Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"`
Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"`
}
// LoadParameters is parameters required for content load.
type LoadParameters struct {
ContentPaths *[]string `json:"contentPaths,omitempty"`
}
@ -338,8 +371,7 @@ type OperationDisplay struct {
}
// OperationListResult is result of the request to list CDN operations. It
// contains a list of operations and a URL link to get the next set of
// results.
// contains a list of operations and a URL link to get the next set of results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
@ -360,8 +392,8 @@ func (client OperationListResult) OperationListResultPreparer() (*http.Request,
// Origin is cDN origin is the source of the content being delivered via CDN.
// When the edge nodes represented by an endpoint do not have the requested
// content cached, they attempt to fetch it from one or more of the
// configured origins.
// content cached, they attempt to fetch it from one or more of the configured
// origins.
type Origin struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
@ -416,8 +448,8 @@ type OriginUpdateParameters struct {
*OriginPropertiesParameters `json:"properties,omitempty"`
}
// Profile is cDN profile represents the top level resource and the entry
// point into the CDN API. This allows users to set up a logical grouping of
// Profile is cDN profile represents the top level resource and the entry point
// into the CDN API. This allows users to set up a logical grouping of
// endpoints in addition to creating shared configuration settings and
// selecting pricing tiers and providers.
type Profile struct {
@ -451,19 +483,19 @@ func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, erro
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ProfileProperties is the JSON object that contains the properties of the
// profile to create.
// ProfileProperties is the JSON object that contains the properties required
// to create a profile.
type ProfileProperties struct {
ResourceState ProfileResourceState `json:"resourceState,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// ProfileUpdateParameters is profile properties required for profile update.
// ProfileUpdateParameters is properties required to update a profile.
type ProfileUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// PurgeParameters is parameters required for endpoint purge.
// PurgeParameters is parameters required for content purge.
type PurgeParameters struct {
ContentPaths *[]string `json:"contentPaths,omitempty"`
}
@ -477,18 +509,47 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// Sku is the SKU (pricing tier) of the CDN profile.
// ResourceUsage is output of check resource usage API.
type ResourceUsage struct {
ResourceType *string `json:"resourceType,omitempty"`
Unit *string `json:"unit,omitempty"`
CurrentValue *int32 `json:"currentValue,omitempty"`
Limit *int32 `json:"limit,omitempty"`
}
// ResourceUsageListResult is output of check resource usage API.
type ResourceUsageListResult struct {
autorest.Response `json:"-"`
Value *[]ResourceUsage `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceUsageListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResourceUsageListResult) ResourceUsageListResultPreparer() (*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)))
}
// Sku is the pricing tier (defines a CDN provider, feature list and rate) of
// the CDN profile.
type Sku struct {
Name SkuName `json:"name,omitempty"`
}
// SsoURI is sSO URI required to login to third party web portal.
// SsoURI is sSO URI required to login to the supplemental portal.
type SsoURI struct {
autorest.Response `json:"-"`
SsoURIValue *string `json:"ssoUriValue,omitempty"`
}
// ValidateCustomDomainInput is input of the custom domain to be validated.
// ValidateCustomDomainInput is input of the custom domain to be validated for
// DNS mapping.
type ValidateCustomDomainInput struct {
HostName *string `json:"hostName,omitempty"`
}

View File

@ -14,7 +14,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -42,13 +42,13 @@ func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsC
return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets an existing CDN origin within an endpoint.
// Get gets an existing origin within an endpoint.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. originName is name of the origin which
// is unique within the endpoint.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. originName is name of the origin which is unique
// within the endpoint.
func (client OriginsClient) Get(resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -118,12 +118,12 @@ func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, er
return
}
// ListByEndpoint lists the existing CDN origins within an endpoint.
// ListByEndpoint lists all of the existing origins within an endpoint.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result OriginListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -216,16 +216,16 @@ func (client OriginsClient) ListByEndpointNextResults(lastResults OriginListResu
return
}
// Update updates an existing CDN origin within an endpoint. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// Update updates an existing origin within an endpoint. 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. endpointName is name of the endpoint under the
// profile which is unique globally. originName is name of the origin which
// is unique within the endpoint. originUpdateProperties is origin properties
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. originName is name of the origin which is unique
// within the endpoint. originUpdateProperties is origin properties
func (client OriginsClient) Update(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -45,13 +45,13 @@ func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) Profile
// Create creates a new CDN profile with a profile name under the specified
// subscription and resource group. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The
// channel will be used to cancel polling and any outstanding HTTP requests.
// 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. profile is profile properties needed to create
// a new profile.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. profile is profile properties needed to create a new
// profile.
func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -59,11 +59,7 @@ func (client ProfilesClient) Create(resourceGroupName string, profileName string
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: profile,
Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil},
{Target: "profile.ProfileProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "profile.ProfileProperties.ResourceState", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "profile.ProfileProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create")
}
@ -129,15 +125,15 @@ func (client ProfilesClient) CreateResponder(resp *http.Response) (result autore
}
// Delete deletes an existing CDN profile with the specified parameters.
// Deleting a profile will result in the deletion of all subresources
// Deleting a profile will result in the deletion of all of the sub-resources
// including endpoints, origins and custom domains. 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.
// 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 name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -208,14 +204,14 @@ func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autore
// GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN
// supplemental portal. Supplemnetal portal is used to configure advanced
// feature capabilities that are not yet available in the Azure portal, such
// as core reports in a standard profile; rules engine, advanced HTTP
// reports, and real-time stats and alerts in a premium profile. The SSO URI
// changes approximately every 10 minutes.
// feature capabilities that are not yet available in the Azure portal, such as
// core reports in a standard profile; rules engine, advanced HTTP reports, and
// real-time stats and alerts in a premium profile. The SSO URI changes
// approximately every 10 minutes.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileName string) (result SsoURI, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -287,8 +283,8 @@ func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (resul
// subscription and resource group.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -356,7 +352,7 @@ func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile,
return
}
// List lists all the CDN profiles within an Azure subscription.
// List lists all of the CDN profiles within an Azure subscription.
func (client ProfilesClient) List() (result ProfileListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
@ -438,7 +434,7 @@ func (client ProfilesClient) ListNextResults(lastResults ProfileListResult) (res
return
}
// ListByResourceGroup lists all the CDN profiles within a resource group.
// ListByResourceGroup lists all of the CDN profiles within a resource group.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription.
@ -532,16 +528,113 @@ func (client ProfilesClient) ListByResourceGroupNextResults(lastResults ProfileL
return
}
// Update updates an existing CDN profile with the specified profile name
// under the specified subscription and resource group. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// ListResourceUsage checks the quota and actual usage of endpoints under the
// given CDN profile.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique
// within the resource group. profileUpdateParameters is profile properties
// needed to update an existing profile.
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client ProfilesClient) ListResourceUsage(resourceGroupName string, profileName string) (result ResourceUsageListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "ListResourceUsage")
}
req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request")
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request")
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to request")
}
return
}
// ListResourceUsagePreparer prepares the ListResourceUsage request.
func (client ProfilesClient) ListResourceUsagePreparer(resourceGroupName string, profileName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"profileName": autorest.Encode("path", profileName),
"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.Cdn/profiles/{profileName}/checkResourceUsage", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListResourceUsageSender sends the ListResourceUsage request. The method will close the
// http.Response Body if it receives an error.
func (client ProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always
// closes the http.Response Body.
func (client ProfilesClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListResourceUsageNextResults retrieves the next set of results, if any.
func (client ProfilesClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) {
req, err := lastResults.ResourceUsageListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending next results request")
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to next results request")
}
return
}
// Update updates an existing CDN profile with the specified profile name under
// the specified subscription and resource group. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. profileUpdateParameters is profile properties needed to
// update an existing profile.
func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -14,30 +14,47 @@ package cdn
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "cdn", "2016-10-02")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "cdn", "2016-10-02")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -14,14 +14,13 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.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"
)
@ -44,17 +43,10 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string)
// CreateOrUpdate create or update an availability set.
//
// resourceGroupName is the name of the resource group. name is the name of
// the availability set. parameters is parameters supplied to the Create
// resourceGroupName is the name of the resource group. name is the name of the
// availability set. parameters is parameters supplied to the Create
// Availability Set operation.
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -119,7 +111,7 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
//
// resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set.
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result autorest.Response, err error) {
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) {
req, err := client.DeletePreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
@ -127,7 +119,7 @@ func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabili
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
}
@ -167,13 +159,14 @@ func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Resp
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -18,7 +18,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -127,8 +127,8 @@ const (
Manual UpgradeMode = "Manual"
)
// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual
// machine scale set sku scale type.
// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine
// scale set sku scale type.
type VirtualMachineScaleSetSkuScaleType string
const (
@ -335,8 +335,8 @@ const (
// AdditionalUnattendContent is additional XML formatted information that can
// be included in the Unattend.xml file, which is used by Windows Setup.
// Contents are defined by setting name, component name, and the pass in
// which the content is a applied.
// Contents are defined by setting name, component name, and the pass in which
// the content is a applied.
type AdditionalUnattendContent struct {
PassName PassNames `json:"passName,omitempty"`
ComponentName ComponentNames `json:"componentName,omitempty"`
@ -537,6 +537,16 @@ type NetworkProfile struct {
NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"`
}
// OperationStatusResponse is operation status response
type OperationStatusResponse struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
Status *string `json:"status,omitempty"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Error *APIError `json:"error,omitempty"`
}
// OSDisk is describes an Operating System disk.
type OSDisk struct {
OsType OperatingSystemTypes `json:"osType,omitempty"`
@ -581,7 +591,7 @@ type PurchasePlan struct {
Product *string `json:"product,omitempty"`
}
// Resource is the resource model definition.
// Resource is the Resource model definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
@ -640,8 +650,8 @@ type UsageName struct {
LocalizedValue *string `json:"localizedValue,omitempty"`
}
// VaultCertificate is describes a single certificate reference in a Key
// Vault, and where the certificate should reside on the VM.
// VaultCertificate is describes a single certificate reference in a Key Vault,
// and where the certificate should reside on the VM.
type VaultCertificate struct {
CertificateURL *string `json:"certificateUrl,omitempty"`
CertificateStore *string `json:"certificateStore,omitempty"`
@ -672,8 +682,8 @@ type VirtualMachine struct {
Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
}
// VirtualMachineAgentInstanceView is the instance view of the VM Agent
// running on the virtual machine.
// VirtualMachineAgentInstanceView is the instance view of the VM Agent running
// on the virtual machine.
type VirtualMachineAgentInstanceView struct {
VMAgentVersion *string `json:"vmAgentVersion,omitempty"`
ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"`
@ -711,8 +721,8 @@ type VirtualMachineExtension struct {
*VirtualMachineExtensionProperties `json:"properties,omitempty"`
}
// VirtualMachineExtensionHandlerInstanceView is the instance view of a
// virtual machine extension handler.
// VirtualMachineExtensionHandlerInstanceView is the instance view of a virtual
// machine extension handler.
type VirtualMachineExtensionHandlerInstanceView struct {
Type *string `json:"type,omitempty"`
TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
@ -873,8 +883,8 @@ type VirtualMachineScaleSetExtensionProperties struct {
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// VirtualMachineScaleSetInstanceView is the instance view of a virtual
// machine scale set.
// VirtualMachineScaleSetInstanceView is the instance view of a virtual machine
// scale set.
type VirtualMachineScaleSetInstanceView struct {
autorest.Response `json:"-"`
VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"`
@ -1090,8 +1100,8 @@ type VirtualMachineScaleSetVMInstanceView struct {
Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
}
// VirtualMachineScaleSetVMListResult is the List Virtual Machine Scale Set
// VMs operation response.
// VirtualMachineScaleSetVMListResult is the List Virtual Machine Scale Set VMs
// operation response.
type VirtualMachineScaleSetVMListResult struct {
autorest.Response `json:"-"`
Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"`
@ -1123,6 +1133,7 @@ type VirtualMachineScaleSetVMProfile struct {
// machine scale set virtual machine.
type VirtualMachineScaleSetVMProperties struct {
LatestModelApplied *bool `json:"latestModelApplied,omitempty"`
VMID *string `json:"vmId,omitempty"`
InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"`
HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -25,21 +25,19 @@ import (
"net/http"
)
// UsageOperationsClient is the the Compute Management Client.
type UsageOperationsClient struct {
// UsageClient is the the Compute Management Client.
type UsageClient struct {
ManagementClient
}
// NewUsageOperationsClient creates an instance of the UsageOperationsClient
// client.
func NewUsageOperationsClient(subscriptionID string) UsageOperationsClient {
return NewUsageOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
// NewUsageClient creates an instance of the UsageClient client.
func NewUsageClient(subscriptionID string) UsageClient {
return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageOperationsClientWithBaseURI creates an instance of the
// UsageOperationsClient client.
func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string) UsageOperationsClient {
return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
// NewUsageClientWithBaseURI creates an instance of the UsageClient client.
func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List gets, for the specified location, the current compute resource usage
@ -47,34 +45,34 @@ func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string)
// subscription.
//
// location is the location for which resource usage is queried.
func (client UsageOperationsClient) List(location string) (result ListUsagesResult, err error) {
func (client UsageClient) 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")
return result, validation.NewErrorWithValidationError(err, "compute.UsageClient", "List")
}
req, err := client.ListPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageOperationsClient) ListPreparer(location string) (*http.Request, error) {
func (client UsageClient) ListPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -94,13 +92,13 @@ func (client UsageOperationsClient) ListPreparer(location string) (*http.Request
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
func (client UsageClient) 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 UsageOperationsClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -112,10 +110,10 @@ func (client UsageOperationsClient) ListResponder(resp *http.Response) (result L
}
// ListNextResults retrieves the next set of results, if any.
func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
func (client UsageClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
req, err := lastResults.ListUsagesResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", nil, "Failure preparing next results request")
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
@ -124,12 +122,12 @@ func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending next results request")
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to next results request")
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to next results request")
}
return

View File

@ -14,30 +14,47 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "compute", "2016-03-30")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "compute", "2016-03-30")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -35,8 +35,8 @@ func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachin
return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of
// the VirtualMachineExtensionImagesClient client.
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the
// VirtualMachineExtensionImagesClient client.
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
}

View File

@ -14,14 +14,13 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.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"
)
@ -53,13 +52,6 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID
// extensionParameters is parameters supplied to the Create Virtual Machine
// Extension operation.
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -123,9 +115,9 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.
}
// Delete the operation to delete the extension. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine where the extension should be deleted. vmExtensionName
@ -194,9 +186,9 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response
// Get the operation to get the extension.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine containing the extension. vmExtensionName is the name
// of the virtual machine extension. expand is the expand expression to apply
// on the operation.
// the virtual machine containing the extension. vmExtensionName is the name of
// the virtual machine extension. expand is the expand expression to apply on
// the operation.
func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmName string, vmExtensionName string, expand string) (result VirtualMachineExtension, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, vmExtensionName, expand)
if err != nil {

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -43,10 +43,10 @@ func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string)
}
// Capture captures the VM by copying virtual hard disks of the VM and outputs
// a template that can be used to create similar VMs. 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.
// a template that can be used to create similar VMs. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. parameters is parameters supplied to the Capture
@ -123,12 +123,12 @@ func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (resul
// CreateOrUpdate the operation to create or update a virtual machine. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. parameters is parameters supplied to the Create
// Virtual Machine operation.
// the virtual machine. parameters is parameters supplied to the Create Virtual
// Machine operation.
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,
@ -149,11 +149,7 @@ func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmN
{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 {
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate")
}
@ -287,9 +283,9 @@ func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (re
}
// Delete the operation to delete a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
@ -357,7 +353,7 @@ func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName string) (result autorest.Response, err error) {
func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName string) (result OperationStatusResponse, err error) {
req, err := client.GeneralizePreparer(resourceGroupName, vmName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request")
@ -365,7 +361,7 @@ func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName
resp, err := client.GeneralizeSender(req)
if err != nil {
result.Response = resp
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request")
}
@ -405,13 +401,14 @@ func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.R
// GeneralizeResponder handles the response to the Generalize request. The method always
// closes the http.Response Body.
func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result autorest.Response, err error) {
func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result OperationStatusResponse, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -420,7 +417,7 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. expand is the expand expression to apply on the
// operation. Possible values include: 'instanceView'
// operation.
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand InstanceViewTypes) (result VirtualMachine, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, expand)
if err != nil {
@ -570,8 +567,8 @@ func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineLi
return
}
// ListAll lists all of the virtual machines in the specified subscription.
// Use the nextLink property in the response to get the next page of virtual
// ListAll lists all of the virtual machines in the specified subscription. Use
// the nextLink property in the response to get the next page of virtual
// machines.
func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) {
req, err := client.ListAllPreparer()
@ -719,11 +716,10 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo
}
// PowerOff the operation to power off (stop) a virtual machine. The virtual
// machine can be restarted with the same provisioned resources. You are
// still charged for this virtual machine. 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.
// machine can be restarted with the same provisioned resources. You are still
// charged for this virtual machine. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
@ -854,10 +850,10 @@ func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (resu
return
}
// Restart the operation to restart a virtual machine. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// Restart the operation to restart a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.
@ -922,9 +918,9 @@ func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (resul
}
// Start the operation to start a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine.

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -43,12 +43,12 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID
}
// CreateOrUpdate create or update a VM scale set. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. name is the name of
// the VM scale set to create or update. parameters is the scale set object.
// resourceGroupName is the name of the resource group. name is the name of the
// VM scale set to create or update. parameters is the scale set object.
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,
@ -59,7 +59,6 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName str
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")
}
@ -128,8 +127,8 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R
// Deallocate deallocates specific virtual machines in a VM scale set. Shuts
// down the virtual machines and releases the compute resources. You are not
// billed for the compute resources that this virtual machine scale set
// deallocates. This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel
// deallocates. 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
@ -201,8 +200,8 @@ func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Respo
}
// Delete deletes a VM scale set. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
// can be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set.
@ -554,9 +553,9 @@ func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualM
}
// ListAll gets a list of all VM Scale Sets in the subscription, regardless of
// the associated resource group. Use nextLink property in the response to
// get the next page of VM Scale Sets. Do this till nextLink is not null to
// fetch all the VM Scale Sets.
// the associated resource group. Use nextLink property in the response to get
// the next page of VM Scale Sets. Do this till nextLink is not null to fetch
// all the VM Scale Sets.
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
@ -729,9 +728,9 @@ func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults Virt
// PowerOff power off (stop) one or more virtual machines in a VM scale set.
// Note that resources are still attached and you are getting charged for the
// resources. Instead, use deallocate to release resources and avoid charges.
// 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.
// This method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine
@ -801,10 +800,10 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons
return
}
// Reimage reimages (upgrade the operating system) one or more virtual
// machines in a VM scale set. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will
// be used to cancel polling and any outstanding HTTP requests.
// Reimage reimages (upgrade the operating system) one or more virtual machines
// in a VM scale set. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set.
@ -868,10 +867,10 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response
return
}
// Restart restarts one or more virtual machines in a VM scale set. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and
// any outstanding HTTP requests.
// Restart restarts one or more virtual machines in a VM scale set. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine
@ -941,10 +940,10 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response
return
}
// Start starts one or more virtual machines in a VM scale set. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// Start starts one or more virtual machines in a VM scale set. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine
@ -1015,9 +1014,9 @@ func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response)
}
// UpdateInstances upgrades one or more virtual machines to the latest SKU set
// 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
// be used to cancel polling and any outstanding HTTP requests.
// 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 be used
// to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -42,11 +42,11 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
}
// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts
// down the virtual machine and releases the compute resources it uses. You
// are not billed for the compute resources of this virtual machine once it
// is deallocated. 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.
// down the virtual machine and releases the compute resources it uses. You are
// not billed for the compute resources of this virtual machine once it is
// deallocated. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual
@ -410,11 +410,11 @@ func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults Virtua
}
// PowerOff power off (stop) a virtual machine in a VM scale set. Note that
// resources are still attached and you are getting charged for the
// resources. Instead, use deallocate to release resources and avoid charges.
// 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.
// resources are still attached and you are getting charged for the resources.
// Instead, use deallocate to release resources and avoid charges. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual
@ -482,8 +482,8 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo
// Reimage reimages (upgrade the operating system) a specific virtual machine
// in a VM scale set. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used
// to cancel polling and any outstanding HTTP requests.
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual
@ -619,9 +619,9 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon
}
// Start starts a virtual machine in a VM scale set. This method may poll for
// completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual

View File

@ -14,7 +14,7 @@ package compute
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -1,5 +1,6 @@
// Package containerregistry implements the Azure ARM Containerregistry
// service API version 2016-06-27-preview.
// Package containerregistry implements the Azure ARM Containerregistry service
// API version 2016-06-27-preview.
//
//
package containerregistry
@ -17,7 +18,7 @@ package containerregistry
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package containerregistry
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -70,8 +70,8 @@ type RegistryNameCheckRequest struct {
Type *string `json:"type,omitempty"`
}
// RegistryNameStatus is the result of a request to check the availability of
// a container registry name.
// 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"`

View File

@ -14,7 +14,7 @@ package containerregistry
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -128,8 +128,6 @@ func (client RegistriesClient) CreateOrUpdate(resourceGroupName string, registry
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")
}
@ -187,7 +185,7 @@ func (client RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (res
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
@ -250,7 +248,7 @@ func (client RegistriesClient) DeleteResponder(resp *http.Response) (result auto
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return

View File

@ -14,30 +14,47 @@ package containerregistry
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "containerregistry", "2016-06-27-preview")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "containerregistry", "2016-06-27-preview")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

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

View File

@ -19,7 +19,7 @@ package keyvault
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package keyvault
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -147,7 +147,7 @@ const (
// tenant ID.
type AccessPolicyEntry struct {
TenantID *uuid.UUID `json:"tenantId,omitempty"`
ObjectID *uuid.UUID `json:"objectId,omitempty"`
ObjectID *string `json:"objectId,omitempty"`
ApplicationID *uuid.UUID `json:"applicationId,omitempty"`
Permissions *Permissions `json:"permissions,omitempty"`
}
@ -169,6 +169,25 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// ResourceListResult is list of vault resources.
type ResourceListResult struct {
autorest.Response `json:"-"`
Value *[]Resource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResourceListResult) ResourceListResultPreparer() (*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)))
}
// Sku is sKU details
type Sku struct {
Family *string `json:"family,omitempty"`

View File

@ -14,7 +14,7 @@ package keyvault
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -53,8 +53,9 @@ func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName st
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Properties", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}},
Chain: []validation.Constraint{{Target: "parameters.Properties.TenantID", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.MaxItems, Rule: 16, Chain: nil}}},
}}}}}); err != nil {
@ -251,7 +252,7 @@ func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err
//
// filter is the filter to apply on the operation. top is maximum number of
// results to return.
func (client VaultsClient) List(filter string, top *int32) (result VaultListResult, err error) {
func (client VaultsClient) List(filter string, top *int32) (result ResourceListResult, err error) {
req, err := client.ListPreparer(filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request")
@ -301,7 +302,7 @@ func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error)
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client VaultsClient) ListResponder(resp *http.Response) (result VaultListResult, err error) {
func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -313,8 +314,8 @@ func (client VaultsClient) ListResponder(resp *http.Response) (result VaultListR
}
// ListNextResults retrieves the next set of results, if any.
func (client VaultsClient) ListNextResults(lastResults VaultListResult) (result VaultListResult, err error) {
req, err := lastResults.VaultListResultPreparer()
func (client VaultsClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing next results request")
}

View File

@ -14,30 +14,47 @@ package keyvault
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "keyvault", "2015-06-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "keyvault", "2015-06-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -131,7 +131,6 @@ func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string,
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")
}

View File

@ -21,7 +21,6 @@ package network
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
@ -54,19 +53,6 @@ func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) Inter
// is the name of the network interface. parameters is parameters supplied to
// 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) {
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -59,9 +59,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string
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 {
Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate")
}

View File

@ -60,25 +60,8 @@ func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, p
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},
}},
Chain: []validation.Constraint{{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")
}

View File

@ -21,7 +21,6 @@ package network
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
@ -54,13 +53,6 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
// name of the route table. parameters is parameters supplied to the create
// or update route table operation.
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -21,7 +21,6 @@ package network
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
@ -56,15 +55,6 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
// parameters is parameters supplied to the create or update network security
// group operation.
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -21,7 +21,6 @@ package network
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
@ -54,24 +53,6 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC
// subnetParameters is parameters supplied to the create or update subnet
// operation.
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)
if err != nil {
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

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

View File

@ -61,27 +61,16 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGrou
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},
}},
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, 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},
}},
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, 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},
}},
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, 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")
}

View File

@ -59,9 +59,7 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName stri
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 {
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate")
}

View File

@ -17,7 +17,7 @@ package redis
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package redis
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -221,7 +221,7 @@ type ResourceType struct {
// ScheduleEntries is list of patch schedules for a Redis cache.
type ScheduleEntries struct {
ScheduleEntriesProperty *[]ScheduleEntry `json:"scheduleEntries,omitempty"`
ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"`
}
// ScheduleEntry is patch schedule entry for a Premium Redis Cache.

View File

@ -14,15 +14,16 @@ package redis
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"net/http"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// PatchSchedulesClient is the rEST API for Azure Redis Cache Service.
@ -42,20 +43,18 @@ func NewPatchSchedulesClientWithBaseURI(baseURI string, subscriptionID string) P
return PatchSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate create or replace the patching schedule for Redis cache.
// CreateOrUpdate create or replace the patching schedule for Redis cache
// (requires Premium SKU).
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is parameters to set patch schedules for Redis
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is parameters to set the patching schedule for Redis
// cache.
func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntriesProperty", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.ID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.Name", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.Type", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.Location", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate")
}
@ -119,10 +118,11 @@ func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response)
return
}
// Delete deletes the patching schedule for Redis cache.
// Delete deletes the patching schedule of a redis cache (requires Premium
// SKU).
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache.
// resourceGroupName is the name of the resource group. name is the name of the
// redis cache.
func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, name)
if err != nil {
@ -175,16 +175,16 @@ func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the patching schedule for Redis cache.
// Get gets the patching schedule of a redis cache (requires Premium SKU).
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache.
// resourceGroupName is the name of the resource group. name is the name of the
// redis cache.
func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) {
req, err := client.GetPreparer(resourceGroupName, name)
if err != nil {

View File

@ -14,7 +14,7 @@ package redis
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -25,60 +25,60 @@ import (
"net/http"
)
// Client is the rEST API for Azure Redis Cache Service.
type Client struct {
// GroupClient is the rEST API for Azure Redis Cache Service.
type GroupClient struct {
ManagementClient
}
// NewClient creates an instance of the Client client.
func NewClient(subscriptionID string) Client {
return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClientWithBaseURI creates an instance of the Client client.
func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
return Client{NewWithBaseURI(baseURI, subscriptionID)}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create create or replace (overwrite/recreate, with potential downtime) an
// existing Redis cache. 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.
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is parameters supplied to the Create Redis
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is parameters supplied to the Create Redis
// operation.
func (client Client) Create(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client GroupClient) Create(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.CreateProperties", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "redis.Client", "Create")
return result, validation.NewErrorWithValidationError(err, "redis.GroupClient", "Create")
}
req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "Create", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Create", nil, "Failure preparing request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "Create", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure sending request")
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "Create", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client Client) CreatePreparer(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -101,7 +101,7 @@ func (client Client) CreatePreparer(resourceGroupName string, name string, param
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CreateSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -109,7 +109,7 @@ func (client Client) CreateSender(req *http.Request) (*http.Response, error) {
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client Client) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -120,33 +120,33 @@ func (client Client) CreateResponder(resp *http.Response) (result autorest.Respo
}
// Delete deletes a Redis cache. 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.
// can be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache.
func (client Client) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache.
func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, name, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client Client) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -167,7 +167,7 @@ func (client Client) DeletePreparer(resourceGroupName string, name string, cance
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -175,7 +175,7 @@ func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -185,42 +185,42 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo
return
}
// ExportData import data into Redis cache. 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.
// ExportData export data from the redis cache to blobs in a container. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is parameters for Redis export operation.
func (client Client) ExportData(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is parameters for Redis export operation.
func (client GroupClient) ExportData(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Prefix", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Container", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "redis.Client", "ExportData")
return result, validation.NewErrorWithValidationError(err, "redis.GroupClient", "ExportData")
}
req, err := client.ExportDataPreparer(resourceGroupName, name, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ExportData", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", nil, "Failure preparing request")
}
resp, err := client.ExportDataSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "ExportData", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure sending request")
}
result, err = client.ExportDataResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ExportData", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure responding to request")
}
return
}
// ExportDataPreparer prepares the ExportData request.
func (client Client) ExportDataPreparer(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) ExportDataPreparer(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -243,7 +243,7 @@ func (client Client) ExportDataPreparer(resourceGroupName string, name string, p
// ExportDataSender sends the ExportData request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ExportDataSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ExportDataSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -251,7 +251,7 @@ func (client Client) ExportDataSender(req *http.Request) (*http.Response, error)
// ExportDataResponder handles the response to the ExportData request. The method always
// closes the http.Response Body.
func (client Client) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -264,30 +264,30 @@ func (client Client) ExportDataResponder(resp *http.Response) (result autorest.R
// ForceReboot reboot specified Redis node(s). This operation requires write
// permission to the cache resource. There can be potential data loss.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is specifies which Redis node(s) to reboot.
func (client Client) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result autorest.Response, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is specifies which Redis node(s) to reboot.
func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result autorest.Response, err error) {
req, err := client.ForceRebootPreparer(resourceGroupName, name, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", nil, "Failure preparing request")
}
resp, err := client.ForceRebootSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure sending request")
}
result, err = client.ForceRebootResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ForceReboot", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure responding to request")
}
return
}
// ForceRebootPreparer prepares the ForceReboot request.
func (client Client) ForceRebootPreparer(resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) {
func (client GroupClient) ForceRebootPreparer(resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -310,13 +310,13 @@ func (client Client) ForceRebootPreparer(resourceGroupName string, name string,
// ForceRebootSender sends the ForceReboot request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ForceRebootSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ForceRebootSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ForceRebootResponder handles the response to the ForceReboot request. The method always
// closes the http.Response Body.
func (client Client) ForceRebootResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) ForceRebootResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -328,30 +328,30 @@ func (client Client) ForceRebootResponder(resp *http.Response) (result autorest.
// Get gets a Redis cache (resource description).
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache.
func (client Client) Get(resourceGroupName string, name string) (result ResourceType, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache.
func (client GroupClient) Get(resourceGroupName string, name string) (result ResourceType, err error) {
req, err := client.GetPreparer(resourceGroupName, name)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client Client) GetPreparer(resourceGroupName string, name string) (*http.Request, error) {
func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -372,13 +372,13 @@ func (client Client) GetPreparer(resourceGroupName string, name string) (*http.R
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client Client) GetSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) {
func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -390,40 +390,40 @@ func (client Client) GetResponder(resp *http.Response) (result ResourceType, err
}
// ImportData import data into Redis cache. 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.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is parameters for Redis import operation.
func (client Client) ImportData(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is parameters for Redis import operation.
func (client GroupClient) ImportData(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Files", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "redis.Client", "ImportData")
return result, validation.NewErrorWithValidationError(err, "redis.GroupClient", "ImportData")
}
req, err := client.ImportDataPreparer(resourceGroupName, name, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ImportData", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", nil, "Failure preparing request")
}
resp, err := client.ImportDataSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "ImportData", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure sending request")
}
result, err = client.ImportDataResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ImportData", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure responding to request")
}
return
}
// ImportDataPreparer prepares the ImportData request.
func (client Client) ImportDataPreparer(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) ImportDataPreparer(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -446,7 +446,7 @@ func (client Client) ImportDataPreparer(resourceGroupName string, name string, p
// ImportDataSender sends the ImportData request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ImportDataSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ImportDataSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -454,7 +454,7 @@ func (client Client) ImportDataSender(req *http.Request) (*http.Response, error)
// ImportDataResponder handles the response to the ImportData request. The method always
// closes the http.Response Body.
func (client Client) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -465,28 +465,28 @@ func (client Client) ImportDataResponder(resp *http.Response) (result autorest.R
}
// List gets all Redis caches in the specified subscription.
func (client Client) List() (result ListResult, err error) {
func (client GroupClient) List() (result ListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client Client) ListPreparer() (*http.Request, error) {
func (client GroupClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
@ -505,13 +505,13 @@ func (client Client) ListPreparer() (*http.Request, error) {
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) {
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -523,10 +523,10 @@ func (client Client) ListResponder(resp *http.Response) (result ListResult, err
}
// ListNextResults retrieves the next set of results, if any.
func (client Client) ListNextResults(lastResults ListResult) (result ListResult, err error) {
func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "List", nil, "Failure preparing next results request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
@ -535,12 +535,12 @@ func (client Client) ListNextResults(lastResults ListResult) (result ListResult,
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "List", resp, "Failure sending next results request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "List", resp, "Failure responding to next results request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to next results request")
}
return
@ -549,28 +549,28 @@ func (client Client) ListNextResults(lastResults ListResult) (result ListResult,
// ListByResourceGroup lists all Redis caches in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client Client) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) {
func (client GroupClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing request")
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client Client) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -590,13 +590,13 @@ func (client Client) ListByResourceGroupPreparer(resourceGroupName string) (*htt
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) 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 Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -608,10 +608,10 @@ func (client Client) ListByResourceGroupResponder(resp *http.Response) (result L
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client Client) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) {
func (client GroupClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", nil, "Failure preparing next results request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
@ -620,44 +620,44 @@ func (client Client) ListByResourceGroupNextResults(lastResults ListResult) (res
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure sending next results request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ListByResourceGroup", resp, "Failure responding to next results request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// ListKeys retrieve a Redis cache's access keys. This operation requires
// write permission to the cache resource.
// ListKeys retrieve a Redis cache's access keys. This operation requires write
// permission to the cache resource.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache.
func (client Client) ListKeys(resourceGroupName string, name string) (result AccessKeys, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache.
func (client GroupClient) ListKeys(resourceGroupName string, name string) (result AccessKeys, err error) {
req, err := client.ListKeysPreparer(resourceGroupName, name)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "ListKeys", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", nil, "Failure preparing request")
}
resp, err := client.ListKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "ListKeys", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure sending request")
}
result, err = client.ListKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "ListKeys", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure responding to request")
}
return
}
// ListKeysPreparer prepares the ListKeys request.
func (client Client) ListKeysPreparer(resourceGroupName string, name string) (*http.Request, error) {
func (client GroupClient) ListKeysPreparer(resourceGroupName string, name string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -678,13 +678,13 @@ func (client Client) ListKeysPreparer(resourceGroupName string, name string) (*h
// ListKeysSender sends the ListKeys request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListKeysResponder handles the response to the ListKeys request. The method always
// closes the http.Response Body.
func (client Client) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) {
func (client GroupClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -698,30 +698,30 @@ func (client Client) ListKeysResponder(resp *http.Response) (result AccessKeys,
// RegenerateKey regenerate Redis cache's access keys. This operation requires
// write permission to the cache resource.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is specifies which key to regenerate.
func (client Client) RegenerateKey(resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) {
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is specifies which key to regenerate.
func (client GroupClient) RegenerateKey(resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) {
req, err := client.RegenerateKeyPreparer(resourceGroupName, name, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", nil, "Failure preparing request")
}
resp, err := client.RegenerateKeySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure sending request")
}
result, err = client.RegenerateKeyResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "RegenerateKey", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure responding to request")
}
return
}
// RegenerateKeyPreparer prepares the RegenerateKey request.
func (client Client) RegenerateKeyPreparer(resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) {
func (client GroupClient) RegenerateKeyPreparer(resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -744,13 +744,13 @@ func (client Client) RegenerateKeyPreparer(resourceGroupName string, name string
// RegenerateKeySender sends the RegenerateKey request. The method will close the
// http.Response Body if it receives an error.
func (client Client) RegenerateKeySender(req *http.Request) (*http.Response, error) {
func (client GroupClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
// closes the http.Response Body.
func (client Client) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) {
func (client GroupClient) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -761,35 +761,33 @@ func (client Client) RegenerateKeyResponder(resp *http.Response) (result AccessK
return
}
// Update update an existing Redis cache. 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.
// Update update an existing Redis cache.
//
// resourceGroupName is the name of the resource group. name is the name of
// the Redis cache. parameters is parameters supplied to the Update Redis
// resourceGroupName is the name of the resource group. name is the name of the
// Redis cache. parameters is parameters supplied to the Update Redis
// operation.
func (client Client) Update(resourceGroupName string, name string, parameters UpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.UpdatePreparer(resourceGroupName, name, parameters, cancel)
func (client GroupClient) Update(resourceGroupName string, name string, parameters UpdateParameters) (result ResourceType, err error) {
req, err := client.UpdatePreparer(resourceGroupName, name, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "redis.Client", "Update", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Update", nil, "Failure preparing request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "redis.Client", "Update", resp, "Failure sending request")
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure sending request")
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "redis.Client", "Update", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client Client) UpdatePreparer(resourceGroupName string, name string, parameters UpdateParameters, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters UpdateParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -807,25 +805,24 @@ func (client Client) UpdatePreparer(resourceGroupName string, name string, param
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
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 Client) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
func (client GroupClient) 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 Client) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) UpdateResponder(resp *http.Response) (result ResourceType, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -14,30 +14,47 @@ package redis
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "redis", "2016-04-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "redis", "2016-04-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -18,7 +18,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -123,8 +123,8 @@ func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (resu
// List gets all deployments operations for a deployment.
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment with the
// operation to get. top is the number of results to return.
// insensitive. deploymentName is the name of the deployment with the operation
// to get. top is the number of results to return.
func (client DeploymentOperationsClient) List(resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -36,17 +36,16 @@ func NewDeploymentsClient(subscriptionID string) DeploymentsClient {
return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewDeploymentsClientWithBaseURI creates an instance of the
// DeploymentsClient client.
// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient
// client.
func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient {
return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Cancel you can cancel a deployment only if the provisioningState is
// Accepted or Running. After the deployment is canceled, the
// provisioningState is set to Canceled. Canceling a template deployment
// stops the currently running template deployment and leaves the resource
// group partially deployed.
// Cancel you can cancel a deployment only if the provisioningState is Accepted
// or Running. After the deployment is canceled, the provisioningState is set
// to Canceled. Canceling a template deployment stops the currently running
// template deployment and leaves the resource group partially deployed.
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment to cancel.
@ -196,9 +195,9 @@ func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (re
}
// CreateOrUpdate you can provide the template and parameters directly in the
// request or link to JSON files. 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.
// request or link to JSON files. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group to deploy the resources
// to. The name is case insensitive. The resource group must already exist.
@ -286,18 +285,18 @@ func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (re
}
// Delete a template deployment that is currently running cannot be deleted.
// Deleting a template deployment removes the associated deployment
// operations. Deleting a template deployment does not affect the state of
// the resource group. This is an asynchronous operation that returns a
// status of 202 until the template deployment is successfully deleted. The
// Location response header contains the URI that is used to obtain the
// status of the process. While the process is running, a call to the URI in
// the Location header returns a status of 202. When the process finishes,
// the URI in the Location header returns a status of 204 on success. If the
// asynchronous request failed, the URI in the Location header returns an
// error-level status code. 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.
// Deleting a template deployment removes the associated deployment operations.
// Deleting a template deployment does not affect the state of the resource
// group. This is an asynchronous operation that returns a status of 202 until
// the template deployment is successfully deleted. The Location response
// header contains the URI that is used to obtain the status of the process.
// While the process is running, a call to the URI in the Location header
// returns a status of 202. When the process finishes, the URI in the Location
// header returns a status of 204 on success. If the asynchronous request
// failed, the URI in the Location header returns an error-level status code.
// 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 with the deployment to
// delete. The name is case insensitive. deploymentName is the name of the
@ -377,8 +376,8 @@ func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result aut
// ExportTemplate exports the template used for specified deployment.
//
// resourceGroupName is the name of the resource group. The name is case
// insensitive. deploymentName is the name of the deployment from which to
// get the template.
// insensitive. deploymentName is the name of the deployment from which to get
// the template.
func (client DeploymentsClient) ExportTemplate(resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -529,9 +528,9 @@ func (client DeploymentsClient) GetResponder(resp *http.Response) (result Deploy
//
// resourceGroupName is the name of the resource group with the deployments to
// get. The name is case insensitive. filter is the filter to apply on the
// operation. For example, you can use $filter=provisioningState eq
// '{state}'. top is the number of results to get. If null is passed, returns
// all deployments.
// operation. For example, you can use $filter=provisioningState eq '{state}'.
// top is the number of results to get. If null is passed, returns all
// deployments.
func (client DeploymentsClient) List(resourceGroupName string, filter string, top *int32) (result DeploymentListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
@ -632,8 +631,8 @@ func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult
// and will be accepted by Azure Resource Manager..
//
// resourceGroupName is the name of the resource group the template will be
// deployed to. The name is case insensitive. deploymentName is the name of
// the deployment. parameters is parameters to validate.
// deployed to. The name is case insensitive. deploymentName is the name of the
// deployment. parameters is parameters to validate.
func (client DeploymentsClient) Validate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -113,19 +113,15 @@ func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result
// CreateOrUpdate creates a resource group.
//
// resourceGroupName is the name of the resource group to create or update.
// parameters is parameters supplied to the create or update a resource
// group.
func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, err error) {
// parameters is parameters supplied to the create or update a resource group.
func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters Group) (result Group, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Properties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.ID", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "CreateOrUpdate")
}
@ -149,7 +145,7 @@ func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters R
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, parameters ResourceGroup) (*http.Request, error) {
func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, parameters Group) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -177,7 +173,7 @@ func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Respon
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceGroup, err error) {
func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -191,8 +187,8 @@ func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result
// Delete when you delete a resource group, all of its resources are also
// deleted. Deleting a resource group deletes all of its template deployments
// and currently stored operations. 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.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group to delete. The name is
// case insensitive.
@ -265,9 +261,9 @@ func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest
// ExportTemplate captures the specified resource group as a template.
//
// resourceGroupName is the name of the resource group to export as a
// template. parameters is parameters for exporting the template.
func (client GroupsClient) ExportTemplate(resourceGroupName string, parameters ExportTemplateRequest) (result ResourceGroupExportResult, err error) {
// resourceGroupName is the name of the resource group to export as a template.
// parameters is parameters for exporting the template.
func (client GroupsClient) ExportTemplate(resourceGroupName string, parameters ExportTemplateRequest) (result GroupExportResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
@ -324,7 +320,7 @@ func (client GroupsClient) ExportTemplateSender(req *http.Request) (*http.Respon
// ExportTemplateResponder handles the response to the ExportTemplate request. The method always
// closes the http.Response Body.
func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result ResourceGroupExportResult, err error) {
func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -337,9 +333,9 @@ func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result
// Get gets a resource group.
//
// resourceGroupName is the name of the resource group to get. The name is
// case insensitive.
func (client GroupsClient) Get(resourceGroupName string) (result ResourceGroup, err error) {
// resourceGroupName is the name of the resource group to get. The name is case
// insensitive.
func (client GroupsClient) Get(resourceGroupName string) (result Group, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
@ -394,7 +390,7 @@ func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error)
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupsClient) GetResponder(resp *http.Response) (result ResourceGroup, err error) {
func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -407,9 +403,9 @@ func (client GroupsClient) GetResponder(resp *http.Response) (result ResourceGro
// List gets all the resource groups for a subscription.
//
// filter is the filter to apply on the operation. top is the number of
// results to return. If null is passed, returns all resource groups.
func (client GroupsClient) List(filter string, top *int32) (result ResourceGroupListResult, err error) {
// filter is the filter to apply on the operation. top is the number of results
// to return. If null is passed, returns all resource groups.
func (client GroupsClient) List(filter string, top *int32) (result GroupListResult, err error) {
req, err := client.ListPreparer(filter, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request")
@ -461,7 +457,7 @@ func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error)
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client GroupsClient) ListResponder(resp *http.Response) (result ResourceGroupListResult, err error) {
func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -473,8 +469,8 @@ func (client GroupsClient) ListResponder(resp *http.Response) (result ResourceGr
}
// ListNextResults retrieves the next set of results, if any.
func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult) (result ResourceGroupListResult, err error) {
req, err := lastResults.ResourceGroupListResultPreparer()
func (client GroupsClient) ListNextResults(lastResults GroupListResult) (result GroupListResult, err error) {
req, err := lastResults.GroupListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing next results request")
}
@ -498,11 +494,11 @@ func (client GroupsClient) ListNextResults(lastResults ResourceGroupListResult)
// ListResources get all the resources for a resource group.
//
// resourceGroupName is the resource group with the resources to get. filter
// is the filter to apply on the operation. expand is the $expand query
// parameter top is the number of results to return. If null is passed,
// returns all resources.
func (client GroupsClient) ListResources(resourceGroupName string, filter string, expand string, top *int32) (result ResourceListResult, err error) {
// resourceGroupName is the resource group with the resources to get. filter is
// the filter to apply on the operation. expand is the $expand query parameter
// top is the number of results to return. If null is passed, returns all
// resources.
func (client GroupsClient) ListResources(resourceGroupName string, filter string, expand string, top *int32) (result ListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
@ -566,7 +562,7 @@ func (client GroupsClient) ListResourcesSender(req *http.Request) (*http.Respons
// ListResourcesResponder handles the response to the ListResources request. The method always
// closes the http.Response Body.
func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result ResourceListResult, err error) {
func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -578,8 +574,8 @@ func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result R
}
// ListResourcesNextResults retrieves the next set of results, if any.
func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
func (client GroupsClient) ListResourcesNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing next results request")
}
@ -602,20 +598,18 @@ func (client GroupsClient) ListResourcesNextResults(lastResults ResourceListResu
}
// Patch resource groups can be updated through a simple PATCH operation to a
// group address. The format of the request is the same as that for creating
// a resource group. If a field is unspecified, the current value is retained.
// group address. The format of the request is the same as that for creating a
// resource group. If a field is unspecified, the current value is retained.
//
// resourceGroupName is the name of the resource group to update. The name is
// case insensitive. parameters is parameters supplied to update a resource
// group.
func (client GroupsClient) Patch(resourceGroupName string, parameters ResourceGroup) (result ResourceGroup, err error) {
func (client GroupsClient) Patch(resourceGroupName string, parameters Group) (result Group, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.ID", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Patch")
}
@ -639,7 +633,7 @@ func (client GroupsClient) Patch(resourceGroupName string, parameters ResourceGr
}
// PatchPreparer prepares the Patch request.
func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters ResourceGroup) (*http.Request, error) {
func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters Group) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -667,7 +661,7 @@ func (client GroupsClient) PatchSender(req *http.Request) (*http.Response, error
// PatchResponder handles the response to the Patch request. The method always
// closes the http.Response Body.
func (client GroupsClient) PatchResponder(resp *http.Response) (result ResourceGroup, err error) {
func (client GroupsClient) PatchResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -39,8 +39,8 @@ const (
type ResourceIdentityType string
const (
// SystemAssigned specifies the system assigned state for resource
// identity type.
// SystemAssigned specifies the system assigned state for resource identity
// type.
SystemAssigned ResourceIdentityType = "SystemAssigned"
)
@ -165,7 +165,7 @@ type DeploymentProperties struct {
Parameters *map[string]interface{} `json:"parameters,omitempty"`
ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
Mode DeploymentMode `json:"mode,omitempty"`
*DebugSetting `json:"debugSetting,omitempty"`
DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
}
// DeploymentPropertiesExtended is deployment properties with additional
@ -182,21 +182,21 @@ type DeploymentPropertiesExtended struct {
Parameters *map[string]interface{} `json:"parameters,omitempty"`
ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
Mode DeploymentMode `json:"mode,omitempty"`
*DebugSetting `json:"debugSetting,omitempty"`
DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
}
// DeploymentValidateResult is information from validate template deployment
// response.
type DeploymentValidateResult struct {
autorest.Response `json:"-"`
Error *ResourceManagementErrorWithDetails `json:"error,omitempty"`
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
Error *ManagementErrorWithDetails `json:"error,omitempty"`
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
}
// ExportTemplateRequest is export resource group template request parameters.
type ExportTemplateRequest struct {
Resources *[]string `json:"resources,omitempty"`
Options *string `json:"options,omitempty"`
ResourcesProperty *[]string `json:"resources,omitempty"`
Options *string `json:"options,omitempty"`
}
// GenericResource is resource information.
@ -222,6 +222,54 @@ type GenericResourceFilter struct {
Tagvalue *string `json:"tagvalue,omitempty"`
}
// Group is resource group information.
type Group struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Properties *GroupProperties `json:"properties,omitempty"`
Location *string `json:"location,omitempty"`
ManagedBy *string `json:"managedBy,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// GroupExportResult is
type GroupExportResult struct {
autorest.Response `json:"-"`
Template *map[string]interface{} `json:"template,omitempty"`
Error *ManagementErrorWithDetails `json:"error,omitempty"`
}
// GroupFilter is resource group filter.
type GroupFilter struct {
TagName *string `json:"tagName,omitempty"`
TagValue *string `json:"tagValue,omitempty"`
}
// GroupListResult is list of resource groups.
type GroupListResult struct {
autorest.Response `json:"-"`
Value *[]Group `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// GroupListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client GroupListResult) GroupListResultPreparer() (*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)))
}
// GroupProperties is the resource group properties.
type GroupProperties struct {
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// HTTPMessage is
type HTTPMessage struct {
Content *map[string]interface{} `json:"content,omitempty"`
@ -234,9 +282,36 @@ type Identity struct {
Type ResourceIdentityType `json:"type,omitempty"`
}
// ListResult is list of resource groups.
type ListResult struct {
autorest.Response `json:"-"`
Value *[]GenericResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ListResult) ListResultPreparer() (*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)))
}
// ManagementErrorWithDetails is
type ManagementErrorWithDetails struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Target *string `json:"target,omitempty"`
Details *[]ManagementErrorWithDetails `json:"details,omitempty"`
}
// MoveInfo is parameters of move resources.
type MoveInfo struct {
Resources *[]string `json:"resources,omitempty"`
ResourcesProperty *[]string `json:"resources,omitempty"`
TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
}
@ -283,6 +358,16 @@ func (client ProviderListResult) ProviderListResultPreparer() (*http.Request, er
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ProviderOperationDisplayProperties is resource provider operation's display
// properties.
type ProviderOperationDisplayProperties struct {
Publisher *string `json:"publisher,omitempty"`
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// ProviderResourceType is resource type managed by the resource provider.
type ProviderResourceType struct {
ResourceType *string `json:"resourceType,omitempty"`
@ -301,91 +386,6 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// ResourceGroup is resource group information.
type ResourceGroup struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Properties *ResourceGroupProperties `json:"properties,omitempty"`
Location *string `json:"location,omitempty"`
ManagedBy *string `json:"managedBy,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// ResourceGroupExportResult is
type ResourceGroupExportResult struct {
autorest.Response `json:"-"`
Template *map[string]interface{} `json:"template,omitempty"`
Error *ResourceManagementErrorWithDetails `json:"error,omitempty"`
}
// ResourceGroupFilter is resource group filter.
type ResourceGroupFilter struct {
TagName *string `json:"tagName,omitempty"`
TagValue *string `json:"tagValue,omitempty"`
}
// ResourceGroupListResult is list of resource groups.
type ResourceGroupListResult struct {
autorest.Response `json:"-"`
Value *[]ResourceGroup `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceGroupListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResourceGroupListResult) ResourceGroupListResultPreparer() (*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)))
}
// ResourceGroupProperties is the resource group properties.
type ResourceGroupProperties struct {
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// ResourceListResult is list of resource groups.
type ResourceListResult struct {
autorest.Response `json:"-"`
Value *[]GenericResource `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResourceListResult) ResourceListResultPreparer() (*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)))
}
// ResourceManagementErrorWithDetails is
type ResourceManagementErrorWithDetails struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Target *string `json:"target,omitempty"`
Details *[]ResourceManagementErrorWithDetails `json:"details,omitempty"`
}
// ResourceProviderOperationDisplayProperties is resource provider operation's
// display properties.
type ResourceProviderOperationDisplayProperties struct {
Publisher *string `json:"publisher,omitempty"`
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// Sku is sKU for the resource.
type Sku struct {
Name *string `json:"name,omitempty"`
@ -404,7 +404,7 @@ type SubResource struct {
// TagCount is tag count.
type TagCount struct {
Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
Value *int32 `json:"value,omitempty"`
}
// TagDetails is tag details.
@ -439,7 +439,7 @@ func (client TagsListResult) TagsListResultPreparer() (*http.Request, error) {
type TagValue struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
TagValueProperty *string `json:"tagValue,omitempty"`
TagValue *string `json:"tagValue,omitempty"`
Count *TagCount `json:"count,omitempty"`
}

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -44,8 +44,8 @@ func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) Provid
// Get gets the specified resource provider.
//
// resourceProviderNamespace is the namespace of the resource provider. expand
// is the $expand query parameter. For example, to include property aliases
// in response, use $expand=resourceTypes/aliases.
// is the $expand query parameter. For example, to include property aliases in
// response, use $expand=resourceTypes/aliases.
func (client ProvidersClient) Get(resourceProviderNamespace string, expand string) (result Provider, err error) {
req, err := client.GetPreparer(resourceProviderNamespace, expand)
if err != nil {

View File

@ -14,70 +14,71 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"net/http"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// Client is the provides operations for working with resources and resource
// groups.
type Client struct {
// GroupClient is the provides operations for working with resources and
// resource groups.
type GroupClient struct {
ManagementClient
}
// NewClient creates an instance of the Client client.
func NewClient(subscriptionID string) Client {
return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClientWithBaseURI creates an instance of the Client client.
func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
return Client{NewWithBaseURI(baseURI, subscriptionID)}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CheckExistence checks whether a resource exists.
//
// resourceGroupName is the name of the resource group containing the resource
// to check. The name is case insensitive. resourceProviderNamespace is the
// resource provider of the resource to check. parentResourcePath is the
// parent resource identity. resourceType is the resource type. resourceName
// is the name of the resource to check whether it exists.
func (client Client) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) {
// resource provider of the resource to check. parentResourcePath is the parent
// resource identity. resourceType is the resource type. resourceName is the
// name of the resource to check whether it exists.
func (client GroupClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "CheckExistence")
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CheckExistence")
}
req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure sending request")
}
result, err = client.CheckExistenceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistence", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure responding to request")
}
return
}
// CheckExistencePreparer prepares the CheckExistence request.
func (client Client) CheckExistencePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
func (client GroupClient) CheckExistencePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -101,13 +102,13 @@ func (client Client) CheckExistencePreparer(resourceGroupName string, resourcePr
// CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CheckExistenceSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
// closes the http.Response Body.
func (client Client) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -119,31 +120,31 @@ func (client Client) CheckExistenceResponder(resp *http.Response) (result autore
// CheckExistenceByID checks by ID whether a resource exists.
//
// resourceID is the fully qualified ID of the resource, including the
// resource name and resource type. Use the format,
// resourceID is the fully qualified ID of the resource, including the resource
// name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
func (client Client) CheckExistenceByID(resourceID string) (result autorest.Response, err error) {
func (client GroupClient) CheckExistenceByID(resourceID string) (result autorest.Response, err error) {
req, err := client.CheckExistenceByIDPreparer(resourceID)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", nil, "Failure preparing request")
}
resp, err := client.CheckExistenceByIDSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure sending request")
}
result, err = client.CheckExistenceByIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "CheckExistenceByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure responding to request")
}
return
}
// CheckExistenceByIDPreparer prepares the CheckExistenceByID request.
func (client Client) CheckExistenceByIDPreparer(resourceID string) (*http.Request, error) {
func (client GroupClient) CheckExistenceByIDPreparer(resourceID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceId": resourceID,
}
@ -162,13 +163,13 @@ func (client Client) CheckExistenceByIDPreparer(resourceID string) (*http.Reques
// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always
// closes the http.Response Body.
func (client Client) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -179,16 +180,16 @@ func (client Client) CheckExistenceByIDResponder(resp *http.Response) (result au
}
// CreateOrUpdate creates a resource. 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.
// 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 for the resource. The
// name is case insensitive. resourceProviderNamespace is the namespace of
// the resource provider. parentResourcePath is the parent resource identity.
// resourceType is the resource type of the resource to create. resourceName
// is the name of the resource to create. parameters is parameters for
// creating or updating the resource.
func (client Client) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (result autorest.Response, err error) {
// name is case insensitive. resourceProviderNamespace is the namespace of the
// resource provider. parentResourcePath is the parent resource identity.
// resourceType is the resource type of the resource to create. resourceName is
// the name of the resource to create. parameters is parameters for creating or
// updating the resource.
func (client GroupClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
@ -196,35 +197,31 @@ func (client Client) CreateOrUpdate(resourceGroupName string, resourceProviderNa
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}},
{Target: "parameters.Identity", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Identity.PrincipalID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.Identity.TenantID", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "CreateOrUpdate")
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdate", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client Client) CreateOrUpdatePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -250,7 +247,7 @@ func (client Client) CreateOrUpdatePreparer(resourceGroupName string, resourcePr
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -258,7 +255,7 @@ func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, er
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client Client) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -269,47 +266,43 @@ func (client Client) CreateOrUpdateResponder(resp *http.Response) (result autore
}
// CreateOrUpdateByID create a resource by ID. 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.
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceID is the fully qualified ID of the resource, including the
// resource name and resource type. Use the format,
// resourceID is the fully qualified ID of the resource, including the resource
// name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
// parameters is create or update resource parameters.
func (client Client) CreateOrUpdateByID(resourceID string, parameters GenericResource, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client GroupClient) CreateOrUpdateByID(resourceID string, parameters GenericResource, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}},
{Target: "parameters.Identity", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Identity.PrincipalID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.Identity.TenantID", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "CreateOrUpdateByID")
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdateByID")
}
req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateByIDSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateByIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "CreateOrUpdateByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure responding to request")
}
return
}
// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request.
func (client Client) CreateOrUpdateByIDPreparer(resourceID string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) CreateOrUpdateByIDPreparer(resourceID string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceId": resourceID,
}
@ -330,7 +323,7 @@ func (client Client) CreateOrUpdateByIDPreparer(resourceID string, parameters Ge
// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the
// http.Response Body if it receives an error.
func (client Client) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -338,7 +331,7 @@ func (client Client) CreateOrUpdateByIDSender(req *http.Request) (*http.Response
// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always
// closes the http.Response Body.
func (client Client) CreateOrUpdateByIDResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) CreateOrUpdateByIDResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -349,44 +342,44 @@ func (client Client) CreateOrUpdateByIDResponder(resp *http.Response) (result au
}
// Delete deletes a resource. 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.
// 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 that contains the
// resource to delete. The name is case insensitive.
// resourceProviderNamespace is the namespace of the resource provider.
// parentResourcePath is the parent resource identity. resourceType is the
// resource type. resourceName is the name of the resource to delete.
func (client Client) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
// resource to delete. The name is case insensitive. resourceProviderNamespace
// is the namespace of the resource provider. parentResourcePath is the parent
// resource identity. resourceType is the resource type. resourceName is the
// name of the resource to delete.
func (client GroupClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "Delete")
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "Delete")
}
req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "Delete", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "Delete", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "Delete", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client Client) DeletePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) DeletePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -410,7 +403,7 @@ func (client Client) DeletePreparer(resourceGroupName string, resourceProviderNa
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -418,7 +411,7 @@ func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -429,34 +422,34 @@ func (client Client) DeleteResponder(resp *http.Response) (result autorest.Respo
}
// DeleteByID deletes a resource by ID. 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.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceID is the fully qualified ID of the resource, including the
// resource name and resource type. Use the format,
// resourceID is the fully qualified ID of the resource, including the resource
// name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
func (client Client) DeleteByID(resourceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client GroupClient) DeleteByID(resourceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeleteByIDPreparer(resourceID, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", nil, "Failure preparing request")
}
resp, err := client.DeleteByIDSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure sending request")
}
result, err = client.DeleteByIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "DeleteByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure responding to request")
}
return
}
// DeleteByIDPreparer prepares the DeleteByID request.
func (client Client) DeleteByIDPreparer(resourceID string, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) DeleteByIDPreparer(resourceID string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceId": resourceID,
}
@ -475,7 +468,7 @@ func (client Client) DeleteByIDPreparer(resourceID string, cancel <-chan struct{
// DeleteByIDSender sends the DeleteByID request. The method will close the
// http.Response Body if it receives an error.
func (client Client) DeleteByIDSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) DeleteByIDSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -483,7 +476,7 @@ func (client Client) DeleteByIDSender(req *http.Request) (*http.Response, error)
// DeleteByIDResponder handles the response to the DeleteByID request. The method always
// closes the http.Response Body.
func (client Client) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -500,36 +493,36 @@ func (client Client) DeleteByIDResponder(resp *http.Response) (result autorest.R
// namespace of the resource provider. parentResourcePath is the parent
// resource identity. resourceType is the resource type of the resource.
// resourceName is the name of the resource to get.
func (client Client) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) {
func (client GroupClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "Get")
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "Get")
}
req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "Get", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "Get", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client Client) GetPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
func (client GroupClient) GetPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -553,13 +546,13 @@ func (client Client) GetPreparer(resourceGroupName string, resourceProviderNames
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client Client) GetSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client Client) GetResponder(resp *http.Response) (result GenericResource, err error) {
func (client GroupClient) GetResponder(resp *http.Response) (result GenericResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -572,31 +565,31 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource,
// GetByID gets a resource by ID.
//
// resourceID is the fully qualified ID of the resource, including the
// resource name and resource type. Use the format,
// resourceID is the fully qualified ID of the resource, including the resource
// name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
func (client Client) GetByID(resourceID string) (result GenericResource, err error) {
func (client GroupClient) GetByID(resourceID string) (result GenericResource, err error) {
req, err := client.GetByIDPreparer(resourceID)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "GetByID", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", nil, "Failure preparing request")
}
resp, err := client.GetByIDSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure sending request")
}
result, err = client.GetByIDResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "GetByID", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure responding to request")
}
return
}
// GetByIDPreparer prepares the GetByID request.
func (client Client) GetByIDPreparer(resourceID string) (*http.Request, error) {
func (client GroupClient) GetByIDPreparer(resourceID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceId": resourceID,
}
@ -615,13 +608,13 @@ func (client Client) GetByIDPreparer(resourceID string) (*http.Request, error) {
// GetByIDSender sends the GetByID request. The method will close the
// http.Response Body if it receives an error.
func (client Client) GetByIDSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) GetByIDSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetByIDResponder handles the response to the GetByID request. The method always
// closes the http.Response Body.
func (client Client) GetByIDResponder(resp *http.Response) (result GenericResource, err error) {
func (client GroupClient) GetByIDResponder(resp *http.Response) (result GenericResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -637,28 +630,28 @@ func (client Client) GetByIDResponder(resp *http.Response) (result GenericResour
// filter is the filter to apply on the operation. expand is the $expand query
// parameter. top is the number of results to return. If null is passed,
// returns all resource groups.
func (client Client) List(filter string, expand string, top *int32) (result ResourceListResult, err error) {
func (client GroupClient) List(filter string, expand string, top *int32) (result ListResult, err error) {
req, err := client.ListPreparer(filter, expand, top)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client Client) ListPreparer(filter string, expand string, top *int32) (*http.Request, error) {
func (client GroupClient) ListPreparer(filter string, expand string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
@ -686,13 +679,13 @@ func (client Client) ListPreparer(filter string, expand string, top *int32) (*ht
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client Client) ListSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client Client) ListResponder(resp *http.Response) (result ResourceListResult, err error) {
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
@ -704,10 +697,10 @@ func (client Client) ListResponder(resp *http.Response) (result ResourceListResu
}
// ListNextResults retrieves the next set of results, if any.
func (client Client) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.ResourceListResultPreparer()
func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "List", nil, "Failure preparing next results request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
@ -716,12 +709,12 @@ func (client Client) ListNextResults(lastResults ResourceListResult) (result Res
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending next results request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to next results request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to next results request")
}
return
@ -729,45 +722,44 @@ func (client Client) ListNextResults(lastResults ResourceListResult) (result Res
// MoveResources the resources to move must be in the same source resource
// group. The target resource group may be in a different subscription. When
// moving resources, both the source group and the target group are locked
// for the duration of the operation. Write and delete operations are blocked
// on the groups until the move completes. 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.
// moving resources, both the source group and the target group are locked for
// the duration of the operation. Write and delete operations are blocked on
// the groups until the move completes. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// sourceResourceGroupName is the name of the resource group containing the
// rsources to move. parameters is parameters for moving resources.
func (client Client) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client GroupClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: sourceResourceGroupName,
Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "resources.Client", "MoveResources")
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "MoveResources")
}
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "resources.Client", "MoveResources", nil, "Failure preparing request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", nil, "Failure preparing request")
}
resp, err := client.MoveResourcesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "resources.Client", "MoveResources", resp, "Failure sending request")
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure sending request")
}
result, err = client.MoveResourcesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "MoveResources", resp, "Failure responding to request")
err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure responding to request")
}
return
}
// MoveResourcesPreparer prepares the MoveResources request.
func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) {
func (client GroupClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -789,7 +781,7 @@ func (client Client) MoveResourcesPreparer(sourceResourceGroupName string, param
// MoveResourcesSender sends the MoveResources request. The method will close the
// http.Response Body if it receives an error.
func (client Client) MoveResourcesSender(req *http.Request) (*http.Response, error) {
func (client GroupClient) MoveResourcesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
@ -797,7 +789,7 @@ func (client Client) MoveResourcesSender(req *http.Request) (*http.Response, err
// MoveResourcesResponder handles the response to the MoveResources request. The method always
// closes the http.Response Body.
func (client Client) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) {
func (client GroupClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),

View File

@ -14,7 +14,7 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -40,9 +40,9 @@ func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient
return TagsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate the tag name can have a maximum of 512 characters and is
// case insensitive. Tag names created by Azure have prefixes of microsoft,
// azure, or windows. You cannot create tags with one of these prefixes.
// CreateOrUpdate the tag name can have a maximum of 512 characters and is case
// insensitive. Tag names created by Azure have prefixes of microsoft, azure,
// or windows. You cannot create tags with one of these prefixes.
//
// tagName is the name of the tag to create.
func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, err error) {

View File

@ -14,30 +14,47 @@ package resources
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "resources", "2016-09-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "resources", "2016-09-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -1,6 +1,7 @@
// Package scheduler implements the Azure ARM Scheduler service API version
// 2016-03-01.
//
//
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
@ -17,7 +18,7 @@ package scheduler
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,14 +14,13 @@ package scheduler
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.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"
)
@ -49,13 +48,6 @@ func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) J
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: jobCollection,
Constraints: []validation.Constraint{{Target: "jobCollection.ID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "jobCollection.Type", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -117,8 +109,8 @@ func (client JobCollectionsClient) CreateOrUpdateResponder(resp *http.Response)
}
// Delete deletes a job collection. 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.
// 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 resource group name. jobCollectionName is the job
// collection name.
@ -182,8 +174,8 @@ func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result
return
}
// Disable disables all of the jobs in the job collection. This method may
// poll for completion. Polling can be canceled by passing the cancel channel
// Disable disables all of the jobs in the job collection. 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.
//
@ -551,13 +543,6 @@ func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults Job
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: jobCollection,
Constraints: []validation.Constraint{{Target: "jobCollection.ID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "jobCollection.Type", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobCollectionsClient", "Patch")
}
req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", nil, "Failure preparing request")

View File

@ -14,7 +14,7 @@ package scheduler
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -45,24 +45,6 @@ func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition.
func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: job,
Constraints: []validation.Constraint{{Target: "job.Properties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "job.Properties.Status", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "job.Properties.Status.ExecutionCount", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Properties.Status.FailureCount", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Properties.Status.FaultedCount", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Properties.Status.LastExecutionTime", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Properties.Status.NextExecutionTime", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
{Target: "job.Properties.Status", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
{Target: "job.ID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Type", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Name", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -255,9 +237,8 @@ func (client JobsClient) GetResponder(resp *http.Response) (result JobDefinition
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. top is the number of jobs to request, in the of range of
// [1..100]. skip is the (0-based) index of the job history list from which
// to begin requesting entries. filter is the filter to apply on the job
// state.
// [1..100]. skip is the (0-based) index of the job history list from which to
// begin requesting entries. filter is the filter to apply on the job state.
func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: top,
@ -363,8 +344,8 @@ func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobL
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. top is the number of job history
// to request, in the of range of [1..100]. skip is the (0-based) index of
// the job history list from which to begin requesting entries. filter is the
// to request, in the of range of [1..100]. skip is the (0-based) index of the
// job history list from which to begin requesting entries. filter is the
// filter to apply on the job state.
func (client JobsClient) ListJobHistory(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (result JobHistoryListResult, err error) {
if err := validation.Validate([]validation.Validation{
@ -473,14 +454,6 @@ func (client JobsClient) ListJobHistoryNextResults(lastResults JobHistoryListRes
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition.
func (client JobsClient) Patch(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: job,
Constraints: []validation.Constraint{{Target: "job.ID", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Type", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "job.Name", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "Patch")
}
req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", nil, "Failure preparing request")

View File

@ -14,7 +14,7 @@ package scheduler
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -121,20 +121,20 @@ const (
type JobScheduleDay string
const (
// JobScheduleDayFriday specifies the job schedule day friday state for
// job schedule day.
// JobScheduleDayFriday specifies the job schedule day friday state for job
// schedule day.
JobScheduleDayFriday JobScheduleDay = "Friday"
// JobScheduleDayMonday specifies the job schedule day monday state for
// job schedule day.
// JobScheduleDayMonday specifies the job schedule day monday state for job
// schedule day.
JobScheduleDayMonday JobScheduleDay = "Monday"
// JobScheduleDaySaturday specifies the job schedule day saturday state
// for job schedule day.
JobScheduleDaySaturday JobScheduleDay = "Saturday"
// JobScheduleDaySunday specifies the job schedule day sunday state for
// JobScheduleDaySaturday specifies the job schedule day saturday state for
// job schedule day.
JobScheduleDaySaturday JobScheduleDay = "Saturday"
// JobScheduleDaySunday specifies the job schedule day sunday state for job
// schedule day.
JobScheduleDaySunday JobScheduleDay = "Sunday"
// JobScheduleDayThursday specifies the job schedule day thursday state
// for job schedule day.
// JobScheduleDayThursday specifies the job schedule day thursday state for
// job schedule day.
JobScheduleDayThursday JobScheduleDay = "Thursday"
// JobScheduleDayTuesday specifies the job schedule day tuesday state for
// job schedule day.
@ -485,7 +485,7 @@ type ServiceBusBrokeredMessageProperties struct {
ReplyToSessionID *string `json:"replyToSessionId,omitempty"`
ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"`
SessionID *string `json:"sessionId,omitempty"`
TimeToLive *date.Time `json:"timeToLive,omitempty"`
TimeToLive *string `json:"timeToLive,omitempty"`
To *string `json:"to,omitempty"`
ViaPartitionKey *string `json:"viaPartitionKey,omitempty"`
}

View File

@ -14,30 +14,47 @@ package scheduler
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "scheduler", "2016-03-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "scheduler", "2016-03-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -18,7 +18,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -70,8 +70,8 @@ const (
// EntityStatusDisabled specifies the entity status disabled state for
// entity status.
EntityStatusDisabled EntityStatus = "Disabled"
// EntityStatusReceiveDisabled specifies the entity status receive
// disabled state for entity status.
// EntityStatusReceiveDisabled specifies the entity status receive disabled
// state for entity status.
EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled"
// EntityStatusRenaming specifies the entity status renaming state for
// entity status.
@ -79,11 +79,11 @@ const (
// EntityStatusRestoring specifies the entity status restoring state for
// entity status.
EntityStatusRestoring EntityStatus = "Restoring"
// EntityStatusSendDisabled specifies the entity status send disabled
// state for entity status.
// EntityStatusSendDisabled specifies the entity status send disabled state
// for entity status.
EntityStatusSendDisabled EntityStatus = "SendDisabled"
// EntityStatusUnknown specifies the entity status unknown state for
// entity status.
// EntityStatusUnknown specifies the entity status unknown state for entity
// status.
EntityStatusUnknown EntityStatus = "Unknown"
)
@ -226,8 +226,8 @@ type NamespaceResource struct {
*NamespaceProperties `json:"properties,omitempty"`
}
// QueueCreateOrUpdateParameters is parameters supplied to the Create Or
// Update Queue operation.
// QueueCreateOrUpdateParameters is parameters supplied to the Create Or Update
// Queue operation.
type QueueCreateOrUpdateParameters struct {
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
@ -315,8 +315,8 @@ type ResourceListKeys struct {
KeyName *string `json:"keyName,omitempty"`
}
// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters
// supplied to the Create Or Update Authorization Rules operation.
// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied
// to the Create Or Update Authorization Rules operation.
type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct {
Location *string `json:"location,omitempty"`
Name *string `json:"name,omitempty"`
@ -368,8 +368,8 @@ type Sku struct {
Capacity *int32 `json:"capacity,omitempty"`
}
// SubscriptionCreateOrUpdateParameters is parameters supplied to the Create
// Or Update Subscription operation.
// SubscriptionCreateOrUpdateParameters is parameters supplied to the Create Or
// Update Subscription operation.
type SubscriptionCreateOrUpdateParameters struct {
Location *string `json:"location,omitempty"`
Type *string `json:"type,omitempty"`
@ -426,8 +426,8 @@ type SubscriptionResource struct {
*SubscriptionProperties `json:"properties,omitempty"`
}
// TopicCreateOrUpdateParameters is parameters supplied to the Create Or
// Update Topic operation.
// TopicCreateOrUpdateParameters is parameters supplied to the Create Or Update
// Topic operation.
type TopicCreateOrUpdateParameters struct {
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`

View File

@ -14,7 +14,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -43,9 +43,9 @@ func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) Names
// CreateOrUpdate creates or updates a service namespace. Once created, this
// namespace's resource manifest is immutable. This operation is idempotent.
// 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.
// 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. namespaceName is the
// namespace name. parameters is parameters supplied to create a namespace
@ -118,12 +118,12 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res
return
}
// CreateOrUpdateAuthorizationRule creates or updates an authorization rule
// for a namespace.
// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for
// a namespace.
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. authorizationRuleName is namespace authorization rule
// name. parameters is the shared access authorization rule.
// namespace name. authorizationRuleName is namespace authorization rule name.
// parameters is the shared access authorization rule.
func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
@ -195,9 +195,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *ht
// Delete deletes an existing namespace. This operation also removes all
// associated resources under the namespace. 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.
// 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. namespaceName is the
// namespace name.

View File

@ -14,7 +14,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -118,8 +118,7 @@ func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. queueName is the queue name. authorizationRuleName is
// authorization rule name. parameters is the shared access authorization
// rule.
// authorization rule name. parameters is the shared access authorization rule.
func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
@ -694,8 +693,8 @@ func (client QueuesClient) ListKeysResponder(resp *http.Response) (result Resour
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. queueName is the queue name. authorizationRuleName is the
// authorization rule name. parameters is parameters supplied to regenerate
// the authorization rule.
// authorization rule name. parameters is parameters supplied to regenerate the
// authorization rule.
func (client QueuesClient) RegenerateKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) {
req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters)
if err != nil {

View File

@ -14,7 +14,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -118,8 +118,7 @@ func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. topicName is the topic name. authorizationRuleName is
// authorization rule name. parameters is the shared access authorization
// rule.
// authorization rule name. parameters is the shared access authorization rule.
func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
@ -694,8 +693,8 @@ func (client TopicsClient) ListKeysResponder(resp *http.Response) (result Resour
//
// resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. topicName is the topic name. authorizationRuleName is the
// authorization rule name. parameters is parameters supplied to regenerate
// the authorization rule.
// authorization rule name. parameters is parameters supplied to regenerate the
// authorization rule.
func (client TopicsClient) RegenerateKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) {
req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters)
if err != nil {

View File

@ -14,30 +14,47 @@ package servicebus
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "servicebus", "2015-08-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "servicebus", "2015-08-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -133,19 +133,13 @@ func (client AccountsClient) Create(resourceGroupName string, accountName string
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}}},
Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, 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},
}},
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.KeySource", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create")
}

View File

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

View File

@ -1,6 +1,7 @@
// Package trafficmanager implements the Azure ARM Trafficmanager service API
// version 2015-11-01.
//
//
package trafficmanager
// Copyright (c) Microsoft and contributors. All rights reserved.
@ -17,7 +18,7 @@ package trafficmanager
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package trafficmanager
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -47,8 +47,8 @@ func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) Endpoi
// Manager endpoint to be created or updated. profileName is the name of the
// Traffic Manager profile. endpointType is the type of the Traffic Manager
// endpoint to be created or updated. endpointName is the name of the Traffic
// Manager endpoint to be created or updated. parameters is the Traffic
// Manager endpoint parameters supplied to the CreateOrUpdate operation.
// Manager endpoint to be created or updated. parameters is the Traffic Manager
// endpoint parameters supplied to the CreateOrUpdate operation.
func (client EndpointsClient) CreateOrUpdate(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters)
if err != nil {
@ -116,9 +116,9 @@ func (client EndpointsClient) CreateOrUpdateResponder(resp *http.Response) (resu
//
// resourceGroupName is the name of the resource group containing the Traffic
// Manager endpoint to be deleted. profileName is the name of the Traffic
// Manager profile. endpointType is the type of the Traffic Manager endpoint
// to be deleted. endpointName is the name of the Traffic Manager endpoint to
// be deleted.
// Manager profile. endpointType is the type of the Traffic Manager endpoint to
// be deleted. endpointName is the name of the Traffic Manager endpoint to be
// deleted.
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointType string, endpointName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, profileName, endpointType, endpointName)
if err != nil {
@ -250,10 +250,10 @@ func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint
//
// resourceGroupName is the name of the resource group containing the Traffic
// Manager endpoint to be updated. profileName is the name of the Traffic
// Manager profile. endpointType is the type of the Traffic Manager endpoint
// to be updated. endpointName is the name of the Traffic Manager endpoint to
// be updated. parameters is the Traffic Manager endpoint parameters supplied
// to the Update operation.
// Manager profile. endpointType is the type of the Traffic Manager endpoint to
// be updated. endpointName is the name of the Traffic Manager endpoint to be
// updated. parameters is the Traffic Manager endpoint parameters supplied to
// the Update operation.
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) {
req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters)
if err != nil {

View File

@ -14,7 +14,7 @@ package trafficmanager
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

View File

@ -14,7 +14,7 @@ package trafficmanager
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
@ -423,8 +423,8 @@ func (client ProfilesClient) ListAllInResourceGroupResponder(resp *http.Response
//
// resourceGroupName is the name of the resource group containing the Traffic
// Manager profile. profileName is the name of the Traffic Manager profile.
// parameters is the Traffic Manager profile parameters supplied to the
// Update operation.
// parameters is the Traffic Manager profile parameters supplied to the Update
// operation.
func (client ProfilesClient) Update(resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) {
req, err := client.UpdatePreparer(resourceGroupName, profileName, parameters)
if err != nil {

View File

@ -14,30 +14,47 @@ package trafficmanager
// 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
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
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"
major = "8"
minor = "0"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return fmt.Sprintf(userAgentFormat, Version(), "trafficmanager", "2015-11-01")
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "trafficmanager", "2015-11-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}

View File

@ -124,7 +124,7 @@ func encodeLabel(label string) string {
}
// decodeLabel is a helper function which decodes the base64 encoded
// label recieved from Azure into standard encoding.
// label received from Azure into standard encoding.
func decodeLabel(label string) string {
res, _ := base64.StdEncoding.DecodeString(label)
return string(res)

View File

@ -61,6 +61,9 @@ func ClientFromPublishSettingsDataWithConfig(data []byte, subscriptionID string,
}
pems, err := pkcs12.ToPEM(pfxData, "")
if err != nil {
return client, err
}
cert := []byte{}
for _, b := range pems {

View File

@ -27,7 +27,7 @@ const (
DatabaseServerVersion12 = "12.0"
)
// DatabaseServer represents the set of data recieved from
// DatabaseServer represents the set of data received from
// a database server list operation.
//
// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx
@ -45,7 +45,7 @@ type ListServersResponse struct {
}
// FirewallRuleCreateParams represents the set of possible
// paramaters when creating a firewall rule on an Azure database server.
// parameters when creating a firewall rule on an Azure database server.
//
// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx
type FirewallRuleCreateParams struct {
@ -55,7 +55,7 @@ type FirewallRuleCreateParams struct {
EndIPAddress string
}
// FirewallRuleResponse represents the set of data recieved from
// FirewallRuleResponse represents the set of data received from
// an Azure database server firewall rule get response.
//
// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx

View File

@ -58,7 +58,9 @@ func AddAzureDockerVMExtensionConfiguration(role *vm.Role, dockerPort int, versi
return fmt.Errorf(errParamNotSpecified, "role")
}
ConfigureWithExternalPort(role, "docker", dockerPort, dockerPort, vm.InputEndpointProtocolTCP)
if err := ConfigureWithExternalPort(role, "docker", dockerPort, dockerPort, vm.InputEndpointProtocolTCP); err != nil {
return err
}
publicConfiguration, err := createDockerPublicConfig(dockerPort)
if err != nil {

View File

@ -0,0 +1,223 @@
// Package storage provides clients for Microsoft Azure Storage Services.
package storage
import (
"bytes"
"fmt"
"net/url"
"sort"
"strings"
)
// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services
type authentication string
const (
sharedKey authentication = "sharedKey"
sharedKeyForTable authentication = "sharedKeyTable"
sharedKeyLite authentication = "sharedKeyLite"
sharedKeyLiteForTable authentication = "sharedKeyLiteTable"
// headers
headerAuthorization = "Authorization"
headerContentLength = "Content-Length"
headerDate = "Date"
headerXmsDate = "x-ms-date"
headerXmsVersion = "x-ms-version"
headerContentEncoding = "Content-Encoding"
headerContentLanguage = "Content-Language"
headerContentType = "Content-Type"
headerContentMD5 = "Content-MD5"
headerIfModifiedSince = "If-Modified-Since"
headerIfMatch = "If-Match"
headerIfNoneMatch = "If-None-Match"
headerIfUnmodifiedSince = "If-Unmodified-Since"
headerRange = "Range"
)
func (c *Client) addAuthorizationHeader(verb, url string, headers map[string]string, auth authentication) (map[string]string, error) {
authHeader, err := c.getSharedKey(verb, url, headers, auth)
if err != nil {
return nil, err
}
headers[headerAuthorization] = authHeader
return headers, nil
}
func (c *Client) getSharedKey(verb, url string, headers map[string]string, auth authentication) (string, error) {
canRes, err := c.buildCanonicalizedResource(url, auth)
if err != nil {
return "", err
}
canString, err := buildCanonicalizedString(verb, headers, canRes, auth)
if err != nil {
return "", err
}
return c.createAuthorizationHeader(canString, auth), nil
}
func (c *Client) buildCanonicalizedResource(uri string, auth authentication) (string, error) {
errMsg := "buildCanonicalizedResource error: %s"
u, err := url.Parse(uri)
if err != nil {
return "", fmt.Errorf(errMsg, err.Error())
}
cr := bytes.NewBufferString("/")
cr.WriteString(c.getCanonicalizedAccountName())
if len(u.Path) > 0 {
// Any portion of the CanonicalizedResource string that is derived from
// the resource's URI should be encoded exactly as it is in the URI.
// -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx
cr.WriteString(u.EscapedPath())
}
params, err := url.ParseQuery(u.RawQuery)
if err != nil {
return "", fmt.Errorf(errMsg, err.Error())
}
// See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277
if auth == sharedKey {
if len(params) > 0 {
cr.WriteString("\n")
keys := []string{}
for key := range params {
keys = append(keys, key)
}
sort.Strings(keys)
completeParams := []string{}
for _, key := range keys {
if len(params[key]) > 1 {
sort.Strings(params[key])
}
completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ",")))
}
cr.WriteString(strings.Join(completeParams, "\n"))
}
} else {
// search for "comp" parameter, if exists then add it to canonicalizedresource
if v, ok := params["comp"]; ok {
cr.WriteString("?comp=" + v[0])
}
}
return string(cr.Bytes()), nil
}
func (c *Client) getCanonicalizedAccountName() string {
// since we may be trying to access a secondary storage account, we need to
// remove the -secondary part of the storage name
return strings.TrimSuffix(c.accountName, "-secondary")
}
func buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string, auth authentication) (string, error) {
contentLength := headers[headerContentLength]
if contentLength == "0" {
contentLength = ""
}
date := headers[headerDate]
if v, ok := headers[headerXmsDate]; ok {
if auth == sharedKey || auth == sharedKeyLite {
date = ""
} else {
date = v
}
}
var canString string
switch auth {
case sharedKey:
canString = strings.Join([]string{
verb,
headers[headerContentEncoding],
headers[headerContentLanguage],
contentLength,
headers[headerContentMD5],
headers[headerContentType],
date,
headers[headerIfModifiedSince],
headers[headerIfMatch],
headers[headerIfNoneMatch],
headers[headerIfUnmodifiedSince],
headers[headerRange],
buildCanonicalizedHeader(headers),
canonicalizedResource,
}, "\n")
case sharedKeyForTable:
canString = strings.Join([]string{
verb,
headers[headerContentMD5],
headers[headerContentType],
date,
canonicalizedResource,
}, "\n")
case sharedKeyLite:
canString = strings.Join([]string{
verb,
headers[headerContentMD5],
headers[headerContentType],
date,
buildCanonicalizedHeader(headers),
canonicalizedResource,
}, "\n")
case sharedKeyLiteForTable:
canString = strings.Join([]string{
date,
canonicalizedResource,
}, "\n")
default:
return "", fmt.Errorf("%s authentication is not supported yet", auth)
}
return canString, nil
}
func buildCanonicalizedHeader(headers map[string]string) string {
cm := make(map[string]string)
for k, v := range headers {
headerName := strings.TrimSpace(strings.ToLower(k))
if strings.HasPrefix(headerName, "x-ms-") {
cm[headerName] = v
}
}
if len(cm) == 0 {
return ""
}
keys := []string{}
for key := range cm {
keys = append(keys, key)
}
sort.Strings(keys)
ch := bytes.NewBufferString("")
for _, key := range keys {
ch.WriteString(key)
ch.WriteRune(':')
ch.WriteString(cm[key])
ch.WriteRune('\n')
}
return strings.TrimSuffix(string(ch.Bytes()), "\n")
}
func (c *Client) createAuthorizationHeader(canonicalizedString string, auth authentication) string {
signature := c.computeHmac256(canonicalizedString)
var key string
switch auth {
case sharedKey, sharedKeyForTable:
key = "SharedKey"
case sharedKeyLite, sharedKeyLiteForTable:
key = "SharedKeyLite"
}
return fmt.Sprintf("%s %s:%s", key, c.getCanonicalizedAccountName(), signature)
}

View File

@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
@ -18,6 +17,7 @@ import (
// Service.
type BlobStorageClient struct {
client Client
auth authentication
}
// A Container is an entry in ContainerListResponse.
@ -123,6 +123,7 @@ type BlobProperties struct {
CopyCompletionTime string `xml:"CopyCompletionTime"`
CopyStatusDescription string `xml:"CopyStatusDescription"`
LeaseStatus string `xml:"LeaseStatus"`
LeaseState string `xml:"LeaseState"`
}
// BlobHeaders contains various properties of a blob and is an entry
@ -260,7 +261,7 @@ const (
// lease constants.
const (
leaseHeaderPrefix = "x-ms-lease-"
leaseID = "x-ms-lease-id"
headerLeaseID = "x-ms-lease-id"
leaseAction = "x-ms-lease-action"
leaseBreakPeriod = "x-ms-lease-break-period"
leaseDuration = "x-ms-lease-duration"
@ -302,15 +303,8 @@ const (
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 {
// ContainerAccessPolicyDetails are used for SETTING container policies
type ContainerAccessPolicyDetails struct {
ID string
StartTime time.Time
ExpiryTime time.Time
@ -321,39 +315,8 @@ type AccessPolicyDetails struct {
// 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
AccessType ContainerAccessType
AccessPolicies []ContainerAccessPolicyDetails
}
// ContainerAccessHeader references header used when setting/getting container ACL
@ -401,7 +364,7 @@ type BlockResponse struct {
Size int64 `xml:"Size"`
}
// GetPageRangesResponse contains the reponse fields from
// GetPageRangesResponse contains the response fields from
// Get Page Ranges call.
//
// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx
@ -434,7 +397,7 @@ func (b BlobStorageClient) ListContainers(params ListContainersParameters) (Cont
headers := b.client.getStandardHeaders()
var out ContainerListResponse
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return out, err
}
@ -471,24 +434,22 @@ func (b BlobStorageClient) CreateContainerIfNotExists(name string, access Contai
}
func (b BlobStorageClient) createContainer(name string, access ContainerAccessType) (*storageResponse, error) {
verb := "PUT"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders()
if access != "" {
headers[ContainerAccessHeader] = string(access)
}
return b.client.exec(verb, uri, headers, nil)
return b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
}
// ContainerExists returns true if a container with given name exists
// on the storage account, otherwise returns false.
func (b BlobStorageClient) ContainerExists(name string) (bool, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders()
resp, err := b.client.exec(verb, uri, headers, nil)
resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound {
@ -499,48 +460,36 @@ func (b BlobStorageClient) ContainerExists(name string) (bool, error) {
}
// 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) {
func (b BlobStorageClient) SetContainerPermissions(container string, containerPermissions ContainerPermissions, timeout int, leaseID string) (err error) {
params := url.Values{
"restype": {"container"},
"comp": {"acl"},
}
if containerPermissions.AccessOptions.Timeout > 0 {
params.Add("timeout", strconv.Itoa(containerPermissions.AccessOptions.Timeout))
if timeout > 0 {
params.Add("timeout", strconv.Itoa(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.AccessType != "" {
headers[ContainerAccessHeader] = string(containerPermissions.AccessType)
}
if containerPermissions.AccessOptions.LeaseID != "" {
headers[leaseID] = containerPermissions.AccessOptions.LeaseID
if leaseID != "" {
headers[headerLeaseID] = 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)
}
body, length, err := generateContainerACLpayload(containerPermissions.AccessPolicies)
headers["Content-Length"] = strconv.Itoa(length)
resp, err := b.client.exec(http.MethodPut, uri, headers, body, b.auth)
if err != nil {
return err
}
if resp != nil {
defer func() {
err = resp.body.Close()
}()
defer resp.body.Close()
if resp.statusCode != http.StatusOK {
return errors.New("Unable to set permissions")
@ -553,7 +502,7 @@ func (b BlobStorageClient) SetContainerPermissions(container string, containerPe
// 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) {
func (b BlobStorageClient) GetContainerPermissions(container string, timeout int, leaseID string) (*ContainerPermissions, error) {
params := url.Values{"restype": {"container"},
"comp": {"acl"}}
@ -565,20 +514,14 @@ func (b BlobStorageClient) GetContainerPermissions(container string, timeout int
headers := b.client.getStandardHeaders()
if leaseID != "" {
headers[leaseID] = leaseID
headers[headerLeaseID] = leaseID
}
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
// containerAccess. Blob, Container, empty
containerAccess := resp.headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader))
defer func() {
err = resp.body.Close()
}()
defer resp.body.Close()
var out AccessPolicy
err = xmlUnmarshal(resp.body, &out.SignedIdentifiersList)
@ -586,11 +529,30 @@ func (b BlobStorageClient) GetContainerPermissions(container string, timeout int
return nil, err
}
permissionResponse = &ContainerAccessResponse{}
permissionResponse.AccessPolicy = out.SignedIdentifiersList
permissionResponse.ContainerAccess = ContainerAccessType(containerAccess)
permissionResponse := updateContainerAccessPolicy(out, &resp.headers)
return &permissionResponse, nil
}
return permissionResponse, nil
func updateContainerAccessPolicy(ap AccessPolicy, headers *http.Header) ContainerPermissions {
// containerAccess. Blob, Container, empty
containerAccess := headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader))
var cp ContainerPermissions
cp.AccessType = ContainerAccessType(containerAccess)
for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers {
capd := ContainerAccessPolicyDetails{
ID: policy.ID,
StartTime: policy.AccessPolicy.StartTime,
ExpiryTime: policy.AccessPolicy.ExpiryTime,
}
capd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r")
capd.CanWrite = updatePermissions(policy.AccessPolicy.Permission, "w")
capd.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d")
cp.AccessPolicies = append(cp.AccessPolicies, capd)
}
return cp
}
// DeleteContainer deletes the container with given name on the storage
@ -624,11 +586,10 @@ func (b BlobStorageClient) DeleteContainerIfExists(name string) (bool, error) {
}
func (b BlobStorageClient) deleteContainer(name string) (*storageResponse, error) {
verb := "DELETE"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders()
return b.client.exec(verb, uri, headers, nil)
return b.client.exec(http.MethodDelete, uri, headers, nil, b.auth)
}
// ListBlobs returns an object that contains list of blobs in the container,
@ -643,7 +604,7 @@ func (b BlobStorageClient) ListBlobs(container string, params ListBlobsParameter
headers := b.client.getStandardHeaders()
var out BlobListResponse
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return out, err
}
@ -656,10 +617,9 @@ func (b BlobStorageClient) ListBlobs(container string, params ListBlobsParameter
// BlobExists returns true if a blob with given name exists on the specified
// container of the storage account.
func (b BlobStorageClient) BlobExists(container, name string) (bool, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders()
resp, err := b.client.exec(verb, uri, headers, nil)
resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound {
@ -713,9 +673,9 @@ func (b BlobStorageClient) GetBlobRange(container, name, bytesRange string, extr
}
func (b BlobStorageClient) getBlobRange(container, name, bytesRange string, extraHeaders map[string]string) (*storageResponse, error) {
verb := "GET"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
if bytesRange != "" {
headers["Range"] = fmt.Sprintf("bytes=%s", bytesRange)
@ -725,19 +685,19 @@ func (b BlobStorageClient) getBlobRange(container, name, bytesRange string, extr
headers[k] = v
}
resp, err := b.client.exec(verb, uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
return resp, err
}
// leasePut is common PUT code for the various aquire/release/break etc functions.
// leasePut is common PUT code for the various acquire/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)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
@ -752,6 +712,7 @@ func (b BlobStorageClient) leaseCommonPut(container string, name string, headers
// 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) {
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
params := url.Values{"comp": {"snapshot"}}
@ -764,7 +725,7 @@ func (b BlobStorageClient) SnapshotBlob(container string, name string, timeout i
}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
@ -805,7 +766,7 @@ func (b BlobStorageClient) AcquireLease(container string, name string, leaseTime
return "", err
}
returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID))
returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
if returnedLeaseID != "" {
return returnedLeaseID, nil
@ -856,7 +817,7 @@ func (b BlobStorageClient) breakLeaseCommon(container string, name string, heade
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[headerLeaseID] = currentLeaseID
headers[leaseProposedID] = proposedLeaseID
respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
@ -864,7 +825,7 @@ func (b BlobStorageClient) ChangeLease(container string, name string, currentLea
return "", err
}
newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID))
newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
if newLeaseID != "" {
return newLeaseID, nil
}
@ -876,7 +837,7 @@ func (b BlobStorageClient) ChangeLease(container string, name string, currentLea
func (b BlobStorageClient) ReleaseLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders()
headers[leaseAction] = releaseLease
headers[leaseID] = currentLeaseID
headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil {
@ -890,7 +851,7 @@ func (b BlobStorageClient) ReleaseLease(container string, name string, currentLe
func (b BlobStorageClient) RenewLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders()
headers[leaseAction] = renewLease
headers[leaseID] = currentLeaseID
headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil {
@ -903,17 +864,16 @@ func (b BlobStorageClient) RenewLease(container string, name string, currentLeas
// GetBlobProperties provides various information about the specified
// blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders()
resp, err := b.client.exec(verb, uri, headers, nil)
resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return nil, err
}
@ -953,6 +913,7 @@ func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobPrope
CopyStatus: resp.headers.Get("x-ms-copy-status"),
BlobType: BlobType(resp.headers.Get("x-ms-blob-type")),
LeaseStatus: resp.headers.Get("x-ms-lease-status"),
LeaseState: resp.headers.Get("x-ms-lease-state"),
}, nil
}
@ -975,7 +936,7 @@ func (b BlobStorageClient) SetBlobProperties(container, name string, blobHeaders
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return err
}
@ -995,6 +956,8 @@ func (b BlobStorageClient) SetBlobProperties(container, name string, blobHeaders
func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[string]string, extraHeaders map[string]string) error {
params := url.Values{"comp": {"metadata"}}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
metadata = b.client.protectUserAgent(metadata)
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
for k, v := range metadata {
headers[userDefinedMetadataHeaderPrefix+k] = v
@ -1004,7 +967,7 @@ func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return err
}
@ -1024,7 +987,7 @@ func (b BlobStorageClient) GetBlobMetadata(container, name string) (map[string]s
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
headers := b.client.getStandardHeaders()
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return nil, err
}
@ -1075,6 +1038,7 @@ func (b BlobStorageClient) CreateBlockBlob(container, name string) error {
func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, size uint64, blob io.Reader, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeBlock)
headers["Content-Length"] = fmt.Sprintf("%d", size)
@ -1083,7 +1047,7 @@ func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, siz
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, blob)
resp, err := b.client.exec(http.MethodPut, uri, headers, blob, b.auth)
if err != nil {
return err
}
@ -1112,6 +1076,7 @@ func (b BlobStorageClient) PutBlock(container, name, blockID string, chunk []byt
// See https://msdn.microsoft.com/en-us/library/azure/dd135726.aspx
func (b BlobStorageClient) PutBlockWithLength(container, name, blockID string, size uint64, blob io.Reader, extraHeaders map[string]string) error {
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{"comp": {"block"}, "blockid": {blockID}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeBlock)
headers["Content-Length"] = fmt.Sprintf("%v", size)
@ -1120,7 +1085,7 @@ func (b BlobStorageClient) PutBlockWithLength(container, name, blockID string, s
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, blob)
resp, err := b.client.exec(http.MethodPut, uri, headers, blob, b.auth)
if err != nil {
return err
}
@ -1139,7 +1104,7 @@ func (b BlobStorageClient) PutBlockList(container, name string, blocks []Block)
headers := b.client.getStandardHeaders()
headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML))
resp, err := b.client.exec("PUT", uri, headers, strings.NewReader(blockListXML))
resp, err := b.client.exec(http.MethodPut, uri, headers, strings.NewReader(blockListXML), b.auth)
if err != nil {
return err
}
@ -1156,7 +1121,7 @@ func (b BlobStorageClient) GetBlockList(container, name string, blockType BlockL
headers := b.client.getStandardHeaders()
var out BlockListResponse
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return out, err
}
@ -1174,6 +1139,7 @@ func (b BlobStorageClient) GetBlockList(container, name string, blockType BlockL
func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypePage)
headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", size)
@ -1182,7 +1148,7 @@ func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extra
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return err
}
@ -1199,6 +1165,7 @@ func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extra
func (b BlobStorageClient) PutPage(container, name string, startByte, endByte int64, writeType PageWriteType, chunk []byte, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"page"}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypePage)
headers["x-ms-page-write"] = string(writeType)
@ -1217,7 +1184,7 @@ func (b BlobStorageClient) PutPage(container, name string, startByte, endByte in
}
headers["Content-Length"] = fmt.Sprintf("%v", contentLength)
resp, err := b.client.exec("PUT", uri, headers, data)
resp, err := b.client.exec(http.MethodPut, uri, headers, data, b.auth)
if err != nil {
return err
}
@ -1235,13 +1202,13 @@ func (b BlobStorageClient) GetPageRanges(container, name string) (GetPageRangesR
headers := b.client.getStandardHeaders()
var out GetPageRangesResponse
resp, err := b.client.exec("GET", uri, headers, nil)
resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
if err != nil {
return out, err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return out, err
}
err = xmlUnmarshal(resp.body, &out)
@ -1255,6 +1222,7 @@ func (b BlobStorageClient) GetPageRanges(container, name string) (GetPageRangesR
func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeAppend)
@ -1262,7 +1230,7 @@ func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders ma
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return err
}
@ -1277,6 +1245,7 @@ func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders ma
func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"appendblock"}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeAppend)
headers["Content-Length"] = fmt.Sprintf("%v", len(chunk))
@ -1285,7 +1254,7 @@ func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, ext
headers[k] = v
}
resp, err := b.client.exec("PUT", uri, headers, bytes.NewReader(chunk))
resp, err := b.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.auth)
if err != nil {
return err
}
@ -1320,7 +1289,7 @@ func (b BlobStorageClient) StartBlobCopy(container, name, sourceBlob string) (st
headers := b.client.getStandardHeaders()
headers["x-ms-copy-source"] = sourceBlob
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return "", err
}
@ -1352,10 +1321,10 @@ func (b BlobStorageClient) AbortBlobCopy(container, name, copyID, currentLeaseID
headers["x-ms-copy-action"] = "abort"
if currentLeaseID != "" {
headers[leaseID] = currentLeaseID
headers[headerLeaseID] = currentLeaseID
}
resp, err := b.client.exec("PUT", uri, headers, nil)
resp, err := b.client.exec(http.MethodPut, uri, headers, nil, b.auth)
if err != nil {
return err
}
@ -1423,14 +1392,14 @@ func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeade
}
func (b BlobStorageClient) deleteBlob(container, name string, extraHeaders map[string]string) (*storageResponse, error) {
verb := "DELETE"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders()
for k, v := range extraHeaders {
headers[k] = v
}
return b.client.exec(verb, uri, headers, nil)
return b.client.exec(http.MethodDelete, uri, headers, nil, b.auth)
}
// helper method to construct the path to a container given its name
@ -1445,7 +1414,7 @@ func pathForBlob(container, name string) string {
}
// GetBlobSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared
// Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed procotols.
// Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed protocols.
// 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.
//
@ -1455,7 +1424,7 @@ func (b BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol(container, name
signedPermissions = permissions
blobURL = b.GetBlobURL(container, name)
)
canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL)
canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL, b.auth)
if err != nil {
return "", err
}
@ -1537,60 +1506,34 @@ func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, sig
return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15")
}
func generatePermissions(accessPolicy AccessPolicyDetails) (permissions string) {
func generateContainerACLpayload(policies []ContainerAccessPolicyDetails) (io.Reader, int, error) {
sil := SignedIdentifiers{
SignedIdentifiers: []SignedIdentifier{},
}
for _, capd := range policies {
permission := capd.generateContainerPermissions()
signedIdentifier := convertAccessPolicyToXMLStructs(capd.ID, capd.StartTime, capd.ExpiryTime, permission)
sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier)
}
return xmlMarshal(sil)
}
func (capd *ContainerAccessPolicyDetails) generateContainerPermissions() (permissions string) {
// generate the permissions string (rwd).
// still want the end user API to have bool flags.
permissions = ""
if accessPolicy.CanRead {
if capd.CanRead {
permissions += "r"
}
if accessPolicy.CanWrite {
if capd.CanWrite {
permissions += "w"
}
if accessPolicy.CanDelete {
if capd.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

@ -12,8 +12,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"regexp"
"sort"
"runtime"
"strconv"
"strings"
)
@ -43,6 +42,8 @@ const (
storageEmulatorBlob = "127.0.0.1:10000"
storageEmulatorTable = "127.0.0.1:10002"
storageEmulatorQueue = "127.0.0.1:10001"
userAgentHeader = "User-Agent"
)
// Client is the object that needs to be constructed to perform
@ -52,11 +53,13 @@ type Client struct {
// requests. If it is nil, http.DefaultClient is used.
HTTPClient *http.Client
accountName string
accountKey []byte
useHTTPS bool
baseURL string
apiVersion string
accountName string
accountKey []byte
useHTTPS bool
UseSharedKeyLite bool
baseURL string
apiVersion string
userAgent string
}
type storageResponse struct {
@ -155,13 +158,46 @@ func NewClient(accountName, accountKey, blobServiceBaseURL, apiVersion string, u
return c, fmt.Errorf("azure: malformed storage account key: %v", err)
}
return Client{
accountName: accountName,
accountKey: key,
useHTTPS: useHTTPS,
baseURL: blobServiceBaseURL,
apiVersion: apiVersion,
}, nil
c = Client{
accountName: accountName,
accountKey: key,
useHTTPS: useHTTPS,
baseURL: blobServiceBaseURL,
apiVersion: apiVersion,
UseSharedKeyLite: false,
}
c.userAgent = c.getDefaultUserAgent()
return c, nil
}
func (c Client) getDefaultUserAgent() string {
return fmt.Sprintf("Go/%s (%s-%s) Azure-SDK-For-Go/%s storage-dataplane/%s",
runtime.Version(),
runtime.GOARCH,
runtime.GOOS,
sdkVersion,
c.apiVersion,
)
}
// AddToUserAgent adds an extension to the current user agent
func (c *Client) AddToUserAgent(extension string) error {
if extension != "" {
c.userAgent = fmt.Sprintf("%s %s", c.userAgent, extension)
return nil
}
return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.userAgent)
}
// protectUserAgent is used in funcs that include extraheaders as a parameter.
// It prevents the User-Agent header to be overwritten, instead if it happens to
// be present, it gets added to the current User-Agent. Use it before getStandardHeaders
func (c *Client) protectUserAgent(extraheaders map[string]string) map[string]string {
if v, ok := extraheaders[userAgentHeader]; ok {
c.AddToUserAgent(v)
delete(extraheaders, userAgentHeader)
}
return extraheaders
}
func (c Client) getBaseURL(service string) string {
@ -213,181 +249,69 @@ func (c Client) getEndpoint(service, path string, params url.Values) string {
// GetBlobService returns a BlobStorageClient which can operate on the blob
// service of the storage account.
func (c Client) GetBlobService() BlobStorageClient {
return BlobStorageClient{c}
b := BlobStorageClient{
client: c,
}
b.client.AddToUserAgent(blobServiceName)
b.auth = sharedKey
if c.UseSharedKeyLite {
b.auth = sharedKeyLite
}
return b
}
// GetQueueService returns a QueueServiceClient which can operate on the queue
// service of the storage account.
func (c Client) GetQueueService() QueueServiceClient {
return QueueServiceClient{c}
q := QueueServiceClient{
client: c,
}
q.client.AddToUserAgent(queueServiceName)
q.auth = sharedKey
if c.UseSharedKeyLite {
q.auth = sharedKeyLite
}
return q
}
// GetTableService returns a TableServiceClient which can operate on the table
// service of the storage account.
func (c Client) GetTableService() TableServiceClient {
return TableServiceClient{c}
t := TableServiceClient{
client: c,
}
t.client.AddToUserAgent(tableServiceName)
t.auth = sharedKeyForTable
if c.UseSharedKeyLite {
t.auth = sharedKeyLiteForTable
}
return t
}
// GetFileService returns a FileServiceClient which can operate on the file
// service of the storage account.
func (c Client) GetFileService() FileServiceClient {
return FileServiceClient{c}
}
func (c Client) createAuthorizationHeader(canonicalizedString string) string {
signature := c.computeHmac256(canonicalizedString)
return fmt.Sprintf("%s %s:%s", "SharedKey", c.getCanonicalizedAccountName(), signature)
}
func (c Client) getAuthorizationHeader(verb, url string, headers map[string]string) (string, error) {
canonicalizedResource, err := c.buildCanonicalizedResource(url)
if err != nil {
return "", err
f := FileServiceClient{
client: c,
}
canonicalizedString := c.buildCanonicalizedString(verb, headers, canonicalizedResource)
return c.createAuthorizationHeader(canonicalizedString), nil
f.client.AddToUserAgent(fileServiceName)
f.auth = sharedKey
if c.UseSharedKeyLite {
f.auth = sharedKeyLite
}
return f
}
func (c Client) getStandardHeaders() map[string]string {
return map[string]string{
"x-ms-version": c.apiVersion,
"x-ms-date": currentTimeRfc1123Formatted(),
userAgentHeader: c.userAgent,
"x-ms-version": c.apiVersion,
"x-ms-date": currentTimeRfc1123Formatted(),
}
}
func (c Client) getCanonicalizedAccountName() string {
// since we may be trying to access a secondary storage account, we need to
// remove the -secondary part of the storage name
return strings.TrimSuffix(c.accountName, "-secondary")
}
func (c Client) buildCanonicalizedHeader(headers map[string]string) string {
cm := make(map[string]string)
for k, v := range headers {
headerName := strings.TrimSpace(strings.ToLower(k))
match, _ := regexp.MatchString("x-ms-", headerName)
if match {
cm[headerName] = v
}
}
if len(cm) == 0 {
return ""
}
keys := make([]string, 0, len(cm))
for key := range cm {
keys = append(keys, key)
}
sort.Strings(keys)
ch := ""
for i, key := range keys {
if i == len(keys)-1 {
ch += fmt.Sprintf("%s:%s", key, cm[key])
} else {
ch += fmt.Sprintf("%s:%s\n", key, cm[key])
}
}
return ch
}
func (c Client) buildCanonicalizedResourceTable(uri string) (string, error) {
errMsg := "buildCanonicalizedResourceTable error: %s"
u, err := url.Parse(uri)
if err != nil {
return "", fmt.Errorf(errMsg, err.Error())
}
cr := "/" + c.getCanonicalizedAccountName()
if len(u.Path) > 0 {
cr += u.EscapedPath()
}
return cr, nil
}
func (c Client) buildCanonicalizedResource(uri string) (string, error) {
errMsg := "buildCanonicalizedResource error: %s"
u, err := url.Parse(uri)
if err != nil {
return "", fmt.Errorf(errMsg, err.Error())
}
cr := "/" + c.getCanonicalizedAccountName()
if len(u.Path) > 0 {
// Any portion of the CanonicalizedResource string that is derived from
// the resource's URI should be encoded exactly as it is in the URI.
// -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx
cr += u.EscapedPath()
}
params, err := url.ParseQuery(u.RawQuery)
if err != nil {
return "", fmt.Errorf(errMsg, err.Error())
}
if len(params) > 0 {
cr += "\n"
keys := make([]string, 0, len(params))
for key := range params {
keys = append(keys, key)
}
sort.Strings(keys)
for i, key := range keys {
if len(params[key]) > 1 {
sort.Strings(params[key])
}
if i == len(keys)-1 {
cr += fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))
} else {
cr += fmt.Sprintf("%s:%s\n", key, strings.Join(params[key], ","))
}
}
}
return cr, nil
}
func (c Client) buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string) string {
contentLength := headers["Content-Length"]
if contentLength == "0" {
contentLength = ""
}
canonicalizedString := 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\n%s",
verb,
headers["Content-Encoding"],
headers["Content-Language"],
contentLength,
headers["Content-MD5"],
headers["Content-Type"],
headers["Date"],
headers["If-Modified-Since"],
headers["If-Match"],
headers["If-None-Match"],
headers["If-Unmodified-Since"],
headers["Range"],
c.buildCanonicalizedHeader(headers),
canonicalizedResource)
return canonicalizedString
}
func (c Client) exec(verb, url string, headers map[string]string, body io.Reader) (*storageResponse, error) {
authHeader, err := c.getAuthorizationHeader(verb, url, headers)
if err != nil {
return nil, err
}
headers["Authorization"] = authHeader
func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) {
headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
if err != nil {
return nil, err
}
@ -428,12 +352,13 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
return nil, err
}
requestID := resp.Header.Get("x-ms-request-id")
if len(respBody) == 0 {
// no error in response body
err = fmt.Errorf("storage: service returned without a response body (%s)", resp.Status)
// no error in response body, might happen in HEAD requests
err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID)
} else {
// response contains storage service error object, unmarshal
storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, resp.Header.Get("x-ms-request-id"))
storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, requestID)
if err != nil { // error unmarshaling the error response
err = errIn
}
@ -452,7 +377,12 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
body: resp.Body}, nil
}
func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader) (*odataResponse, error) {
func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) {
headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
if err != nil {
return nil, err
}
req, err := http.NewRequest(verb, url, body)
for k, v := range headers {
req.Header.Add(k, v)
@ -482,8 +412,8 @@ func (c Client) execInternalJSON(verb, url string, headers map[string]string, bo
}
if len(respBody) == 0 {
// no error in response body
err = fmt.Errorf("storage: service returned without a response body (%d)", resp.StatusCode)
// no error in response body, might happen in HEAD requests
err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, resp.Header.Get("x-ms-request-id"))
return respToRet, err
}
// try unmarshal as odata.error json
@ -494,28 +424,6 @@ func (c Client) execInternalJSON(verb, url string, headers map[string]string, bo
return respToRet, nil
}
func (c Client) createSharedKeyLite(url string, headers map[string]string) (string, error) {
can, err := c.buildCanonicalizedResourceTable(url)
if err != nil {
return "", err
}
strToSign := headers["x-ms-date"] + "\n" + can
hmac := c.computeHmac256(strToSign)
return fmt.Sprintf("SharedKeyLite %s:%s", c.accountName, hmac), nil
}
func (c Client) execTable(verb, url string, headers map[string]string, body io.Reader) (*odataResponse, error) {
var err error
headers["Authorization"], err = c.createSharedKeyLite(url, headers)
if err != nil {
return nil, err
}
return c.execInternalJSON(verb, url, headers, body)
}
func readResponseBody(resp *http.Response) ([]byte, error) {
defer resp.Body.Close()
out, err := ioutil.ReadAll(resp.Body)
@ -535,6 +443,15 @@ func serviceErrFromXML(body []byte, statusCode int, requestID string) (AzureStor
return storageErr, nil
}
func serviceErrFromStatusCode(code int, status string, requestID string) AzureStorageServiceError {
return AzureStorageServiceError{
StatusCode: code,
Code: status,
RequestID: requestID,
Message: "no response body was available for error status code",
}
}
func (e AzureStorageServiceError) Error() string {
return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestId=%s, QueryParameterName=%s, QueryParameterValue=%s",
e.StatusCode, e.Code, e.Message, e.RequestID, e.QueryParameterName, e.QueryParameterValue)

View File

@ -0,0 +1,217 @@
package storage
import (
"encoding/xml"
"net/http"
"net/url"
)
// Directory represents a directory on a share.
type Directory struct {
fsc *FileServiceClient
Metadata map[string]string
Name string `xml:"Name"`
parent *Directory
Properties DirectoryProperties
share *Share
}
// DirectoryProperties contains various properties of a directory.
type DirectoryProperties struct {
LastModified string `xml:"Last-Modified"`
Etag string `xml:"Etag"`
}
// 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
}
// 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"`
}
// builds the complete directory path for this directory object.
func (d *Directory) buildPath() string {
path := ""
current := d
for current.Name != "" {
path = "/" + current.Name + path
current = current.parent
}
return d.share.buildPath() + path
}
// Create this directory in the associated 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 (d *Directory) Create() error {
// if this is the root directory exit early
if d.parent == nil {
return nil
}
headers, err := d.fsc.createResource(d.buildPath(), resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil))
if err != nil {
return err
}
d.updateEtagAndLastModified(headers)
return nil
}
// CreateIfNotExists creates this directory under the associated share if the
// directory does not exists. Returns true if the directory is newly created or
// false if the directory already exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166993.aspx
func (d *Directory) CreateIfNotExists() (bool, error) {
// if this is the root directory exit early
if d.parent == nil {
return false, nil
}
resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, nil)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict {
if resp.statusCode == http.StatusCreated {
d.updateEtagAndLastModified(resp.headers)
return true, nil
}
return false, d.FetchAttributes()
}
}
return false, err
}
// Delete removes this directory. It must be empty in order to be deleted.
// If the directory does not exist the operation fails.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166969.aspx
func (d *Directory) Delete() error {
return d.fsc.deleteResource(d.buildPath(), resourceDirectory)
}
// DeleteIfExists removes this directory if it exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166969.aspx
func (d *Directory) DeleteIfExists() (bool, error) {
resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil
}
}
return false, err
}
// Exists returns true if this directory exists.
func (d *Directory) Exists() (bool, error) {
exists, headers, err := d.fsc.resourceExists(d.buildPath(), resourceDirectory)
if exists {
d.updateEtagAndLastModified(headers)
}
return exists, err
}
// FetchAttributes retrieves metadata for this directory.
func (d *Directory) FetchAttributes() error {
headers, err := d.fsc.getResourceHeaders(d.buildPath(), compNone, resourceDirectory, http.MethodHead)
if err != nil {
return err
}
d.updateEtagAndLastModified(headers)
d.Metadata = getMetadataFromHeaders(headers)
return nil
}
// GetDirectoryReference returns a child Directory object for this directory.
func (d *Directory) GetDirectoryReference(name string) *Directory {
return &Directory{
fsc: d.fsc,
Name: name,
parent: d,
share: d.share,
}
}
// GetFileReference returns a child File object for this directory.
func (d *Directory) GetFileReference(name string) *File {
return &File{
fsc: d.fsc,
Name: name,
parent: d,
share: d.share,
}
}
// ListDirsAndFiles returns a list of files and directories under this directory.
// It also contains a pagination token and other response details.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn166980.aspx
func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error) {
q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory))
resp, err := d.fsc.listContent(d.buildPath(), q, nil)
if err != nil {
return nil, err
}
defer resp.body.Close()
var out DirsAndFilesListResponse
err = xmlUnmarshal(resp.body, &out)
return &out, err
}
// SetMetadata replaces the metadata for this 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 (d *Directory) SetMetadata() error {
headers, err := d.fsc.setResourceHeaders(d.buildPath(), compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil))
if err != nil {
return err
}
d.updateEtagAndLastModified(headers)
return nil
}
// updates Etag and last modified date
func (d *Directory) updateEtagAndLastModified(headers http.Header) {
d.Properties.Etag = headers.Get("Etag")
d.Properties.LastModified = headers.Get("Last-Modified")
}
// URL gets the canonical URL to this directory.
// This method does not create a publicly accessible URL if the directory
// is private and this method does not check if the directory exists.
func (d *Directory) URL() string {
return d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{})
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,360 @@
package storage
import (
"encoding/xml"
"fmt"
"net/http"
"net/url"
"strings"
)
// FileServiceClient contains operations for Microsoft Azure File Service.
type FileServiceClient struct {
client Client
auth authentication
}
// 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
}
// ShareListResponse contains the response fields from
// ListShares call.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn167009.aspx
type ShareListResponse struct {
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"`
}
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
}
// 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
}
// GetShareReference returns a Share object for the specified share name.
func (f FileServiceClient) GetShareReference(name string) Share {
return Share{
fsc: &f,
Name: name,
Properties: ShareProperties{
Quota: -1,
},
}
}
// 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 nil, err
}
defer resp.body.Close()
err = xmlUnmarshal(resp.body, &out)
// assign our client to the newly created Share objects
for i := range out.Shares {
out.Shares[i].fsc = &f
}
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)
extraHeaders = f.client.protectUserAgent(extraHeaders)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
resp, err := f.client.exec(http.MethodGet, uri, headers, nil, f.auth)
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
}
// returns true if the specified resource exists
func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, http.Header, error) {
if err := f.checkForStorageEmulator(); err != nil {
return false, nil, err
}
uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res))
headers := f.client.getStandardHeaders()
resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound {
return resp.statusCode == http.StatusOK, resp.headers, nil
}
}
return false, nil, err
}
// creates a resource depending on the specified resource type
func (f FileServiceClient) createResource(path string, res resourceType, extraHeaders map[string]string) (http.Header, error) {
resp, err := f.createResourceNoClose(path, res, extraHeaders)
if err != nil {
return nil, err
}
defer resp.body.Close()
return resp.headers, 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 {
return nil, err
}
values := getURLInitValues(compNone, res)
uri := f.client.getEndpoint(fileServiceName, path, values)
extraHeaders = f.client.protectUserAgent(extraHeaders)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
return f.client.exec(http.MethodPut, uri, headers, nil, f.auth)
}
// 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)
extraHeaders = f.client.protectUserAgent(extraHeaders)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
return f.client.exec(verb, uri, headers, nil, f.auth)
}
// deletes the resource and returns the response
func (f FileServiceClient) deleteResource(path string, res resourceType) 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 {
return nil, err
}
values := getURLInitValues(compNone, res)
uri := f.client.getEndpoint(fileServiceName, path, values)
return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil, f.auth)
}
// 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) (http.Header, error) {
if err := f.checkForStorageEmulator(); err != nil {
return nil, err
}
params := getURLInitValues(comp, res)
uri := f.client.getEndpoint(fileServiceName, path, params)
extraHeaders = f.client.protectUserAgent(extraHeaders)
headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
resp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth)
if err != nil {
return nil, err
}
defer resp.body.Close()
return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusOK})
}
// 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 getMetadataFromHeaders(headers), nil
}
// returns a map of custom metadata values from the specified HTTP header
func getMetadataFromHeaders(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]
}
if len(metadata) == 0 {
return nil
}
return metadata
}
//checkForStorageEmulator determines if the client is setup for use with
//Azure Storage Emulator, and returns a relevant error
func (f FileServiceClient) checkForStorageEmulator() error {
if f.client.accountName == StorageEmulatorAccountName {
return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator")
}
return nil
}

View File

@ -19,6 +19,7 @@ const (
// Service.
type QueueServiceClient struct {
client Client
auth authentication
}
func pathForQueue(queue string) string { return fmt.Sprintf("/%s", queue) }
@ -151,12 +152,13 @@ type QueueMetadataResponse struct {
// See https://msdn.microsoft.com/en-us/library/azure/dd179348.aspx
func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
metadata = c.client.protectUserAgent(metadata)
headers := c.client.getStandardHeaders()
for k, v := range metadata {
headers[userDefinedMetadataHeaderPrefix+k] = v
}
resp, err := c.client.exec("PUT", uri, headers, nil)
resp, err := c.client.exec(http.MethodPut, uri, headers, nil, c.auth)
if err != nil {
return err
}
@ -179,7 +181,7 @@ func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, err
qm.UserDefinedMetadata = make(map[string]string)
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
headers := c.client.getStandardHeaders()
resp, err := c.client.exec("GET", uri, headers, nil)
resp, err := c.client.exec(http.MethodGet, uri, headers, nil, c.auth)
if err != nil {
return qm, err
}
@ -212,7 +214,7 @@ func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, err
func (c QueueServiceClient) CreateQueue(name string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{})
headers := c.client.getStandardHeaders()
resp, err := c.client.exec("PUT", uri, headers, nil)
resp, err := c.client.exec(http.MethodPut, uri, headers, nil, c.auth)
if err != nil {
return err
}
@ -225,7 +227,7 @@ func (c QueueServiceClient) CreateQueue(name string) error {
// See https://msdn.microsoft.com/en-us/library/azure/dd179436.aspx
func (c QueueServiceClient) DeleteQueue(name string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{})
resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth)
if err != nil {
return err
}
@ -236,7 +238,7 @@ func (c QueueServiceClient) DeleteQueue(name string) error {
// QueueExists returns true if a queue with given name exists.
func (c QueueServiceClient) QueueExists(name string) (bool, error) {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": {"metadata"}})
resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth)
if resp != nil && (resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound) {
return resp.statusCode == http.StatusOK, nil
}
@ -256,7 +258,7 @@ func (c QueueServiceClient) PutMessage(queue string, message string, params PutM
}
headers := c.client.getStandardHeaders()
headers["Content-Length"] = strconv.Itoa(nn)
resp, err := c.client.exec("POST", uri, headers, body)
resp, err := c.client.exec(http.MethodPost, uri, headers, body, c.auth)
if err != nil {
return err
}
@ -269,7 +271,7 @@ func (c QueueServiceClient) PutMessage(queue string, message string, params PutM
// See https://msdn.microsoft.com/en-us/library/azure/dd179454.aspx
func (c QueueServiceClient) ClearMessages(queue string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), url.Values{})
resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth)
if err != nil {
return err
}
@ -284,7 +286,7 @@ func (c QueueServiceClient) ClearMessages(queue string) error {
func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParameters) (GetMessagesResponse, error) {
var r GetMessagesResponse
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters())
resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth)
if err != nil {
return r, err
}
@ -300,7 +302,7 @@ func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParamete
func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParameters) (PeekMessagesResponse, error) {
var r PeekMessagesResponse
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters())
resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodGet, uri, c.client.getStandardHeaders(), nil, c.auth)
if err != nil {
return r, err
}
@ -315,7 +317,7 @@ func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParame
func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error {
uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), url.Values{
"popreceipt": {popReceipt}})
resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
resp, err := c.client.exec(http.MethodDelete, uri, c.client.getStandardHeaders(), nil, c.auth)
if err != nil {
return err
}
@ -335,7 +337,7 @@ func (c QueueServiceClient) UpdateMessage(queue string, messageID string, messag
}
headers := c.client.getStandardHeaders()
headers["Content-Length"] = fmt.Sprintf("%d", nn)
resp, err := c.client.exec("PUT", uri, headers, body)
resp, err := c.client.exec(http.MethodPut, uri, headers, body, c.auth)
if err != nil {
return err
}

View File

@ -0,0 +1,186 @@
package storage
import (
"fmt"
"net/http"
"net/url"
"strconv"
)
// Share represents an Azure file share.
type Share struct {
fsc *FileServiceClient
Name string `xml:"Name"`
Properties ShareProperties `xml:"Properties"`
Metadata map[string]string
}
// ShareProperties contains various properties of a share.
type ShareProperties struct {
LastModified string `xml:"Last-Modified"`
Etag string `xml:"Etag"`
Quota int `xml:"Quota"`
}
// builds the complete path for this share object.
func (s *Share) buildPath() string {
return fmt.Sprintf("/%s", s.Name)
}
// Create this share under the associated account.
// If a share with the same name already exists, the operation fails.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
func (s *Share) Create() error {
headers, err := s.fsc.createResource(s.buildPath(), resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil))
if err != nil {
return err
}
s.updateEtagAndLastModified(headers)
return nil
}
// CreateIfNotExists creates this share under the associated account if
// it does not exist. Returns true if the share is newly created or false if
// the share already exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
func (s *Share) CreateIfNotExists() (bool, error) {
resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, nil)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict {
if resp.statusCode == http.StatusCreated {
s.updateEtagAndLastModified(resp.headers)
return true, nil
}
return false, s.FetchAttributes()
}
}
return false, err
}
// Delete marks this share for deletion. The share along with any files
// and directories contained within it are later deleted during garbage
// collection. If the share does not exist the operation fails
//
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
func (s *Share) Delete() error {
return s.fsc.deleteResource(s.buildPath(), resourceShare)
}
// DeleteIfExists operation marks this share for deletion if it exists.
//
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
func (s *Share) DeleteIfExists() (bool, error) {
resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare)
if resp != nil {
defer resp.body.Close()
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil
}
}
return false, err
}
// Exists returns true if this share already exists
// on the storage account, otherwise returns false.
func (s *Share) Exists() (bool, error) {
exists, headers, err := s.fsc.resourceExists(s.buildPath(), resourceShare)
if exists {
s.updateEtagAndLastModified(headers)
s.updateQuota(headers)
}
return exists, err
}
// FetchAttributes retrieves metadata and properties for this share.
func (s *Share) FetchAttributes() error {
headers, err := s.fsc.getResourceHeaders(s.buildPath(), compNone, resourceShare, http.MethodHead)
if err != nil {
return err
}
s.updateEtagAndLastModified(headers)
s.updateQuota(headers)
s.Metadata = getMetadataFromHeaders(headers)
return nil
}
// GetRootDirectoryReference returns a Directory object at the root of this share.
func (s *Share) GetRootDirectoryReference() *Directory {
return &Directory{
fsc: s.fsc,
share: s,
}
}
// ServiceClient returns the FileServiceClient associated with this share.
func (s *Share) ServiceClient() *FileServiceClient {
return s.fsc
}
// SetMetadata replaces the metadata for this 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 (s *Share) SetMetadata() error {
headers, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil))
if err != nil {
return err
}
s.updateEtagAndLastModified(headers)
return nil
}
// SetProperties sets system properties for this share.
//
// 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 (s *Share) SetProperties() error {
if s.Properties.Quota < 1 || s.Properties.Quota > 5120 {
return fmt.Errorf("invalid value %v for quota, valid values are [1, 5120]", s.Properties.Quota)
}
headers, err := s.fsc.setResourceHeaders(s.buildPath(), compProperties, resourceShare, map[string]string{
"x-ms-share-quota": strconv.Itoa(s.Properties.Quota),
})
if err != nil {
return err
}
s.updateEtagAndLastModified(headers)
return nil
}
// updates Etag and last modified date
func (s *Share) updateEtagAndLastModified(headers http.Header) {
s.Properties.Etag = headers.Get("Etag")
s.Properties.LastModified = headers.Get("Last-Modified")
}
// updates quota value
func (s *Share) updateQuota(headers http.Header) {
quota, err := strconv.Atoi(headers.Get("x-ms-share-quota"))
if err == nil {
s.Properties.Quota = quota
}
}
// URL gets the canonical URL to this share. This method does not create a publicly accessible
// URL if the share is private and this method does not check if the share exists.
func (s *Share) URL() string {
return s.fsc.client.getEndpoint(fileServiceName, s.buildPath(), url.Values{})
}

View File

@ -0,0 +1,47 @@
package storage
import (
"strings"
"time"
)
// 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"`
}
// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the
// AccessPolicy struct which will get converted to XML.
func convertAccessPolicyToXMLStructs(id string, startTime time.Time, expiryTime time.Time, permissions string) SignedIdentifier {
return SignedIdentifier{
ID: id,
AccessPolicy: AccessPolicyDetailsXML{
StartTime: startTime.UTC().Round(time.Second),
ExpiryTime: expiryTime.UTC().Round(time.Second),
Permission: permissions,
},
}
}
func updatePermissions(permissions, permission string) bool {
return strings.Contains(permissions, permission)
}

View File

@ -4,14 +4,18 @@ import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"time"
)
// TableServiceClient contains operations for Microsoft Azure Table Storage
// Service.
type TableServiceClient struct {
client Client
auth authentication
}
// AzureTable is the typedef of the Azure Table name
@ -25,6 +29,17 @@ type createTableRequest struct {
TableName string `json:"TableName"`
}
// TableAccessPolicy are used for SETTING table policies
type TableAccessPolicy struct {
ID string
StartTime time.Time
ExpiryTime time.Time
CanRead bool
CanAppend bool
CanUpdate bool
CanDelete bool
}
func pathForTable(table AzureTable) string { return fmt.Sprintf("%s", table) }
func (c *TableServiceClient) getStandardHeaders() map[string]string {
@ -34,6 +49,7 @@ func (c *TableServiceClient) getStandardHeaders() map[string]string {
"Accept": "application/json;odata=nometadata",
"Accept-Charset": "UTF-8",
"Content-Type": "application/json",
userAgentHeader: c.client.userAgent,
}
}
@ -45,7 +61,7 @@ func (c *TableServiceClient) QueryTables() ([]AzureTable, error) {
headers := c.getStandardHeaders()
headers["Content-Length"] = "0"
resp, err := c.client.execTable("GET", uri, headers, nil)
resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth)
if err != nil {
return nil, err
}
@ -56,7 +72,9 @@ func (c *TableServiceClient) QueryTables() ([]AzureTable, error) {
}
buf := new(bytes.Buffer)
buf.ReadFrom(resp.body)
if _, err := buf.ReadFrom(resp.body); err != nil {
return nil, err
}
var respArray queryTablesResponse
if err := json.Unmarshal(buf.Bytes(), &respArray); err != nil {
@ -88,7 +106,7 @@ func (c *TableServiceClient) CreateTable(table AzureTable) error {
headers["Content-Length"] = fmt.Sprintf("%d", buf.Len())
resp, err := c.client.execTable("POST", uri, headers, buf)
resp, err := c.client.execInternalJSON(http.MethodPost, uri, headers, buf, c.auth)
if err != nil {
return err
@ -114,7 +132,7 @@ func (c *TableServiceClient) DeleteTable(table AzureTable) error {
headers["Content-Length"] = "0"
resp, err := c.client.execTable("DELETE", uri, headers, nil)
resp, err := c.client.execInternalJSON(http.MethodDelete, uri, headers, nil, c.auth)
if err != nil {
return err
@ -127,3 +145,114 @@ func (c *TableServiceClient) DeleteTable(table AzureTable) error {
}
return nil
}
// SetTablePermissions sets up table ACL permissions as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Table-ACL
func (c *TableServiceClient) SetTablePermissions(table AzureTable, policies []TableAccessPolicy, timeout uint) (err error) {
params := url.Values{"comp": {"acl"}}
if timeout > 0 {
params.Add("timeout", fmt.Sprint(timeout))
}
uri := c.client.getEndpoint(tableServiceName, string(table), params)
headers := c.client.getStandardHeaders()
body, length, err := generateTableACLPayload(policies)
if err != nil {
return err
}
headers["Content-Length"] = fmt.Sprintf("%v", length)
resp, err := c.client.execInternalJSON(http.MethodPut, uri, headers, body, c.auth)
if err != nil {
return err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil {
return err
}
return nil
}
func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) {
sil := SignedIdentifiers{
SignedIdentifiers: []SignedIdentifier{},
}
for _, tap := range policies {
permission := generateTablePermissions(&tap)
signedIdentifier := convertAccessPolicyToXMLStructs(tap.ID, tap.StartTime, tap.ExpiryTime, permission)
sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier)
}
return xmlMarshal(sil)
}
// GetTablePermissions gets the table ACL permissions, as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-acl
func (c *TableServiceClient) GetTablePermissions(table AzureTable, timeout int) (permissionResponse []TableAccessPolicy, err error) {
params := url.Values{"comp": {"acl"}}
if timeout > 0 {
params.Add("timeout", strconv.Itoa(timeout))
}
uri := c.client.getEndpoint(tableServiceName, string(table), params)
headers := c.client.getStandardHeaders()
resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth)
if err != nil {
return nil, err
}
defer resp.body.Close()
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return nil, err
}
var ap AccessPolicy
err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList)
if err != nil {
return nil, err
}
out := updateTableAccessPolicy(ap)
return out, nil
}
func updateTableAccessPolicy(ap AccessPolicy) []TableAccessPolicy {
out := []TableAccessPolicy{}
for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers {
tap := TableAccessPolicy{
ID: policy.ID,
StartTime: policy.AccessPolicy.StartTime,
ExpiryTime: policy.AccessPolicy.ExpiryTime,
}
tap.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r")
tap.CanAppend = updatePermissions(policy.AccessPolicy.Permission, "a")
tap.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u")
tap.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d")
out = append(out, tap)
}
return out
}
func generateTablePermissions(tap *TableAccessPolicy) (permissions string) {
// generate the permissions string (raud).
// still want the end user API to have bool flags.
permissions = ""
if tap.CanRead {
permissions += "r"
}
if tap.CanAppend {
permissions += "a"
}
if tap.CanUpdate {
permissions += "u"
}
if tap.CanDelete {
permissions += "d"
}
return permissions
}

View File

@ -98,7 +98,7 @@ func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousCo
headers["Content-Length"] = "0"
resp, err := c.client.execTable("GET", uri, headers, nil)
resp, err := c.client.execInternalJSON(http.MethodGet, uri, headers, nil, c.auth)
if err != nil {
return nil, nil, err
@ -106,12 +106,9 @@ func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousCo
contToken := extractContinuationTokenFromHeaders(resp.headers)
if err != nil {
return nil, contToken, err
}
defer resp.body.Close()
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return nil, contToken, err
}
@ -127,13 +124,11 @@ func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousCo
// The function fails if there is an entity with the same
// PartitionKey and RowKey in the table.
func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, false, "POST"); err != nil {
if sc, err := c.execTable(table, entity, false, http.MethodPost); err != nil {
return checkRespCode(sc, []int{http.StatusCreated})
}
return err
return nil
}
func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, specifyKeysInURL bool, method string) (int, error) {
@ -152,10 +147,7 @@ func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, spe
headers["Content-Length"] = fmt.Sprintf("%d", buf.Len())
var err error
var resp *odataResponse
resp, err = c.client.execTable(method, uri, headers, &buf)
resp, err := c.client.execInternalJSON(method, uri, headers, &buf, c.auth)
if err != nil {
return 0, err
@ -170,12 +162,10 @@ func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, spe
// one passed as parameter. The function fails if there is no entity
// with the same PartitionKey and RowKey in the table.
func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
if sc, err := c.execTable(table, entity, true, http.MethodPut); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent})
}
return err
return nil
}
// MergeEntity merges the contents of an entity with the
@ -183,12 +173,10 @@ func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity)
// The function fails if there is no entity
// with the same PartitionKey and RowKey in the table.
func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent})
}
return err
return nil
}
// DeleteEntityWithoutCheck deletes the entity matching by
@ -214,7 +202,7 @@ func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity,
headers["Content-Length"] = "0"
headers["If-Match"] = ifMatch
resp, err := c.client.execTable("DELETE", uri, headers, nil)
resp, err := c.client.execInternalJSON(http.MethodDelete, uri, headers, nil, c.auth)
if err != nil {
return err
@ -231,23 +219,19 @@ func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity,
// InsertOrReplaceEntity inserts an entity in the specified table
// or replaced the existing one.
func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
if sc, err := c.execTable(table, entity, true, http.MethodPut); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent})
}
return err
return nil
}
// InsertOrMergeEntity inserts an entity in the specified table
// or merges the existing one.
func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent})
}
return err
return nil
}
func injectPartitionAndRowKeys(entity TableEntity, buf *bytes.Buffer) error {
@ -340,8 +324,12 @@ func deserializeEntity(retType reflect.Type, reader io.Reader) ([]TableEntity, e
}
// Reset PartitionKey and RowKey
tEntries[i].SetPartitionKey(pKey)
tEntries[i].SetRowKey(rKey)
if err := tEntries[i].SetPartitionKey(pKey); err != nil {
return nil, err
}
if err := tEntries[i].SetRowKey(rKey); err != nil {
return nil, err
}
}
return tEntries, nil

View File

@ -0,0 +1,5 @@
package storage
var (
sdkVersion = "8.0.0-beta"
)

242
vendor/vendor.json vendored
View File

@ -15,34 +15,34 @@
"revisionTime": "2017-01-18T16:13:56Z"
},
{
"checksumSHA1": "fZpMwExfyDmWnqpghxa/75Gmj+w=",
"checksumSHA1": "6exKGhZobsx+DV/SMy3nDmuBNm0=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/cdn",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "duGYYmAIPryWG256C+VrJgNy1uU=",
"checksumSHA1": "+w9njWehvjvkFK4JHAEtTgvmVgE=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/compute",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "Xq4tWiHBsbMI3fh50nZtUJ9oMts=",
"checksumSHA1": "JbbZWArn6iqSs+neT5X8AxxH6o0=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/containerregistry",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "NJGBM6QQwUQEhaCBZlN9sCoaBZE=",
"checksumSHA1": "Amd1JuJVsI9wU3+KI4Ba4jBbxps=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/containerservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
@ -54,206 +54,206 @@
"checksumSHA1": "NJGBM6QQwUQEhaCBZlN9sCoaBZE=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/eventhub",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "ULyaZ5HqIzSiehaIWGhcoNSBBsw=",
"checksumSHA1": "HqDiYte7S7N9SRNpPJE7U/cDw3c=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/keyvault",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "VECRv0I+g9uIgIZpeKb38hF/sT0=",
"checksumSHA1": "Mslwg+wp+tVV/w/9Czp6NY2dWTw=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/network",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "WDINcEl8pQOdwTDtmrVcZetD4vo=",
"checksumSHA1": "kYdY8/+AxEfjHxwxb9Se7+6OR5Q=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/redis",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "uC6vwlBtGNsb+aJJG3m9tdEfHQM=",
"checksumSHA1": "TLooEKn4oEwbs7pz3gT6tl/Egq8=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/resources/resources",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "gDwsxE1+KRfIswYeYjBcNQiLdIM=",
"checksumSHA1": "Ax4KqsWkk27VNh5S7SWNOl21+nk=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/scheduler",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "42r4OTPQkCr3IHb3YaV/PKK9YWE=",
"checksumSHA1": "RvV8PZnxICWRAt3oaPfXhhgkYqA=",
"path": "github.com/Azure/azure-sdk-for-go/arm/servicebus",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "tJdi+m5G/aMsHYihxqPsfszSe5Y=",
"checksumSHA1": "WHuO17KjbzQTSnMBkpPz2dP6KXU=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/storage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "S5ZZyUgvr7DFHwMyGsLXOUu4hw0=",
"checksumSHA1": "vn4Py70SPOS6Moan+1DhdWOLs3w=",
"path": "github.com/Azure/azure-sdk-for-go/arm/trafficmanager",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "2TUrvoJUkp8W98S9f30Ss1J/Bnk=",
"checksumSHA1": "JUEQrLvmfuxKwX/s89mFnzg7jc0=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "TcQ6KXoBkvUhCYeggJ/bwcz+QaQ=",
"checksumSHA1": "BiKKFwRpXzrRxa2odOMYAZZ5xU8=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/affinitygroup",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "HfjyhRfmKBsVgWLTOfWVcxe8Z88=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/hostedservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "4otMhU6xZ41HfmiGZFYtV93GdcI=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/location",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "hxivwm3D13cqFGOlOS3q8HD7DN0=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/networksecuritygroup",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "XzrPv8SWFBYdh5oie+NGysqnLIM=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/osimage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "hzwziaU5QlMlFcFPdbEmW18oV3Y=",
"checksumSHA1": "aTvFD5aYYXC1bLaVMlHWJImkHDg=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/sql",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "YoAhDE0X6hSFuPpXbpfqcTC0Zvw=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/storageservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "6xEiZL4a9rr5YbnY0RdzuzhEF1Q=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachine",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "xcBM3zQtfcE3VHNBACJJGEesCBI=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "0bfdkDZ2JFV7bol6GQFfC0g+lP4=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "IhjDqm84VDVSIoHyiGvUzuljG3s=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualnetwork",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "+ykSkHo40/f6VK6/zXDqzF8Lh14=",
"checksumSHA1": "Tb6BY70kI9ZclWIjjMhGzkdJbn0=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/vmutils",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "Nbn9LDCCDU8HdiTeiEocwLDGIRo=",
"checksumSHA1": "rK3ght7KTtHGdm0V4+U7fv9+tUU=",
"comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/storage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
"revisionTime": "2016-11-30T22:29:01Z",
"version": "v7.0.1-beta",
"versionExact": "v7.0.1-beta"
"revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2017-02-08T01:01:20Z",
"version": "v8.0.1-beta",
"versionExact": "v8.0.1-beta"
},
{
"checksumSHA1": "23FJUX+AInYeEM2hoUMvYZtXZd4=",