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 rivieraClient *riviera.Client
availSetClient compute.AvailabilitySetsClient availSetClient compute.AvailabilitySetsClient
usageOpsClient compute.UsageOperationsClient usageOpsClient compute.UsageClient
vmExtensionImageClient compute.VirtualMachineExtensionImagesClient vmExtensionImageClient compute.VirtualMachineExtensionImagesClient
vmExtensionClient compute.VirtualMachineExtensionsClient vmExtensionClient compute.VirtualMachineExtensionsClient
vmScaleSetClient compute.VirtualMachineScaleSetsClient vmScaleSetClient compute.VirtualMachineScaleSetsClient
@ -76,7 +76,7 @@ type ArmClient struct {
providers resources.ProvidersClient providers resources.ProvidersClient
resourceGroupClient resources.GroupsClient resourceGroupClient resources.GroupsClient
tagsClient resources.TagsClient tagsClient resources.TagsClient
resourceFindClient resources.Client resourceFindClient resources.GroupClient
jobsClient scheduler.JobsClient jobsClient scheduler.JobsClient
jobsCollectionsClient scheduler.JobCollectionsClient jobsCollectionsClient scheduler.JobCollectionsClient
@ -86,7 +86,7 @@ type ArmClient struct {
deploymentsClient resources.DeploymentsClient deploymentsClient resources.DeploymentsClient
redisClient redis.Client redisClient redis.GroupClient
trafficManagerProfilesClient trafficmanager.ProfilesClient trafficManagerProfilesClient trafficmanager.ProfilesClient
trafficManagerEndpointsClient trafficmanager.EndpointsClient trafficManagerEndpointsClient trafficmanager.EndpointsClient
@ -191,7 +191,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
asc.Sender = autorest.CreateSender(withRequestLogging()) asc.Sender = autorest.CreateSender(withRequestLogging())
client.availSetClient = asc client.availSetClient = asc
uoc := compute.NewUsageOperationsClientWithBaseURI(endpoint, c.SubscriptionID) uoc := compute.NewUsageClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&uoc.Client) setUserAgent(&uoc.Client)
uoc.Authorizer = spt uoc.Authorizer = spt
uoc.Sender = autorest.CreateSender(withRequestLogging()) uoc.Sender = autorest.CreateSender(withRequestLogging())
@ -359,7 +359,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
tc.Sender = autorest.CreateSender(withRequestLogging()) tc.Sender = autorest.CreateSender(withRequestLogging())
client.tagsClient = tc client.tagsClient = tc
rf := resources.NewClientWithBaseURI(endpoint, c.SubscriptionID) rf := resources.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&rf.Client) setUserAgent(&rf.Client)
rf.Authorizer = spt rf.Authorizer = spt
rf.Sender = autorest.CreateSender(withRequestLogging()) rf.Sender = autorest.CreateSender(withRequestLogging())
@ -419,7 +419,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
tmec.Sender = autorest.CreateSender(withRequestLogging()) tmec.Sender = autorest.CreateSender(withRequestLogging())
client.trafficManagerEndpointsClient = tmec client.trafficManagerEndpointsClient = tmec
rdc := redis.NewClientWithBaseURI(endpoint, c.SubscriptionID) rdc := redis.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&rdc.Client) setUserAgent(&rdc.Client)
rdc.Authorizer = spt rdc.Authorizer = spt
rdc.Sender = autorest.CreateSender(withRequestLogging()) 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)) tenantUUID := uuid.FromStringOrNil(policyRaw["tenant_id"].(string))
policy.TenantID = &tenantUUID policy.TenantID = &tenantUUID
objectUUID := uuid.FromStringOrNil(policyRaw["object_id"].(string)) objectUUID := policyRaw["object_id"].(string)
policy.ObjectID = &objectUUID policy.ObjectID = &objectUUID
result = append(result, policy) result = append(result, policy)
@ -313,7 +313,7 @@ func flattenKeyVaultAccessPolicies(policies *[]keyvault.AccessPolicyEntry) []int
} }
policyRaw["tenant_id"] = policy.TenantID.String() policyRaw["tenant_id"] = policy.TenantID.String()
policyRaw["object_id"] = policy.ObjectID.String() policyRaw["object_id"] = policy.ObjectID
policyRaw["key_permissions"] = keyPermissionsRaw policyRaw["key_permissions"] = keyPermissionsRaw
policyRaw["secret_permissions"] = secretPermissionsRaw policyRaw["secret_permissions"] = secretPermissionsRaw

View File

@ -240,7 +240,7 @@ func resourceArmRedisCacheUpdate(d *schema.ResourceData, meta interface{}) error
parameters.RedisConfiguration = redisConfiguration parameters.RedisConfiguration = redisConfiguration
} }
_, err := client.Update(resGroup, name, parameters, make(chan struct{})) _, err := client.Update(resGroup, name, parameters)
if err != nil { if err != nil {
return err return err
} }
@ -344,7 +344,7 @@ func resourceArmRedisCacheDelete(d *schema.ResourceData, meta interface{}) error
return nil 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) { return func() (interface{}, string, error) {
res, err := client.Get(resourceGroupName, sgName) res, err := client.Get(resourceGroupName, sgName)
if err != nil { if err != nil {

View File

@ -3,9 +3,7 @@ package azurerm
import ( import (
"fmt" "fmt"
"log" "log"
// "strings"
"regexp" "regexp"
"strconv"
"github.com/Azure/azure-sdk-for-go/storage" "github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/schema" "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 metaData := make(map[string]string) // TODO: support MetaData
log.Printf("[INFO] Creating share %q in storage account %q", name, storageAccountName) 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) 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) d.SetId(name)
return resourceArmStorageShareRead(d, meta) return resourceArmStorageShareRead(d, meta)
@ -103,7 +109,8 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error
name := d.Get("name").(string) name := d.Get("name").(string)
url := fileClient.GetShareURL(name) reference := fileClient.GetShareReference(name)
url := reference.URL()
if url == "" { if url == "" {
log.Printf("[INFO] URL for %q is empty", name) 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) name := d.Get("name").(string)
log.Printf("[INFO] Checking for existence of share %q.", name) 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 { if err != nil {
return false, fmt.Errorf("Error testing existence of share %q: %s", name, err) 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) name := d.Get("name").(string)
log.Printf("[INFO] Deleting storage file %q", name) reference := fileClient.GetShareReference(name)
if _, err = fileClient.DeleteShareIfExists(name); err != nil { err = reference.Create()
if _, err = reference.DeleteIfExists(); err != nil {
return fmt.Errorf("Error deleting storage file %q: %s", name, err) 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 return nil
} }
_, err = fileClient.DeleteShareIfExists(sS.Name) reference := fileClient.GetShareReference(sS.Name)
if err != nil { err = reference.Create()
return err
if _, err = reference.DeleteIfExists(); err != nil {
return fmt.Errorf("Error deleting storage file %q: %s", name, err)
} }
return nil return nil

View File

@ -19,7 +19,7 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -61,9 +61,8 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
} }
} }
// CheckNameAvailability check the availability of a resource name without // CheckNameAvailability check the availability of a resource name. This is
// creating the resource. This is needed for resources where name is globally // needed for resources where name is globally unique, such as a CDN endpoint.
// unique, such as a CDN endpoint.
// //
// checkNameAvailabilityInput is input to check. // checkNameAvailabilityInput is input to check.
func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) {
@ -128,6 +127,89 @@ func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Respons
return 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. // ListOperations lists all of the available CDN REST API operations.
func (client ManagementClient) ListOperations() (result OperationListResult, err error) { func (client ManagementClient) ListOperations() (result OperationListResult, err error) {
req, err := client.ListOperationsPreparer() req, err := client.ListOperationsPreparer()

View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -26,8 +26,8 @@ import (
) )
// CustomDomainsClient is the use these APIs to manage Azure CDN resources // CustomDomainsClient is the use these APIs to manage Azure CDN resources
// through the Azure Resource Manager. You must make sure that requests made // through the Azure Resource Manager. You must make sure that requests made to
// to these resources are secure. // these resources are secure.
type CustomDomainsClient struct { type CustomDomainsClient struct {
ManagementClient ManagementClient
} }
@ -44,17 +44,17 @@ func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) Cu
return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// Create creates a new CDN custom domain within an endpoint. This method may // Create creates a new custom domain within an endpoint. This method may poll
// poll for completion. Polling can be canceled by passing the cancel channel // for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. customDomainName is name of the custom // which is unique globally. customDomainName is name of the custom domain
// domain within an endpoint. customDomainProperties is custom domain // within an endpoint. customDomainProperties is properties required to create
// properties required for creation. // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -130,16 +130,16 @@ func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result a
return return
} }
// Delete deletes an existing CDN custom domain within an endpoint. This // Delete deletes an existing custom domain within an endpoint. This method may
// method may poll for completion. Polling can be canceled by passing the // poll for completion. Polling can be canceled by passing the cancel channel
// cancel channel argument. The channel will be used to cancel polling and // argument. The channel will be used to cancel polling and any outstanding
// any outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. customDomainName is name of the custom // which is unique globally. customDomainName is name of the custom domain
// domain within an endpoint. // within an endpoint.
func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (result autorest.Response, err error) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -210,13 +210,13 @@ func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result a
return 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. customDomainName is name of the custom // which is unique globally. customDomainName is name of the custom domain
// domain within an endpoint. // within an endpoint.
func (client CustomDomainsClient) Get(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { func (client CustomDomainsClient) Get(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -286,12 +286,12 @@ func (client CustomDomainsClient) GetResponder(resp *http.Response) (result Cust
return 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResult, err error) { func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResult, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -43,15 +43,16 @@ func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) Endpoi
return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// Create creates a new CDN endpoint with the specified parameters. This // Create creates a new CDN endpoint with the specified endpoint name under the
// method may poll for completion. Polling can be canceled by passing the // specified subscription, resource group and profile. This method may poll for
// cancel channel argument. The channel will be used to cancel polling and // completion. Polling can be canceled by passing the cancel channel argument.
// any outstanding HTTP requests. // The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. endpoint is endpoint properties // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -60,11 +61,7 @@ func (client EndpointsClient) Create(resourceGroupName string, profileName strin
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: endpoint, {TargetValue: endpoint,
Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false, 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}, Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create") return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create")
} }
@ -130,15 +127,16 @@ func (client EndpointsClient) CreateResponder(resp *http.Response) (result autor
return return
} }
// Delete deletes an existing CDN endpoint with the specified parameters. This // Delete deletes an existing CDN endpoint with the specified endpoint name
// method may poll for completion. Polling can be canceled by passing the // under the specified subscription, resource group and profile. This method
// cancel channel argument. The channel will be used to cancel polling and // may poll for completion. Polling can be canceled by passing the cancel
// any outstanding HTTP requests. // 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -208,13 +206,13 @@ func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autor
return return
} }
// Get gets an existing CDN endpoint with the specified endpoint name under // Get gets an existing CDN endpoint with the specified endpoint name under the
// the specified subscription, resource group and profile. // specified subscription, resource group and profile.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) { func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -286,8 +284,8 @@ func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint
// ListByProfile lists existing CDN endpoints. // ListByProfile lists existing CDN endpoints.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. // the resource group.
func (client EndpointsClient) ListByProfile(resourceGroupName string, profileName string) (result EndpointListResult, err error) { func (client EndpointsClient) ListByProfile(resourceGroupName string, profileName string) (result EndpointListResult, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -379,16 +377,116 @@ func (client EndpointsClient) ListByProfileNextResults(lastResults EndpointListR
return return
} }
// LoadContent forcibly pre-loads CDN endpoint content. Available for Verizon // ListResourceUsage checks the quota and usage of geo filters and custom
// Profiles. This method may poll for completion. Polling can be canceled by // domains under the given endpoint.
// 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. contentFilePaths is the path to the // which is unique globally.
// content to be loaded. Path should describe a file. 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -462,17 +560,18 @@ func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result
return return
} }
// PurgeContent forcibly purges CDN endpoint content. This method may poll for // PurgeContent removes a content from CDN. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. contentFilePaths is the path to the // which is unique globally. contentFilePaths is the path to the content to be
// content to be purged. Path can describe a file or directory using the // purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
// wildcard. e.g. '/my/directory/*' or '/my/file.exe/' // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -546,15 +645,15 @@ func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result
return return
} }
// Start starts an existing stopped CDN endpoint. This method may poll for // Start starts an existing CDN endpoint that is on a stopped state. This
// completion. Polling can be canceled by passing the cancel channel // method may poll for completion. Polling can be canceled by passing the
// argument. The channel will be used to cancel polling and any outstanding // cancel channel argument. The channel will be used to cancel polling and any
// HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {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 // Stop stops an existing running CDN endpoint. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -702,19 +801,19 @@ func (client EndpointsClient) StopResponder(resp *http.Response) (result autores
return return
} }
// Update updates an existing CDN endpoint with the specified parameters. Only // Update updates an existing CDN endpoint with the specified endpoint name
// tags and OriginHostHeader can be updated after creating an endpoint. To // under the specified subscription, resource group and profile. Only tags and
// update origins, use the Update Origin operation. To update custom domains, // Origin HostHeader can be updated after creating an endpoint. To update
// use the Update Custom Domain operation. This method may poll for // origins, use the Update Origin operation. To update custom domains, use the
// completion. Polling can be canceled by passing the cancel channel // Update Custom Domain operation. This method may poll for completion. Polling
// argument. The channel will be used to cancel polling and any outstanding // can be canceled by passing the cancel channel argument. The channel will be
// HTTP requests. // used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. endpointUpdateProperties is endpoint // which is unique globally. endpointUpdateProperties is endpoint update
// update properties // properties
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -786,14 +885,14 @@ func (client EndpointsClient) UpdateResponder(resp *http.Response) (result autor
return return
} }
// ValidateCustomDomain validates a custom domain mapping to ensure it maps to // ValidateCustomDomain validates the custom domain mapping to ensure it maps
// the correct CNAME in DNS. // to the correct CDN endpoint in DNS.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. customDomainProperties is custom domain // which is unique globally. customDomainProperties is custom domain to be
// to validate. // validated.
func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -78,11 +78,11 @@ const (
// OriginResourceStateActive specifies the origin resource state active // OriginResourceStateActive specifies the origin resource state active
// state for origin resource state. // state for origin resource state.
OriginResourceStateActive OriginResourceState = "Active" OriginResourceStateActive OriginResourceState = "Active"
// OriginResourceStateCreating specifies the origin resource state // OriginResourceStateCreating specifies the origin resource state creating
// creating state for origin resource state. // state for origin resource state.
OriginResourceStateCreating OriginResourceState = "Creating" OriginResourceStateCreating OriginResourceState = "Creating"
// OriginResourceStateDeleting specifies the origin resource state // OriginResourceStateDeleting specifies the origin resource state deleting
// deleting state for origin resource state. // state for origin resource state.
OriginResourceStateDeleting OriginResourceState = "Deleting" OriginResourceStateDeleting OriginResourceState = "Deleting"
) )
@ -161,9 +161,14 @@ type CheckNameAvailabilityOutput struct {
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`
} }
// CustomDomain is cDN CustomDomain represents a mapping between a // CidrIPAddress is cIDR Ip address
// user-specified domain name and a CDN endpoint. This is to use custom type CidrIPAddress struct {
// domain names to represent the URLs for branding purposes. 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 { type CustomDomain struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
@ -175,8 +180,8 @@ type CustomDomain struct {
} }
// CustomDomainListResult is result of the request to list custom domains. It // 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 // contains a list of custom domain objects and a URL link to get the next set
// set of results. // of results.
type CustomDomainListResult struct { type CustomDomainListResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Value *[]CustomDomain `json:"value,omitempty"` Value *[]CustomDomain `json:"value,omitempty"`
@ -216,24 +221,47 @@ type CustomDomainPropertiesParameters struct {
HostName *string `json:"hostName,omitempty"` 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 { type DeepCreatedOrigin struct {
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
*DeepCreatedOriginProperties `json:"properties,omitempty"` *DeepCreatedOriginProperties `json:"properties,omitempty"`
} }
// DeepCreatedOriginProperties is properties of origins Properties of the // DeepCreatedOriginProperties is properties of origin Properties of the origin
// origin created on the CDN endpoint. // created on the CDN endpoint.
type DeepCreatedOriginProperties struct { type DeepCreatedOriginProperties struct {
HostName *string `json:"hostName,omitempty"` HostName *string `json:"hostName,omitempty"`
HTTPPort *int32 `json:"httpPort,omitempty"` HTTPPort *int32 `json:"httpPort,omitempty"`
HTTPSPort *int32 `json:"httpsPort,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 // Endpoint is cDN endpoint is the entity within a CDN profile containing
// configuration information regarding caching behaviors and origins. The CDN // configuration information such as origin, protocol, content caching and
// endpoint is exposed using the URL format <endpointname>.azureedge.net by // delivery behavior. The CDN endpoint uses the URL format
// default, but custom domains can also be created. // <endpointname>.azureedge.net.
type Endpoint struct { type Endpoint struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
@ -244,9 +272,8 @@ type Endpoint struct {
*EndpointProperties `json:"properties,omitempty"` *EndpointProperties `json:"properties,omitempty"`
} }
// EndpointListResult is result of the request to list endpoints. It contains // EndpointListResult is result of the request to list endpoints. It contains a
// a list of endpoint objects and a URL link to get the the next set of // list of endpoint objects and a URL link to get the the next set of results.
// results.
type EndpointListResult struct { type EndpointListResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Value *[]Endpoint `json:"value,omitempty"` Value *[]Endpoint `json:"value,omitempty"`
@ -265,8 +292,8 @@ func (client EndpointListResult) EndpointListResultPreparer() (*http.Request, er
autorest.WithBaseURL(to.String(client.NextLink))) autorest.WithBaseURL(to.String(client.NextLink)))
} }
// EndpointProperties is the JSON object that contains the properties of the // EndpointProperties is the JSON object that contains the properties required
// endpoint to create. // to create an endpoint.
type EndpointProperties struct { type EndpointProperties struct {
OriginHostHeader *string `json:"originHostHeader,omitempty"` OriginHostHeader *string `json:"originHostHeader,omitempty"`
OriginPath *string `json:"originPath,omitempty"` OriginPath *string `json:"originPath,omitempty"`
@ -298,8 +325,7 @@ type EndpointPropertiesUpdateParameters struct {
GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"`
} }
// EndpointUpdateParameters is endpoint properties required for new endpoint // EndpointUpdateParameters is properties required to create a new endpoint.
// creation.
type EndpointUpdateParameters struct { type EndpointUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
*EndpointPropertiesUpdateParameters `json:"properties,omitempty"` *EndpointPropertiesUpdateParameters `json:"properties,omitempty"`
@ -312,14 +338,21 @@ type ErrorResponse struct {
Message *string `json:"message,omitempty"` 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 { type GeoFilter struct {
RelativePath *string `json:"relativePath,omitempty"` RelativePath *string `json:"relativePath,omitempty"`
Action GeoFilterActions `json:"action,omitempty"` Action GeoFilterActions `json:"action,omitempty"`
CountryCodes *[]string `json:"countryCodes,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 { type LoadParameters struct {
ContentPaths *[]string `json:"contentPaths,omitempty"` ContentPaths *[]string `json:"contentPaths,omitempty"`
} }
@ -338,8 +371,7 @@ type OperationDisplay struct {
} }
// OperationListResult is result of the request to list CDN operations. It // 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 // contains a list of operations and a URL link to get the next set of results.
// results.
type OperationListResult struct { type OperationListResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"` 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. // 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 // 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 // content cached, they attempt to fetch it from one or more of the configured
// configured origins. // origins.
type Origin struct { type Origin struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
@ -416,8 +448,8 @@ type OriginUpdateParameters struct {
*OriginPropertiesParameters `json:"properties,omitempty"` *OriginPropertiesParameters `json:"properties,omitempty"`
} }
// Profile is cDN profile represents the top level resource and the entry // Profile is cDN profile represents the top level resource and the entry point
// point into the CDN API. This allows users to set up a logical grouping of // into the CDN API. This allows users to set up a logical grouping of
// endpoints in addition to creating shared configuration settings and // endpoints in addition to creating shared configuration settings and
// selecting pricing tiers and providers. // selecting pricing tiers and providers.
type Profile struct { type Profile struct {
@ -451,19 +483,19 @@ func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, erro
autorest.WithBaseURL(to.String(client.NextLink))) autorest.WithBaseURL(to.String(client.NextLink)))
} }
// ProfileProperties is the JSON object that contains the properties of the // ProfileProperties is the JSON object that contains the properties required
// profile to create. // to create a profile.
type ProfileProperties struct { type ProfileProperties struct {
ResourceState ProfileResourceState `json:"resourceState,omitempty"` ResourceState ProfileResourceState `json:"resourceState,omitempty"`
ProvisioningState *string `json:"provisioningState,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 { type ProfileUpdateParameters struct {
Tags *map[string]*string `json:"tags,omitempty"` Tags *map[string]*string `json:"tags,omitempty"`
} }
// PurgeParameters is parameters required for endpoint purge. // PurgeParameters is parameters required for content purge.
type PurgeParameters struct { type PurgeParameters struct {
ContentPaths *[]string `json:"contentPaths,omitempty"` ContentPaths *[]string `json:"contentPaths,omitempty"`
} }
@ -477,18 +509,47 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"` 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 { type Sku struct {
Name SkuName `json:"name,omitempty"` 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 { type SsoURI struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
SsoURIValue *string `json:"ssoUriValue,omitempty"` 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 { type ValidateCustomDomainInput struct {
HostName *string `json:"hostName,omitempty"` HostName *string `json:"hostName,omitempty"`
} }

View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -42,13 +42,13 @@ func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsC
return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)} 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. originName is name of the origin which // which is unique globally. originName is name of the origin which is unique
// is unique within the endpoint. // within the endpoint.
func (client OriginsClient) Get(resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) { func (client OriginsClient) Get(resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -118,12 +118,12 @@ func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, er
return 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. // which is unique globally.
func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result OriginListResult, err error) { func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result OriginListResult, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -216,16 +216,16 @@ func (client OriginsClient) ListByEndpointNextResults(lastResults OriginListResu
return return
} }
// Update updates an existing CDN origin within an endpoint. This method may // Update updates an existing origin within an endpoint. This method may poll
// poll for completion. Polling can be canceled by passing the cancel channel // for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. endpointName is name of the endpoint under the // the resource group. endpointName is name of the endpoint under the profile
// profile which is unique globally. originName is name of the origin which // which is unique globally. originName is name of the origin which is unique
// is unique within the endpoint. originUpdateProperties is origin properties // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,

View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // 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 // Create creates a new CDN profile with a profile name under the specified
// subscription and resource group. This method may poll for completion. // subscription and resource group. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The // Polling can be canceled by passing the cancel channel argument. The channel
// channel will be used to cancel polling and any outstanding HTTP requests. // will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. profile is profile properties needed to create // the resource group. profile is profile properties needed to create a new
// a new profile. // profile.
func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {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.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: profile, {TargetValue: profile,
Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}, Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create") 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. // 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 // including endpoints, origins and custom domains. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. // the resource group.
func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (result autorest.Response, err error) { func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {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 // GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN
// supplemental portal. Supplemnetal portal is used to configure advanced // supplemental portal. Supplemnetal portal is used to configure advanced
// feature capabilities that are not yet available in the Azure portal, such // feature capabilities that are not yet available in the Azure portal, such as
// as core reports in a standard profile; rules engine, advanced HTTP // core reports in a standard profile; rules engine, advanced HTTP reports, and
// reports, and real-time stats and alerts in a premium profile. The SSO URI // real-time stats and alerts in a premium profile. The SSO URI changes
// changes approximately every 10 minutes. // approximately every 10 minutes.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. // the resource group.
func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileName string) (result SsoURI, err error) { func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileName string) (result SsoURI, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -287,8 +283,8 @@ func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (resul
// subscription and resource group. // subscription and resource group.
// //
// resourceGroupName is name of the Resource group within the Azure // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. // the resource group.
func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) { func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
@ -356,7 +352,7 @@ func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile,
return 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) { func (client ProfilesClient) List() (result ProfileListResult, err error) {
req, err := client.ListPreparer() req, err := client.ListPreparer()
if err != nil { if err != nil {
@ -438,7 +434,7 @@ func (client ProfilesClient) ListNextResults(lastResults ProfileListResult) (res
return 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. // subscription.
@ -532,16 +528,113 @@ func (client ProfilesClient) ListByResourceGroupNextResults(lastResults ProfileL
return return
} }
// Update updates an existing CDN profile with the specified profile name // ListResourceUsage checks the quota and actual usage of endpoints under the
// under the specified subscription and resource group. This method may poll // given CDN profile.
// 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 // resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique // subscription. profileName is name of the CDN profile which is unique within
// within the resource group. profileUpdateParameters is profile properties // the resource group.
// needed to update an existing profile. 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) { func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,

View File

@ -14,30 +14,47 @@ package cdn
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -44,17 +43,10 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string)
// CreateOrUpdate create or update an availability set. // CreateOrUpdate create or update an availability set.
// //
// resourceGroupName is the name of the resource group. name is the name of // resourceGroupName is the name of the resource group. name is the name of the
// the availability set. parameters is parameters supplied to the Create // availability set. parameters is parameters supplied to the Create
// Availability Set operation. // Availability Set operation.
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) { func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.AvailabilitySetProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AvailabilitySetProperties.Statuses", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -119,7 +111,7 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
// //
// resourceGroupName is the name of the resource group. availabilitySetName is // resourceGroupName is the name of the resource group. availabilitySetName is
// the name of the availability set. // the name of the availability set.
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) req, err := client.DeletePreparer(resourceGroupName, availabilitySetName)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
@ -127,7 +119,7 @@ func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabili
resp, err := client.DeleteSender(req) resp, err := client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request") return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
} }
@ -167,13 +159,14 @@ func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Resp
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = autorest.Response{Response: resp}
return return
} }

View File

@ -18,7 +18,7 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

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

View File

@ -14,7 +14,7 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -25,21 +25,19 @@ import (
"net/http" "net/http"
) )
// UsageOperationsClient is the the Compute Management Client. // UsageClient is the the Compute Management Client.
type UsageOperationsClient struct { type UsageClient struct {
ManagementClient ManagementClient
} }
// NewUsageOperationsClient creates an instance of the UsageOperationsClient // NewUsageClient creates an instance of the UsageClient client.
// client. func NewUsageClient(subscriptionID string) UsageClient {
func NewUsageOperationsClient(subscriptionID string) UsageOperationsClient { return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
return NewUsageOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewUsageOperationsClientWithBaseURI creates an instance of the // NewUsageClientWithBaseURI creates an instance of the UsageClient client.
// UsageOperationsClient client. func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string) UsageOperationsClient { return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// List gets, for the specified location, the current compute resource usage // List gets, for the specified location, the current compute resource usage
@ -47,34 +45,34 @@ func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string)
// subscription. // subscription.
// //
// location is the location for which resource usage is queried. // location is the location for which resource usage is queried.
func (client UsageOperationsClient) List(location string) (result ListUsagesResult, err error) { func (client UsageClient) List(location string) (result ListUsagesResult, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: location, {TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { 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) req, err := client.ListPreparer(location)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending request") return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
} }
return return
} }
// ListPreparer prepares the List request. // 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{}{ pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location), "location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "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 // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// ListResponder handles the response to the List request. The method always // ListResponder handles the response to the List request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -112,10 +110,10 @@ func (client UsageOperationsClient) ListResponder(resp *http.Response) (result L
} }
// ListNextResults retrieves the next set of results, if any. // 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() req, err := lastResults.ListUsagesResultPreparer()
if err != nil { 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 { if req == nil {
return return
@ -124,12 +122,12 @@ func (client UsageOperationsClient) ListNextResults(lastResults ListUsagesResult
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageOperationsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to next results request")
} }
return return

View File

@ -14,30 +14,47 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -35,8 +35,8 @@ func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachin
return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of // NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the
// the VirtualMachineExtensionImagesClient client. // VirtualMachineExtensionImagesClient client.
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient { func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }

View File

@ -14,14 +14,13 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -53,13 +52,6 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID
// extensionParameters is parameters supplied to the Create Virtual Machine // extensionParameters is parameters supplied to the Create Virtual Machine
// Extension operation. // Extension operation.
func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: extensionParameters,
Constraints: []validation.Constraint{{Target: "extensionParameters.VirtualMachineExtensionProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "extensionParameters.VirtualMachineExtensionProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, vmName, vmExtensionName, extensionParameters, cancel)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
@ -123,9 +115,9 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.
} }
// Delete the operation to delete the extension. This method may poll for // Delete the operation to delete the extension. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine where the extension should be deleted. vmExtensionName // 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. // Get the operation to get the extension.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine containing the extension. vmExtensionName is the name // the virtual machine containing the extension. vmExtensionName is the name of
// of the virtual machine extension. expand is the expand expression to apply // the virtual machine extension. expand is the expand expression to apply on
// on the operation. // the operation.
func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmName string, vmExtensionName string, expand string) (result VirtualMachineExtension, err error) { func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmName string, vmExtensionName string, expand string) (result VirtualMachineExtension, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, vmExtensionName, expand) req, err := client.GetPreparer(resourceGroupName, vmName, vmExtensionName, expand)
if err != nil { if err != nil {

View File

@ -14,7 +14,7 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // 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 // 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 // a template that can be used to create similar VMs. This method may poll for
// for completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. parameters is parameters supplied to the Capture // 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 // CreateOrUpdate the operation to create or update a virtual machine. This
// method may poll for completion. Polling can be canceled by passing the // method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and // cancel channel argument. The channel will be used to cancel polling and any
// any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. parameters is parameters supplied to the Create // the virtual machine. parameters is parameters supplied to the Create Virtual
// Virtual Machine operation. // Machine operation.
func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (result autorest.Response, err error) { func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {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.StorageProfile.OsDisk.Vhd", Name: validation.Null, Rule: true, Chain: nil},
}}, }},
}}, }},
{Target: "parameters.VirtualMachineProperties.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil}, }}}}}); err != nil {
{Target: "parameters.VirtualMachineProperties.InstanceView", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualMachineProperties.VMID", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
{Target: "parameters.Resources", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate") 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 // Delete the operation to delete a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.
@ -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 // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // 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) req, err := client.GeneralizePreparer(resourceGroupName, vmName)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request")
@ -365,7 +361,7 @@ func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName
resp, err := client.GeneralizeSender(req) resp, err := client.GeneralizeSender(req)
if err != nil { if err != nil {
result.Response = resp result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request")
} }
@ -405,13 +401,14 @@ func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.R
// GeneralizeResponder handles the response to the Generalize request. The method always // GeneralizeResponder handles the response to the Generalize request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = autorest.Response{Response: resp}
return 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 // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. expand is the expand expression to apply on the // the virtual machine. expand is the expand expression to apply on the
// operation. Possible values include: 'instanceView' // operation.
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand InstanceViewTypes) (result VirtualMachine, err error) { func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand InstanceViewTypes) (result VirtualMachine, err error) {
req, err := client.GetPreparer(resourceGroupName, vmName, expand) req, err := client.GetPreparer(resourceGroupName, vmName, expand)
if err != nil { if err != nil {
@ -570,8 +567,8 @@ func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineLi
return return
} }
// ListAll lists all of the virtual machines in the specified subscription. // ListAll lists all of the virtual machines in the specified subscription. Use
// Use the nextLink property in the response to get the next page of virtual // the nextLink property in the response to get the next page of virtual
// machines. // machines.
func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) { func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
@ -719,11 +716,10 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo
} }
// PowerOff the operation to power off (stop) a virtual machine. The virtual // PowerOff the operation to power off (stop) a virtual machine. The virtual
// machine can be restarted with the same provisioned resources. You are // machine can be restarted with the same provisioned resources. You are still
// still charged for this virtual machine. This method may poll for // charged for this virtual machine. This method may poll for completion.
// completion. Polling can be canceled by passing the cancel channel // Polling can be canceled by passing the cancel channel argument. The channel
// argument. The channel will be used to cancel polling and any outstanding // will be used to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.
@ -854,10 +850,10 @@ func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (resu
return return
} }
// Restart the operation to restart a virtual machine. This method may poll // Restart the operation to restart a virtual machine. This method may poll for
// for completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.
@ -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 // Start the operation to start a virtual machine. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmName is the name of // resourceGroupName is the name of the resource group. vmName is the name of
// the virtual machine. // the virtual machine.

View File

@ -14,7 +14,7 @@ package compute
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -43,12 +43,12 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID
} }
// CreateOrUpdate create or update a VM scale set. This method may poll for // CreateOrUpdate create or update a VM scale set. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. name is the name of // resourceGroupName is the name of the resource group. name is the name of the
// the VM scale set to create or update. parameters is the scale set object. // 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) { func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {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}}}, 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 { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate") 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 // Deallocate deallocates specific virtual machines in a VM scale set. Shuts
// down the virtual machines and releases the compute resources. You are not // down the virtual machines and releases the compute resources. You are not
// billed for the compute resources that this virtual machine scale set // billed for the compute resources that this virtual machine scale set
// deallocates. This method may poll for completion. Polling can be canceled // deallocates. This method may poll for completion. Polling can be canceled by
// by passing the cancel channel argument. The channel will be used to cancel // passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // 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 // 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 // can be canceled by passing the cancel channel argument. The channel will be
// be used to cancel polling and any outstanding HTTP requests. // used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. // 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 // 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 // the associated resource group. Use nextLink property in the response to get
// get the next page of VM Scale Sets. Do this till nextLink is not null to // the next page of VM Scale Sets. Do this till nextLink is not null to fetch
// fetch all the VM Scale Sets. // all the VM Scale Sets.
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) { func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
req, err := client.ListAllPreparer() req, err := client.ListAllPreparer()
if err != nil { if err != nil {
@ -729,9 +728,9 @@ func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults Virt
// PowerOff power off (stop) one or more virtual machines in a VM scale set. // 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 // Note that resources are still attached and you are getting charged for the
// resources. Instead, use deallocate to release resources and avoid charges. // resources. Instead, use deallocate to release resources and avoid charges.
// This method may poll for completion. Polling can be canceled by passing // This method may poll for completion. Polling can be canceled by passing the
// the cancel channel argument. The channel will be used to cancel polling // cancel channel argument. The channel will be used to cancel polling and any
// and any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine // 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 return
} }
// Reimage reimages (upgrade the operating system) one or more virtual // Reimage reimages (upgrade the operating system) one or more virtual machines
// machines in a VM scale set. This method may poll for completion. Polling // in a VM scale set. This method may poll for completion. Polling can be
// can be canceled by passing the cancel channel argument. The channel will // canceled by passing the cancel channel argument. The channel will be used to
// be used to cancel polling and any outstanding HTTP requests. // cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. // name of the VM scale set.
@ -868,10 +867,10 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response
return return
} }
// Restart restarts one or more virtual machines in a VM scale set. This // Restart restarts one or more virtual machines in a VM scale set. This method
// method may poll for completion. Polling can be canceled by passing the // may poll for completion. Polling can be canceled by passing the cancel
// cancel channel argument. The channel will be used to cancel polling and // channel argument. The channel will be used to cancel polling and any
// any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine // 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 return
} }
// Start starts one or more virtual machines in a VM scale set. This method // Start starts one or more virtual machines in a VM scale set. This method may
// may poll for completion. Polling can be canceled by passing the cancel // poll for completion. Polling can be canceled by passing the cancel channel
// channel argument. The channel will be used to cancel polling and any // argument. The channel will be used to cancel polling and any outstanding
// outstanding HTTP requests. // HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine // 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 // 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 // in the VM scale set model. This method may poll for completion. Polling can
// can be canceled by passing the cancel channel argument. The channel will // be canceled by passing the cancel channel argument. The channel will be used
// be used to cancel polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. vmInstanceIDs is a list of virtual machine // 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -42,11 +42,11 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
} }
// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts // Deallocate deallocates a specific virtual machine in a VM scale set. Shuts
// down the virtual machine and releases the compute resources it uses. You // down the virtual machine and releases the compute resources it uses. You are
// are not billed for the compute resources of this virtual machine once it // not billed for the compute resources of this virtual machine once it is
// is deallocated. This method may poll for completion. Polling can be // deallocated. This method may poll for completion. Polling can be canceled by
// canceled by passing the cancel channel argument. The channel will be used // passing the cancel channel argument. The channel will be used to cancel
// to cancel polling and any outstanding HTTP requests. // polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // 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 // 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 // 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 are still attached and you are getting charged for the resources.
// resources. Instead, use deallocate to release resources and avoid charges. // Instead, use deallocate to release resources and avoid charges. This method
// This method may poll for completion. Polling can be canceled by passing // may poll for completion. Polling can be canceled by passing the cancel
// the cancel channel argument. The channel will be used to cancel polling // channel argument. The channel will be used to cancel polling and any
// and any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual // 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 // Reimage reimages (upgrade the operating system) a specific virtual machine
// in a VM scale set. This method may poll for completion. Polling can be // 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 // canceled by passing the cancel channel argument. The channel will be used to
// to cancel polling and any outstanding HTTP requests. // cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual // 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 // 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 // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. vmScaleSetName is the // resourceGroupName is the name of the resource group. vmScaleSetName is the
// name of the VM scale set. instanceID is the instance ID of the virtual // 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -1,5 +1,6 @@
// Package containerregistry implements the Azure ARM Containerregistry // Package containerregistry implements the Azure ARM Containerregistry service
// service API version 2016-06-27-preview. // API version 2016-06-27-preview.
//
// //
package containerregistry package containerregistry
@ -17,7 +18,7 @@ package containerregistry
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package containerregistry
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -70,8 +70,8 @@ type RegistryNameCheckRequest struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
} }
// RegistryNameStatus is the result of a request to check the availability of // RegistryNameStatus is the result of a request to check the availability of a
// a container registry name. // container registry name.
type RegistryNameStatus struct { type RegistryNameStatus struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
NameAvailable *bool `json:"nameAvailable,omitempty"` NameAvailable *bool `json:"nameAvailable,omitempty"`

View File

@ -14,7 +14,7 @@ package containerregistry
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // 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}, 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.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 { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CreateOrUpdate")
} }
@ -187,7 +185,7 @@ func (client RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (res
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
@ -250,7 +248,7 @@ func (client RegistriesClient) DeleteResponder(resp *http.Response) (result auto
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return

View File

@ -14,30 +14,47 @@ package containerregistry
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) // Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta" tag = "-beta"
semVerFormat = "%s.%s.%s%s" semVerFormat = "%s.%s.%s%s"

View File

@ -19,7 +19,7 @@ package keyvault
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package keyvault
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -147,7 +147,7 @@ const (
// tenant ID. // tenant ID.
type AccessPolicyEntry struct { type AccessPolicyEntry struct {
TenantID *uuid.UUID `json:"tenantId,omitempty"` TenantID *uuid.UUID `json:"tenantId,omitempty"`
ObjectID *uuid.UUID `json:"objectId,omitempty"` ObjectID *string `json:"objectId,omitempty"`
ApplicationID *uuid.UUID `json:"applicationId,omitempty"` ApplicationID *uuid.UUID `json:"applicationId,omitempty"`
Permissions *Permissions `json:"permissions,omitempty"` Permissions *Permissions `json:"permissions,omitempty"`
} }
@ -169,6 +169,25 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"` 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 // Sku is sKU details
type Sku struct { type Sku struct {
Family *string `json:"family,omitempty"` Family *string `json:"family,omitempty"`

View File

@ -14,7 +14,7 @@ package keyvault
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -53,8 +53,9 @@ func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName st
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.Properties", Name: validation.Null, Rule: true, {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.TenantID", Name: validation.Null, Rule: true, Chain: nil},
Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", 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, {Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.MaxItems, Rule: 16, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.MaxItems, Rule: 16, Chain: nil}}},
}}}}}); err != 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 // filter is the filter to apply on the operation. top is maximum number of
// results to return. // 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) req, err := client.ListPreparer(filter, top)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request") 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 // ListResponder handles the response to the List request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -313,8 +314,8 @@ func (client VaultsClient) ListResponder(resp *http.Response) (result VaultListR
} }
// ListNextResults retrieves the next set of results, if any. // ListNextResults retrieves the next set of results, if any.
func (client VaultsClient) ListNextResults(lastResults VaultListResult) (result VaultListResult, err error) { func (client VaultsClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) {
req, err := lastResults.VaultListResultPreparer() req, err := lastResults.ResourceListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing next results request") 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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, 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", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, 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 { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate")
} }

View File

@ -21,7 +21,6 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -54,19 +53,6 @@ func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) Inter
// is the name of the network interface. parameters is parameters supplied to // is the name of the network interface. parameters is parameters supplied to
// the create or update network interface operation. // the create or update network interface operation.
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) { func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.InterfacePropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.InterfacesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -59,9 +59,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, 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}, Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
{Target: "parameters.LocalNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate") 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, 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", 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", 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.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.Subnet.SubnetPropertiesFormat.IPConfigurations", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil},
}},
}}, }},
{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate")
} }

View File

@ -21,7 +21,6 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -54,13 +53,6 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
// name of the route table. parameters is parameters supplied to the create // name of the route table. parameters is parameters supplied to the create
// or update route table operation. // or update route table operation.
func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (result autorest.Response, err error) { func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.RouteTablesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -21,7 +21,6 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -56,15 +55,6 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
// parameters is parameters supplied to the create or update network security // parameters is parameters supplied to the create or update network security
// group operation. // group operation.
func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (result autorest.Response, err error) { func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.SecurityGroupsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

@ -21,7 +21,6 @@ package network
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -54,24 +53,6 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC
// subnetParameters is parameters supplied to the create or update subnet // subnetParameters is parameters supplied to the create or update subnet
// operation. // operation.
func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (result autorest.Response, err error) { func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: subnetParameters,
Constraints: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.NetworkInterfaces", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "subnetParameters.SubnetPropertiesFormat.NetworkSecurityGroup.SecurityGroupPropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}},
{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "subnetParameters.SubnetPropertiesFormat.RouteTable.RouteTablePropertiesFormat.Subnets", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "subnetParameters.SubnetPropertiesFormat.IPConfigurations", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.SubnetsClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request") return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")

View File

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

View File

@ -61,27 +61,16 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGrou
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, 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", 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", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}}, }},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false, {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", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}}, }},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, {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", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.LocalNetworkAddressSpace", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}},
}}, }},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.ConnectionStatus", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.TunnelConnectionStatus", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.EgressBytesTransferred", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.IngressBytesTransferred", Name: validation.ReadOnly, Rule: true, Chain: nil},
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate") 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, 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}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.IPConfigurations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.ProvisioningState", Name: validation.ReadOnly, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate") 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package redis
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -221,7 +221,7 @@ type ResourceType struct {
// ScheduleEntries is list of patch schedules for a Redis cache. // ScheduleEntries is list of patch schedules for a Redis cache.
type ScheduleEntries struct { type ScheduleEntries struct {
ScheduleEntriesProperty *[]ScheduleEntry `json:"scheduleEntries,omitempty"` ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"`
} }
// ScheduleEntry is patch schedule entry for a Premium Redis Cache. // 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"net/http"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
"net/http"
) )
// PatchSchedulesClient is the rEST API for Azure Redis Cache Service. // 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)} 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 // resourceGroupName is the name of the resource group. name is the name of the
// the Redis cache. parameters is parameters to set patch schedules for Redis // Redis cache. parameters is parameters to set the patching schedule for Redis
// cache. // cache.
func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) { func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true, 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}}}, Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != 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 {
return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate")
} }
@ -119,10 +118,11 @@ func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response)
return 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 // resourceGroupName is the name of the resource group. name is the name of the
// the Redis cache. // redis cache.
func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, name) req, err := client.DeletePreparer(resourceGroupName, name)
if err != nil { if err != nil {
@ -175,16 +175,16 @@ func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return 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 // resourceGroupName is the name of the resource group. name is the name of the
// the Redis cache. // redis cache.
func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) { func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) {
req, err := client.GetPreparer(resourceGroupName, name) req, err := client.GetPreparer(resourceGroupName, name)
if err != nil { if err != nil {

View File

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

View File

@ -14,30 +14,47 @@ package redis
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ package resources
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -39,8 +39,8 @@ const (
type ResourceIdentityType string type ResourceIdentityType string
const ( const (
// SystemAssigned specifies the system assigned state for resource // SystemAssigned specifies the system assigned state for resource identity
// identity type. // type.
SystemAssigned ResourceIdentityType = "SystemAssigned" SystemAssigned ResourceIdentityType = "SystemAssigned"
) )
@ -165,7 +165,7 @@ type DeploymentProperties struct {
Parameters *map[string]interface{} `json:"parameters,omitempty"` Parameters *map[string]interface{} `json:"parameters,omitempty"`
ParametersLink *ParametersLink `json:"parametersLink,omitempty"` ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
Mode DeploymentMode `json:"mode,omitempty"` Mode DeploymentMode `json:"mode,omitempty"`
*DebugSetting `json:"debugSetting,omitempty"` DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
} }
// DeploymentPropertiesExtended is deployment properties with additional // DeploymentPropertiesExtended is deployment properties with additional
@ -182,21 +182,21 @@ type DeploymentPropertiesExtended struct {
Parameters *map[string]interface{} `json:"parameters,omitempty"` Parameters *map[string]interface{} `json:"parameters,omitempty"`
ParametersLink *ParametersLink `json:"parametersLink,omitempty"` ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
Mode DeploymentMode `json:"mode,omitempty"` Mode DeploymentMode `json:"mode,omitempty"`
*DebugSetting `json:"debugSetting,omitempty"` DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
} }
// DeploymentValidateResult is information from validate template deployment // DeploymentValidateResult is information from validate template deployment
// response. // response.
type DeploymentValidateResult struct { type DeploymentValidateResult struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
Error *ResourceManagementErrorWithDetails `json:"error,omitempty"` Error *ManagementErrorWithDetails `json:"error,omitempty"`
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
} }
// ExportTemplateRequest is export resource group template request parameters. // ExportTemplateRequest is export resource group template request parameters.
type ExportTemplateRequest struct { type ExportTemplateRequest struct {
Resources *[]string `json:"resources,omitempty"` ResourcesProperty *[]string `json:"resources,omitempty"`
Options *string `json:"options,omitempty"` Options *string `json:"options,omitempty"`
} }
// GenericResource is resource information. // GenericResource is resource information.
@ -222,6 +222,54 @@ type GenericResourceFilter struct {
Tagvalue *string `json:"tagvalue,omitempty"` 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 // HTTPMessage is
type HTTPMessage struct { type HTTPMessage struct {
Content *map[string]interface{} `json:"content,omitempty"` Content *map[string]interface{} `json:"content,omitempty"`
@ -234,9 +282,36 @@ type Identity struct {
Type ResourceIdentityType `json:"type,omitempty"` 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. // MoveInfo is parameters of move resources.
type MoveInfo struct { type MoveInfo struct {
Resources *[]string `json:"resources,omitempty"` ResourcesProperty *[]string `json:"resources,omitempty"`
TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
} }
@ -283,6 +358,16 @@ func (client ProviderListResult) ProviderListResultPreparer() (*http.Request, er
autorest.WithBaseURL(to.String(client.NextLink))) 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. // ProviderResourceType is resource type managed by the resource provider.
type ProviderResourceType struct { type ProviderResourceType struct {
ResourceType *string `json:"resourceType,omitempty"` ResourceType *string `json:"resourceType,omitempty"`
@ -301,91 +386,6 @@ type Resource struct {
Tags *map[string]*string `json:"tags,omitempty"` 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. // Sku is sKU for the resource.
type Sku struct { type Sku struct {
Name *string `json:"name,omitempty"` Name *string `json:"name,omitempty"`
@ -404,7 +404,7 @@ type SubResource struct {
// TagCount is tag count. // TagCount is tag count.
type TagCount struct { type TagCount struct {
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Value *string `json:"value,omitempty"` Value *int32 `json:"value,omitempty"`
} }
// TagDetails is tag details. // TagDetails is tag details.
@ -439,7 +439,7 @@ func (client TagsListResult) TagsListResultPreparer() (*http.Request, error) {
type TagValue struct { type TagValue struct {
autorest.Response `json:"-"` autorest.Response `json:"-"`
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
TagValueProperty *string `json:"tagValue,omitempty"` TagValue *string `json:"tagValue,omitempty"`
Count *TagCount `json:"count,omitempty"` Count *TagCount `json:"count,omitempty"`
} }

View File

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

View File

@ -14,70 +14,71 @@ package resources
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"net/http"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
"net/http"
) )
// Client is the provides operations for working with resources and resource // GroupClient is the provides operations for working with resources and
// groups. // resource groups.
type Client struct { type GroupClient struct {
ManagementClient ManagementClient
} }
// NewClient creates an instance of the Client client. // NewGroupClient creates an instance of the GroupClient client.
func NewClient(subscriptionID string) Client { func NewGroupClient(subscriptionID string) GroupClient {
return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewClientWithBaseURI creates an instance of the Client client. // NewGroupClientWithBaseURI creates an instance of the GroupClient client.
func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return Client{NewWithBaseURI(baseURI, subscriptionID)} return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CheckExistence checks whether a resource exists. // CheckExistence checks whether a resource exists.
// //
// resourceGroupName is the name of the resource group containing the resource // resourceGroupName is the name of the resource group containing the resource
// to check. The name is case insensitive. resourceProviderNamespace is the // to check. The name is case insensitive. resourceProviderNamespace is the
// resource provider of the resource to check. parentResourcePath is the // resource provider of the resource to check. parentResourcePath is the parent
// parent resource identity. resourceType is the resource type. resourceName // resource identity. resourceType is the resource type. resourceName is the
// is the name of the resource to check whether it exists. // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 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.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != 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) req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
if err != nil { 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) resp, err := client.CheckExistenceSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.CheckExistenceResponder(resp)
if err != nil { 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 return
} }
// CheckExistencePreparer prepares the CheckExistence request. // 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{}{ pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath, "parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName), "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 // CheckExistenceSender sends the CheckExistence request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// CheckExistenceResponder handles the response to the CheckExistence request. The method always // CheckExistenceResponder handles the response to the CheckExistence request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -119,31 +120,31 @@ func (client Client) CheckExistenceResponder(resp *http.Response) (result autore
// CheckExistenceByID checks by ID whether a resource exists. // CheckExistenceByID checks by ID whether a resource exists.
// //
// resourceID is the fully qualified ID of the resource, including the // resourceID is the fully qualified ID of the resource, including the resource
// resource name and resource type. Use the format, // name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} // /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) req, err := client.CheckExistenceByIDPreparer(resourceID)
if err != nil { 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) resp, err := client.CheckExistenceByIDSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.CheckExistenceByIDResponder(resp)
if err != nil { 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 return
} }
// CheckExistenceByIDPreparer prepares the CheckExistenceByID request. // 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{}{ pathParameters := map[string]interface{}{
"resourceId": resourceID, "resourceId": resourceID,
} }
@ -162,13 +163,13 @@ func (client Client) CheckExistenceByIDPreparer(resourceID string) (*http.Reques
// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the // CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always // CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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. // CreateOrUpdate creates a resource. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The // Polling can be canceled by passing the cancel channel argument. The channel
// channel will be used to cancel polling and any outstanding HTTP requests. // will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group for the resource. The // resourceGroupName is the name of the resource group for the resource. The
// name is case insensitive. resourceProviderNamespace is the namespace of // name is case insensitive. resourceProviderNamespace is the namespace of the
// the resource provider. parentResourcePath is the parent resource identity. // resource provider. parentResourcePath is the parent resource identity.
// resourceType is the resource type of the resource to create. resourceName // resourceType is the resource type of the resource to create. resourceName is
// is the name of the resource to create. parameters is parameters for // the name of the resource to create. parameters is parameters for creating or
// creating or updating the resource. // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 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}}}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
{Target: "parameters.Identity", Name: validation.Null, Rule: false, return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdate")
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")
} }
req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel) req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel)
if err != nil { 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) resp, err := client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.CreateOrUpdateResponder(resp)
if err != nil { 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 return
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // 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{}{ pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath, "parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName), "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 // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // 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, return autorest.SendWithSender(client,
req, req,
azure.DoPollForAsynchronous(client.PollingDelay)) 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 // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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 // CreateOrUpdateByID create a resource by ID. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceID is the fully qualified ID of the resource, including the // resourceID is the fully qualified ID of the resource, including the resource
// resource name and resource type. Use the format, // name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} // /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
// parameters is create or update resource parameters. // 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
{Target: "parameters.Identity", Name: validation.Null, Rule: false, return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdateByID")
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")
} }
req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel) req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel)
if err != nil { 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) resp, err := client.CreateOrUpdateByIDSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.CreateOrUpdateByIDResponder(resp)
if err != nil { 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 return
} }
// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. // 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{}{ pathParameters := map[string]interface{}{
"resourceId": resourceID, "resourceId": resourceID,
} }
@ -330,7 +323,7 @@ func (client Client) CreateOrUpdateByIDPreparer(resourceID string, parameters Ge
// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the // CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the
// http.Response Body if it receives an error. // 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, return autorest.SendWithSender(client,
req, req,
azure.DoPollForAsynchronous(client.PollingDelay)) 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 // CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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 // Delete deletes a resource. This method may poll for completion. Polling can
// be canceled by passing the cancel channel argument. The channel will be // be canceled by passing the cancel channel argument. The channel will be used
// used to cancel polling and any outstanding HTTP requests. // to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group that contains the // resourceGroupName is the name of the resource group that contains the
// resource to delete. The name is case insensitive. // resource to delete. The name is case insensitive. resourceProviderNamespace
// resourceProviderNamespace is the namespace of the resource provider. // is the namespace of the resource provider. parentResourcePath is the parent
// parentResourcePath is the parent resource identity. resourceType is the // resource identity. resourceType is the resource type. resourceName is the
// resource type. resourceName is the name of the resource to delete. // 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) { 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 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.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != 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) req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancel)
if err != nil { 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) resp, err := client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.DeleteResponder(resp)
if err != nil { 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 return
} }
// DeletePreparer prepares the Delete request. // 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{}{ pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath, "parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName), "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 // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // 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, return autorest.SendWithSender(client,
req, req,
azure.DoPollForAsynchronous(client.PollingDelay)) 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 // DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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. // DeleteByID deletes a resource by ID. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The // Polling can be canceled by passing the cancel channel argument. The channel
// channel will be used to cancel polling and any outstanding HTTP requests. // will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceID is the fully qualified ID of the resource, including the // resourceID is the fully qualified ID of the resource, including the resource
// resource name and resource type. Use the format, // name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} // /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) req, err := client.DeleteByIDPreparer(resourceID, cancel)
if err != nil { 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) resp, err := client.DeleteByIDSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.DeleteByIDResponder(resp)
if err != nil { 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 return
} }
// DeleteByIDPreparer prepares the DeleteByID request. // 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{}{ pathParameters := map[string]interface{}{
"resourceId": resourceID, "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 // DeleteByIDSender sends the DeleteByID request. The method will close the
// http.Response Body if it receives an error. // 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, return autorest.SendWithSender(client,
req, req,
azure.DoPollForAsynchronous(client.PollingDelay)) 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 // DeleteByIDResponder handles the response to the DeleteByID request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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 // namespace of the resource provider. parentResourcePath is the parent
// resource identity. resourceType is the resource type of the resource. // resource identity. resourceType is the resource type of the resource.
// resourceName is the name of the resource to get. // 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName, {TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 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.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != 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) req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
if err != nil { 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) resp, err := client.GetSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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) result, err = client.GetResponder(resp)
if err != nil { 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 return
} }
// GetPreparer prepares the Get request. // 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{}{ pathParameters := map[string]interface{}{
"parentResourcePath": parentResourcePath, "parentResourcePath": parentResourcePath,
"resourceGroupName": autorest.Encode("path", resourceGroupName), "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 // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// GetResponder handles the response to the Get request. The method always // GetResponder handles the response to the Get request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -572,31 +565,31 @@ func (client Client) GetResponder(resp *http.Response) (result GenericResource,
// GetByID gets a resource by ID. // GetByID gets a resource by ID.
// //
// resourceID is the fully qualified ID of the resource, including the // resourceID is the fully qualified ID of the resource, including the resource
// resource name and resource type. Use the format, // name and resource type. Use the format,
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} // /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) req, err := client.GetByIDPreparer(resourceID)
if err != nil { 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) resp, err := client.GetByIDSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} 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) result, err = client.GetByIDResponder(resp)
if err != nil { 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 return
} }
// GetByIDPreparer prepares the GetByID request. // 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{}{ pathParameters := map[string]interface{}{
"resourceId": resourceID, "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 // GetByIDSender sends the GetByID request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// GetByIDResponder handles the response to the GetByID request. The method always // GetByIDResponder handles the response to the GetByID request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), 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 // 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, // parameter. top is the number of results to return. If null is passed,
// returns all resource groups. // 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) req, err := client.ListPreparer(filter, expand, top)
if err != nil { 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) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure sending request") return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { 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 return
} }
// ListPreparer prepares the List request. // 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{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "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 // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // 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) return autorest.SendWithSender(client, req)
} }
// ListResponder handles the response to the List request. The method always // ListResponder handles the response to the List request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
@ -704,10 +697,10 @@ func (client Client) ListResponder(resp *http.Response) (result ResourceListResu
} }
// ListNextResults retrieves the next set of results, if any. // ListNextResults retrieves the next set of results, if any.
func (client Client) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) { func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
req, err := lastResults.ResourceListResultPreparer() req, err := lastResults.ListResultPreparer()
if err != nil { 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 { if req == nil {
return return
@ -716,12 +709,12 @@ func (client Client) ListNextResults(lastResults ResourceListResult) (result Res
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "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) result, err = client.ListResponder(resp)
if err != nil { 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 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 // MoveResources the resources to move must be in the same source resource
// group. The target resource group may be in a different subscription. When // group. The target resource group may be in a different subscription. When
// moving resources, both the source group and the target group are locked // moving resources, both the source group and the target group are locked for
// for the duration of the operation. Write and delete operations are blocked // the duration of the operation. Write and delete operations are blocked on
// on the groups until the move completes. This method may poll for // the groups until the move completes. This method may poll for completion.
// completion. Polling can be canceled by passing the cancel channel // Polling can be canceled by passing the cancel channel argument. The channel
// argument. The channel will be used to cancel polling and any outstanding // will be used to cancel polling and any outstanding HTTP requests.
// HTTP requests.
// //
// sourceResourceGroupName is the name of the resource group containing the // sourceResourceGroupName is the name of the resource group containing the
// rsources to move. parameters is parameters for moving resources. // 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{ if err := validation.Validate([]validation.Validation{
{TargetValue: sourceResourceGroupName, {TargetValue: sourceResourceGroupName,
Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 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.MinLength, Rule: 1, Chain: nil},
{Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != 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) req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel)
if err != nil { 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) resp, err := client.MoveResourcesSender(req)
if err != nil { if err != nil {
result.Response = resp 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) result, err = client.MoveResourcesResponder(resp)
if err != nil { 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 return
} }
// MoveResourcesPreparer prepares the MoveResources request. // 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{}{ pathParameters := map[string]interface{}{
"sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "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 // MoveResourcesSender sends the MoveResources request. The method will close the
// http.Response Body if it receives an error. // 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, return autorest.SendWithSender(client,
req, req,
azure.DoPollForAsynchronous(client.PollingDelay)) 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 // MoveResourcesResponder handles the response to the MoveResources request. The method always
// closes the http.Response Body. // 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( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),

View File

@ -14,7 +14,7 @@ package resources
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -40,9 +40,9 @@ func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient
return TagsClient{NewWithBaseURI(baseURI, subscriptionID)} return TagsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate the tag name can have a maximum of 512 characters and is // CreateOrUpdate the tag name can have a maximum of 512 characters and is case
// case insensitive. Tag names created by Azure have prefixes of microsoft, // insensitive. Tag names created by Azure have prefixes of microsoft, azure,
// azure, or windows. You cannot create tags with one of these prefixes. // or windows. You cannot create tags with one of these prefixes.
// //
// tagName is the name of the tag to create. // tagName is the name of the tag to create.
func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, err error) { 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // Package scheduler implements the Azure ARM Scheduler service API version
// 2016-03-01. // 2016-03-01.
// //
//
package scheduler package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
@ -17,7 +18,7 @@ package scheduler
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,14 +14,13 @@ package scheduler
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
@ -49,13 +48,6 @@ func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) J
// resourceGroupName is the resource group name. jobCollectionName is the job // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition. // collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", nil, "Failure preparing request") 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. // Delete deletes a job collection. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The // Polling can be canceled by passing the cancel channel argument. The channel
// channel will be used to cancel polling and any outstanding HTTP requests. // will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the resource group name. jobCollectionName is the job // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. // collection name.
@ -182,8 +174,8 @@ func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result
return return
} }
// Disable disables all of the jobs in the job collection. This method may // Disable disables all of the jobs in the job collection. This method may poll
// poll for completion. Polling can be canceled by passing the cancel channel // for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding // argument. The channel will be used to cancel polling and any outstanding
// HTTP requests. // HTTP requests.
// //
@ -551,13 +543,6 @@ func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults Job
// resourceGroupName is the resource group name. jobCollectionName is the job // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition. // collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { 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) req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", nil, "Failure preparing request") 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -45,24 +45,6 @@ func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient
// resourceGroupName is the resource group name. jobCollectionName is the job // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition. // 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) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") 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 // 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 // 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 // [1..100]. skip is the (0-based) index of the job history list from which to
// to begin requesting entries. filter is the filter to apply on the job // begin requesting entries. filter is the filter to apply on the job state.
// state.
func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) { func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: top, {TargetValue: top,
@ -363,8 +344,8 @@ func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobL
// //
// resourceGroupName is the resource group name. jobCollectionName is the job // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. top is the number of job history // 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 // to request, in the of range of [1..100]. skip is the (0-based) index of the
// the job history list from which to begin requesting entries. filter is the // job history list from which to begin requesting entries. filter is the
// filter to apply on the job state. // 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) { 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{ 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 // resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition. // 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) { 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) req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", nil, "Failure preparing request") 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -121,20 +121,20 @@ const (
type JobScheduleDay string type JobScheduleDay string
const ( const (
// JobScheduleDayFriday specifies the job schedule day friday state for // JobScheduleDayFriday specifies the job schedule day friday state for job
// job schedule day. // schedule day.
JobScheduleDayFriday JobScheduleDay = "Friday" JobScheduleDayFriday JobScheduleDay = "Friday"
// JobScheduleDayMonday specifies the job schedule day monday state for // JobScheduleDayMonday specifies the job schedule day monday state for job
// job schedule day. // schedule day.
JobScheduleDayMonday JobScheduleDay = "Monday" JobScheduleDayMonday JobScheduleDay = "Monday"
// JobScheduleDaySaturday specifies the job schedule day saturday state // JobScheduleDaySaturday specifies the job schedule day saturday state for
// for job schedule day.
JobScheduleDaySaturday JobScheduleDay = "Saturday"
// JobScheduleDaySunday specifies the job schedule day sunday state for
// job schedule day. // job schedule day.
JobScheduleDaySaturday JobScheduleDay = "Saturday"
// JobScheduleDaySunday specifies the job schedule day sunday state for job
// schedule day.
JobScheduleDaySunday JobScheduleDay = "Sunday" JobScheduleDaySunday JobScheduleDay = "Sunday"
// JobScheduleDayThursday specifies the job schedule day thursday state // JobScheduleDayThursday specifies the job schedule day thursday state for
// for job schedule day. // job schedule day.
JobScheduleDayThursday JobScheduleDay = "Thursday" JobScheduleDayThursday JobScheduleDay = "Thursday"
// JobScheduleDayTuesday specifies the job schedule day tuesday state for // JobScheduleDayTuesday specifies the job schedule day tuesday state for
// job schedule day. // job schedule day.
@ -485,7 +485,7 @@ type ServiceBusBrokeredMessageProperties struct {
ReplyToSessionID *string `json:"replyToSessionId,omitempty"` ReplyToSessionID *string `json:"replyToSessionId,omitempty"`
ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"` ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"`
SessionID *string `json:"sessionId,omitempty"` SessionID *string `json:"sessionId,omitempty"`
TimeToLive *date.Time `json:"timeToLive,omitempty"` TimeToLive *string `json:"timeToLive,omitempty"`
To *string `json:"to,omitempty"` To *string `json:"to,omitempty"`
ViaPartitionKey *string `json:"viaPartitionKey,omitempty"` ViaPartitionKey *string `json:"viaPartitionKey,omitempty"`
} }

View File

@ -14,30 +14,47 @@ package scheduler
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

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

View File

@ -14,7 +14,7 @@ package servicebus
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -43,9 +43,9 @@ func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) Names
// CreateOrUpdate creates or updates a service namespace. Once created, this // CreateOrUpdate creates or updates a service namespace. Once created, this
// namespace's resource manifest is immutable. This operation is idempotent. // namespace's resource manifest is immutable. This operation is idempotent.
// This method may poll for completion. Polling can be canceled by passing // This method may poll for completion. Polling can be canceled by passing the
// the cancel channel argument. The channel will be used to cancel polling // cancel channel argument. The channel will be used to cancel polling and any
// and any outstanding HTTP requests. // outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. namespaceName is the // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. parameters is parameters supplied to create a namespace // namespace name. parameters is parameters supplied to create a namespace
@ -118,12 +118,12 @@ func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (res
return return
} }
// CreateOrUpdateAuthorizationRule creates or updates an authorization rule // CreateOrUpdateAuthorizationRule creates or updates an authorization rule for
// for a namespace. // a namespace.
// //
// resourceGroupName is the name of the resource group. namespaceName is the // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. authorizationRuleName is namespace authorization rule // namespace name. authorizationRuleName is namespace authorization rule name.
// name. parameters is the shared access authorization rule. // parameters is the shared access authorization rule.
func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
@ -195,9 +195,9 @@ func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *ht
// Delete deletes an existing namespace. This operation also removes all // Delete deletes an existing namespace. This operation also removes all
// associated resources under the namespace. This method may poll for // associated resources under the namespace. This method may poll for
// completion. Polling can be canceled by passing the cancel channel // completion. Polling can be canceled by passing the cancel channel argument.
// argument. The channel will be used to cancel polling and any outstanding // The channel will be used to cancel polling and any outstanding HTTP
// HTTP requests. // requests.
// //
// resourceGroupName is the name of the resource group. namespaceName is the // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. // namespace name.

View File

@ -14,7 +14,7 @@ package servicebus
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -118,8 +118,7 @@ func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. namespaceName is the // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. queueName is the queue name. authorizationRuleName is // namespace name. queueName is the queue name. authorizationRuleName is
// authorization rule name. parameters is the shared access authorization // authorization rule name. parameters is the shared access authorization rule.
// rule.
func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {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 // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. queueName is the queue name. authorizationRuleName is the // namespace name. queueName is the queue name. authorizationRuleName is the
// authorization rule name. parameters is parameters supplied to regenerate // authorization rule name. parameters is parameters supplied to regenerate the
// the authorization rule. // authorization rule.
func (client QueuesClient) RegenerateKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { 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) req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters)
if err != nil { if err != nil {

View File

@ -14,7 +14,7 @@ package servicebus
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package servicebus
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
@ -118,8 +118,7 @@ func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. namespaceName is the // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. topicName is the topic name. authorizationRuleName is // namespace name. topicName is the topic name. authorizationRuleName is
// authorization rule name. parameters is the shared access authorization // authorization rule name. parameters is the shared access authorization rule.
// rule.
func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {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 // resourceGroupName is the name of the resource group. namespaceName is the
// namespace name. topicName is the topic name. authorizationRuleName is the // namespace name. topicName is the topic name. authorizationRuleName is the
// authorization rule name. parameters is parameters supplied to regenerate // authorization rule name. parameters is parameters supplied to regenerate the
// the authorization rule. // authorization rule.
func (client TopicsClient) RegenerateKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { 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) req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters)
if err != nil { if err != nil {

View File

@ -14,30 +14,47 @@ package servicebus
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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}, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil},
{Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil},
Chain: []validation.Constraint{{Target: "parameters.Sku.Tier", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false, {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: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}},
{Target: "parameters.AccountPropertiesCreateParameters.Encryption", Name: validation.Null, Rule: false, {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.KeySource", Name: validation.Null, Rule: true, Chain: nil}}},
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.Services.Blob", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.Services.Blob.LastEnabledTime", Name: validation.ReadOnly, Rule: true, Chain: nil}}},
}},
{Target: "parameters.AccountPropertiesCreateParameters.Encryption.KeySource", Name: validation.Null, Rule: true, Chain: nil},
}},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create") return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create")
} }

View File

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

View File

@ -1,6 +1,7 @@
// Package trafficmanager implements the Azure ARM Trafficmanager service API // Package trafficmanager implements the Azure ARM Trafficmanager service API
// version 2015-11-01. // version 2015-11-01.
// //
//
package trafficmanager package trafficmanager
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
@ -17,7 +18,7 @@ package trafficmanager
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

@ -14,7 +14,7 @@ package trafficmanager
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // 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 // Manager endpoint to be created or updated. profileName is the name of the
// Traffic Manager profile. endpointType is the type of the Traffic Manager // Traffic Manager profile. endpointType is the type of the Traffic Manager
// endpoint to be created or updated. endpointName is the name of the Traffic // 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 to be created or updated. parameters is the Traffic Manager
// Manager endpoint parameters supplied to the CreateOrUpdate operation. // 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) { 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) req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters)
if err != nil { 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 // resourceGroupName is the name of the resource group containing the Traffic
// Manager endpoint to be deleted. profileName is the name of 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 // Manager profile. endpointType is the type of the Traffic Manager endpoint to
// to be deleted. endpointName is the name of the Traffic Manager endpoint to // be deleted. endpointName is the name of the Traffic Manager endpoint to be
// be deleted. // deleted.
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointType string, endpointName string) (result autorest.Response, err error) { 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) req, err := client.DeletePreparer(resourceGroupName, profileName, endpointType, endpointName)
if err != nil { 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 // resourceGroupName is the name of the resource group containing the Traffic
// Manager endpoint to be updated. profileName is the name of 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 // Manager profile. endpointType is the type of the Traffic Manager endpoint to
// to be updated. endpointName is the name of the Traffic Manager endpoint to // be updated. endpointName is the name of the Traffic Manager endpoint to be
// be updated. parameters is the Traffic Manager endpoint parameters supplied // updated. parameters is the Traffic Manager endpoint parameters supplied to
// to the Update operation. // the Update operation.
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { 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) req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters)
if err != nil { if err != nil {

View File

@ -14,7 +14,7 @@ package trafficmanager
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.

View File

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

View File

@ -14,30 +14,47 @@ package trafficmanager
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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 // Changes may cause incorrect behavior and will be lost if the code is
// regenerated. // regenerated.
import ( import (
"bytes"
"fmt" "fmt"
"strings"
) )
const ( const (
major = "7" major = "8"
minor = "0" minor = "0"
patch = "1" patch = "0"
// Always begin a "tag" with a dash (as per http://semver.org) tag = "beta"
tag = "-beta" userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
semVerFormat = "%s.%s.%s%s" )
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. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { 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. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { 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 // 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 { func decodeLabel(label string) string {
res, _ := base64.StdEncoding.DecodeString(label) res, _ := base64.StdEncoding.DecodeString(label)
return string(res) return string(res)

View File

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

View File

@ -27,7 +27,7 @@ const (
DatabaseServerVersion12 = "12.0" DatabaseServerVersion12 = "12.0"
) )
// DatabaseServer represents the set of data recieved from // DatabaseServer represents the set of data received from
// a database server list operation. // a database server list operation.
// //
// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx // https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx
@ -45,7 +45,7 @@ type ListServersResponse struct {
} }
// FirewallRuleCreateParams represents the set of possible // 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 // https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx
type FirewallRuleCreateParams struct { type FirewallRuleCreateParams struct {
@ -55,7 +55,7 @@ type FirewallRuleCreateParams struct {
EndIPAddress string 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. // an Azure database server firewall rule get response.
// //
// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx // 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") 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) publicConfiguration, err := createDockerPublicConfig(dockerPort)
if err != nil { 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" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
@ -18,6 +17,7 @@ import (
// Service. // Service.
type BlobStorageClient struct { type BlobStorageClient struct {
client Client client Client
auth authentication
} }
// A Container is an entry in ContainerListResponse. // A Container is an entry in ContainerListResponse.
@ -123,6 +123,7 @@ type BlobProperties struct {
CopyCompletionTime string `xml:"CopyCompletionTime"` CopyCompletionTime string `xml:"CopyCompletionTime"`
CopyStatusDescription string `xml:"CopyStatusDescription"` CopyStatusDescription string `xml:"CopyStatusDescription"`
LeaseStatus string `xml:"LeaseStatus"` LeaseStatus string `xml:"LeaseStatus"`
LeaseState string `xml:"LeaseState"`
} }
// BlobHeaders contains various properties of a blob and is an entry // BlobHeaders contains various properties of a blob and is an entry
@ -260,7 +261,7 @@ const (
// lease constants. // lease constants.
const ( const (
leaseHeaderPrefix = "x-ms-lease-" leaseHeaderPrefix = "x-ms-lease-"
leaseID = "x-ms-lease-id" headerLeaseID = "x-ms-lease-id"
leaseAction = "x-ms-lease-action" leaseAction = "x-ms-lease-action"
leaseBreakPeriod = "x-ms-lease-break-period" leaseBreakPeriod = "x-ms-lease-break-period"
leaseDuration = "x-ms-lease-duration" leaseDuration = "x-ms-lease-duration"
@ -302,15 +303,8 @@ const (
ContainerAccessTypeContainer ContainerAccessType = "container" ContainerAccessTypeContainer ContainerAccessType = "container"
) )
// ContainerAccessOptions are used when setting ACLs of containers (after creation) // ContainerAccessPolicyDetails are used for SETTING container policies
type ContainerAccessOptions struct { type ContainerAccessPolicyDetails struct {
ContainerAccess ContainerAccessType
Timeout int
LeaseID string
}
// AccessPolicyDetails are used for SETTING policies
type AccessPolicyDetails struct {
ID string ID string
StartTime time.Time StartTime time.Time
ExpiryTime time.Time ExpiryTime time.Time
@ -321,39 +315,8 @@ type AccessPolicyDetails struct {
// ContainerPermissions is used when setting permissions and Access Policies for containers. // ContainerPermissions is used when setting permissions and Access Policies for containers.
type ContainerPermissions struct { type ContainerPermissions struct {
AccessOptions ContainerAccessOptions AccessType ContainerAccessType
AccessPolicy AccessPolicyDetails AccessPolicies []ContainerAccessPolicyDetails
}
// AccessPolicyDetailsXML has specifics about an access policy
// annotated with XML details.
type AccessPolicyDetailsXML struct {
StartTime time.Time `xml:"Start"`
ExpiryTime time.Time `xml:"Expiry"`
Permission string `xml:"Permission"`
}
// SignedIdentifier is a wrapper for a specific policy
type SignedIdentifier struct {
ID string `xml:"Id"`
AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"`
}
// SignedIdentifiers part of the response from GetPermissions call.
type SignedIdentifiers struct {
SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
}
// AccessPolicy is the response type from the GetPermissions call.
type AccessPolicy struct {
SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"`
}
// ContainerAccessResponse is returned for the GetContainerPermissions function.
// This contains both the permission and access policy for the container.
type ContainerAccessResponse struct {
ContainerAccess ContainerAccessType
AccessPolicy SignedIdentifiers
} }
// ContainerAccessHeader references header used when setting/getting container ACL // ContainerAccessHeader references header used when setting/getting container ACL
@ -401,7 +364,7 @@ type BlockResponse struct {
Size int64 `xml:"Size"` Size int64 `xml:"Size"`
} }
// GetPageRangesResponse contains the reponse fields from // GetPageRangesResponse contains the response fields from
// Get Page Ranges call. // Get Page Ranges call.
// //
// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx // 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() headers := b.client.getStandardHeaders()
var out ContainerListResponse 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 { if err != nil {
return out, err 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) { func (b BlobStorageClient) createContainer(name string, access ContainerAccessType) (*storageResponse, error) {
verb := "PUT"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
if access != "" { if access != "" {
headers[ContainerAccessHeader] = string(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 // ContainerExists returns true if a container with given name exists
// on the storage account, otherwise returns false. // on the storage account, otherwise returns false.
func (b BlobStorageClient) ContainerExists(name string) (bool, error) { func (b BlobStorageClient) ContainerExists(name string) (bool, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders() 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 { if resp != nil {
defer resp.body.Close() defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { 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 // 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{ params := url.Values{
"restype": {"container"}, "restype": {"container"},
"comp": {"acl"}, "comp": {"acl"},
} }
if containerPermissions.AccessOptions.Timeout > 0 { if timeout > 0 {
params.Add("timeout", strconv.Itoa(containerPermissions.AccessOptions.Timeout)) params.Add("timeout", strconv.Itoa(timeout))
} }
uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params) uri := b.client.getEndpoint(blobServiceName, pathForContainer(container), params)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
if containerPermissions.AccessOptions.ContainerAccess != "" { if containerPermissions.AccessType != "" {
headers[ContainerAccessHeader] = string(containerPermissions.AccessOptions.ContainerAccess) headers[ContainerAccessHeader] = string(containerPermissions.AccessType)
} }
if containerPermissions.AccessOptions.LeaseID != "" { if leaseID != "" {
headers[leaseID] = containerPermissions.AccessOptions.LeaseID headers[headerLeaseID] = leaseID
} }
// generate the XML for the SharedAccessSignature if required. body, length, err := generateContainerACLpayload(containerPermissions.AccessPolicies)
accessPolicyXML, err := generateAccessPolicy(containerPermissions.AccessPolicy) headers["Content-Length"] = strconv.Itoa(length)
if err != nil { resp, err := b.client.exec(http.MethodPut, uri, headers, body, b.auth)
return err
}
var resp *storageResponse
if accessPolicyXML != "" {
headers["Content-Length"] = strconv.Itoa(len(accessPolicyXML))
resp, err = b.client.exec("PUT", uri, headers, strings.NewReader(accessPolicyXML))
} else {
resp, err = b.client.exec("PUT", uri, headers, nil)
}
if err != nil { if err != nil {
return err return err
} }
if resp != nil { if resp != nil {
defer func() { defer resp.body.Close()
err = resp.body.Close()
}()
if resp.statusCode != http.StatusOK { if resp.statusCode != http.StatusOK {
return errors.New("Unable to set permissions") 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 // If timeout is 0 then it will not be passed to Azure
// leaseID will only be passed to Azure if populated // leaseID will only be passed to Azure if populated
// Returns permissionResponse which is combined permissions and AccessPolicy // 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"}, params := url.Values{"restype": {"container"},
"comp": {"acl"}} "comp": {"acl"}}
@ -565,20 +514,14 @@ func (b BlobStorageClient) GetContainerPermissions(container string, timeout int
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
if leaseID != "" { 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 { if err != nil {
return nil, err return nil, err
} }
defer resp.body.Close()
// containerAccess. Blob, Container, empty
containerAccess := resp.headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader))
defer func() {
err = resp.body.Close()
}()
var out AccessPolicy var out AccessPolicy
err = xmlUnmarshal(resp.body, &out.SignedIdentifiersList) err = xmlUnmarshal(resp.body, &out.SignedIdentifiersList)
@ -586,11 +529,30 @@ func (b BlobStorageClient) GetContainerPermissions(container string, timeout int
return nil, err return nil, err
} }
permissionResponse = &ContainerAccessResponse{} permissionResponse := updateContainerAccessPolicy(out, &resp.headers)
permissionResponse.AccessPolicy = out.SignedIdentifiersList return &permissionResponse, nil
permissionResponse.ContainerAccess = ContainerAccessType(containerAccess) }
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 // 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) { func (b BlobStorageClient) deleteContainer(name string) (*storageResponse, error) {
verb := "DELETE"
uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}}) uri := b.client.getEndpoint(blobServiceName, pathForContainer(name), url.Values{"restype": {"container"}})
headers := b.client.getStandardHeaders() 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, // 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() headers := b.client.getStandardHeaders()
var out BlobListResponse 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 { if err != nil {
return out, err 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 // BlobExists returns true if a blob with given name exists on the specified
// container of the storage account. // container of the storage account.
func (b BlobStorageClient) BlobExists(container, name string) (bool, error) { func (b BlobStorageClient) BlobExists(container, name string) (bool, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
resp, err := b.client.exec(verb, uri, headers, nil) resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth)
if resp != nil { if resp != nil {
defer resp.body.Close() defer resp.body.Close()
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { 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) { 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{}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
if bytesRange != "" { if bytesRange != "" {
headers["Range"] = fmt.Sprintf("bytes=%s", bytesRange) headers["Range"] = fmt.Sprintf("bytes=%s", bytesRange)
@ -725,19 +685,19 @@ func (b BlobStorageClient) getBlobRange(container, name, bytesRange string, extr
headers[k] = v 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 { if err != nil {
return nil, err return nil, err
} }
return resp, 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) { func (b BlobStorageClient) leaseCommonPut(container string, name string, headers map[string]string, expectedStatus int) (http.Header, error) {
params := url.Values{"comp": {"lease"}} params := url.Values{"comp": {"lease"}}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) 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 { if err != nil {
return nil, err 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 // 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) { 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() headers := b.client.getStandardHeaders()
params := url.Values{"comp": {"snapshot"}} 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) 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 { if err != nil {
return nil, err return nil, err
} }
@ -805,7 +766,7 @@ func (b BlobStorageClient) AcquireLease(container string, name string, leaseTime
return "", err return "", err
} }
returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID)) returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
if returnedLeaseID != "" { if returnedLeaseID != "" {
return returnedLeaseID, nil 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) { func (b BlobStorageClient) ChangeLease(container string, name string, currentLeaseID string, proposedLeaseID string) (newLeaseID string, err error) {
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers[leaseAction] = changeLease headers[leaseAction] = changeLease
headers[leaseID] = currentLeaseID headers[headerLeaseID] = currentLeaseID
headers[leaseProposedID] = proposedLeaseID headers[leaseProposedID] = proposedLeaseID
respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusOK) respHeaders, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
@ -864,7 +825,7 @@ func (b BlobStorageClient) ChangeLease(container string, name string, currentLea
return "", err return "", err
} }
newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(leaseID)) newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
if newLeaseID != "" { if newLeaseID != "" {
return newLeaseID, nil 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 { func (b BlobStorageClient) ReleaseLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers[leaseAction] = releaseLease headers[leaseAction] = releaseLease
headers[leaseID] = currentLeaseID headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK) _, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil { 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 { func (b BlobStorageClient) RenewLease(container string, name string, currentLeaseID string) error {
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers[leaseAction] = renewLease headers[leaseAction] = renewLease
headers[leaseID] = currentLeaseID headers[headerLeaseID] = currentLeaseID
_, err := b.leaseCommonPut(container, name, headers, http.StatusOK) _, err := b.leaseCommonPut(container, name, headers, http.StatusOK)
if err != nil { if err != nil {
@ -903,17 +864,16 @@ func (b BlobStorageClient) RenewLease(container string, name string, currentLeas
// GetBlobProperties provides various information about the specified // GetBlobProperties provides various information about the specified
// blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx // blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) { func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error) {
verb := "HEAD"
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
resp, err := b.client.exec(verb, uri, headers, nil) resp, err := b.client.exec(http.MethodHead, uri, headers, nil, b.auth)
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.body.Close() 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 return nil, err
} }
@ -953,6 +913,7 @@ func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobPrope
CopyStatus: resp.headers.Get("x-ms-copy-status"), CopyStatus: resp.headers.Get("x-ms-copy-status"),
BlobType: BlobType(resp.headers.Get("x-ms-blob-type")), BlobType: BlobType(resp.headers.Get("x-ms-blob-type")),
LeaseStatus: resp.headers.Get("x-ms-lease-status"), LeaseStatus: resp.headers.Get("x-ms-lease-status"),
LeaseState: resp.headers.Get("x-ms-lease-state"),
}, nil }, nil
} }
@ -975,7 +936,7 @@ func (b BlobStorageClient) SetBlobProperties(container, name string, blobHeaders
headers[k] = v 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 { if err != nil {
return err 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 { func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[string]string, extraHeaders map[string]string) error {
params := url.Values{"comp": {"metadata"}} params := url.Values{"comp": {"metadata"}}
uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
metadata = b.client.protectUserAgent(metadata)
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
for k, v := range metadata { for k, v := range metadata {
headers[userDefinedMetadataHeaderPrefix+k] = v headers[userDefinedMetadataHeaderPrefix+k] = v
@ -1004,7 +967,7 @@ func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[
headers[k] = v 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 { if err != nil {
return err 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) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), params)
headers := b.client.getStandardHeaders() 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 { if err != nil {
return nil, err 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 { func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, size uint64, blob io.Reader, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name) path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeBlock) headers["x-ms-blob-type"] = string(BlobTypeBlock)
headers["Content-Length"] = fmt.Sprintf("%d", size) headers["Content-Length"] = fmt.Sprintf("%d", size)
@ -1083,7 +1047,7 @@ func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, siz
headers[k] = v 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 { if err != nil {
return err 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 // 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 { 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}}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{"comp": {"block"}, "blockid": {blockID}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeBlock) headers["x-ms-blob-type"] = string(BlobTypeBlock)
headers["Content-Length"] = fmt.Sprintf("%v", size) headers["Content-Length"] = fmt.Sprintf("%v", size)
@ -1120,7 +1085,7 @@ func (b BlobStorageClient) PutBlockWithLength(container, name, blockID string, s
headers[k] = v 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 { if err != nil {
return err return err
} }
@ -1139,7 +1104,7 @@ func (b BlobStorageClient) PutBlockList(container, name string, blocks []Block)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML)) 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 { if err != nil {
return err return err
} }
@ -1156,7 +1121,7 @@ func (b BlobStorageClient) GetBlockList(container, name string, blockType BlockL
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
var out BlockListResponse 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 { if err != nil {
return out, err 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 { func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name) path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypePage) headers["x-ms-blob-type"] = string(BlobTypePage)
headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", size) 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 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 { if err != nil {
return err 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 { 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) path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"page"}}) uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"page"}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypePage) headers["x-ms-blob-type"] = string(BlobTypePage)
headers["x-ms-page-write"] = string(writeType) 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) 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 { if err != nil {
return err return err
} }
@ -1235,13 +1202,13 @@ func (b BlobStorageClient) GetPageRanges(container, name string) (GetPageRangesR
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
var out GetPageRangesResponse 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 { if err != nil {
return out, err return out, err
} }
defer resp.body.Close() 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 return out, err
} }
err = xmlUnmarshal(resp.body, &out) 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 { func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name) path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{}) uri := b.client.getEndpoint(blobServiceName, path, url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeAppend) headers["x-ms-blob-type"] = string(BlobTypeAppend)
@ -1262,7 +1230,7 @@ func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders ma
headers[k] = v 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 { if err != nil {
return err 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 { func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, extraHeaders map[string]string) error {
path := fmt.Sprintf("%s/%s", container, name) path := fmt.Sprintf("%s/%s", container, name)
uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"appendblock"}}) uri := b.client.getEndpoint(blobServiceName, path, url.Values{"comp": {"appendblock"}})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-blob-type"] = string(BlobTypeAppend) headers["x-ms-blob-type"] = string(BlobTypeAppend)
headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) 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 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 { if err != nil {
return err return err
} }
@ -1320,7 +1289,7 @@ func (b BlobStorageClient) StartBlobCopy(container, name, sourceBlob string) (st
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
headers["x-ms-copy-source"] = sourceBlob 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 { if err != nil {
return "", err return "", err
} }
@ -1352,10 +1321,10 @@ func (b BlobStorageClient) AbortBlobCopy(container, name, copyID, currentLeaseID
headers["x-ms-copy-action"] = "abort" headers["x-ms-copy-action"] = "abort"
if currentLeaseID != "" { 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 { if err != nil {
return err 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) { 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{}) uri := b.client.getEndpoint(blobServiceName, pathForBlob(container, name), url.Values{})
extraHeaders = b.client.protectUserAgent(extraHeaders)
headers := b.client.getStandardHeaders() headers := b.client.getStandardHeaders()
for k, v := range extraHeaders { for k, v := range extraHeaders {
headers[k] = v 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 // 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 // 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. // 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. // We only populate the signedIP when it non-empty.
// //
@ -1455,7 +1424,7 @@ func (b BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol(container, name
signedPermissions = permissions signedPermissions = permissions
blobURL = b.GetBlobURL(container, name) blobURL = b.GetBlobURL(container, name)
) )
canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL) canonicalizedResource, err := b.client.buildCanonicalizedResource(blobURL, b.auth)
if err != nil { if err != nil {
return "", err 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") 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). // generate the permissions string (rwd).
// still want the end user API to have bool flags. // still want the end user API to have bool flags.
permissions = "" permissions = ""
if accessPolicy.CanRead { if capd.CanRead {
permissions += "r" permissions += "r"
} }
if accessPolicy.CanWrite { if capd.CanWrite {
permissions += "w" permissions += "w"
} }
if accessPolicy.CanDelete { if capd.CanDelete {
permissions += "d" permissions += "d"
} }
return permissions 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" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"regexp" "runtime"
"sort"
"strconv" "strconv"
"strings" "strings"
) )
@ -43,6 +42,8 @@ const (
storageEmulatorBlob = "127.0.0.1:10000" storageEmulatorBlob = "127.0.0.1:10000"
storageEmulatorTable = "127.0.0.1:10002" storageEmulatorTable = "127.0.0.1:10002"
storageEmulatorQueue = "127.0.0.1:10001" storageEmulatorQueue = "127.0.0.1:10001"
userAgentHeader = "User-Agent"
) )
// Client is the object that needs to be constructed to perform // 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. // requests. If it is nil, http.DefaultClient is used.
HTTPClient *http.Client HTTPClient *http.Client
accountName string accountName string
accountKey []byte accountKey []byte
useHTTPS bool useHTTPS bool
baseURL string UseSharedKeyLite bool
apiVersion string baseURL string
apiVersion string
userAgent string
} }
type storageResponse struct { 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 c, fmt.Errorf("azure: malformed storage account key: %v", err)
} }
return Client{ c = Client{
accountName: accountName, accountName: accountName,
accountKey: key, accountKey: key,
useHTTPS: useHTTPS, useHTTPS: useHTTPS,
baseURL: blobServiceBaseURL, baseURL: blobServiceBaseURL,
apiVersion: apiVersion, apiVersion: apiVersion,
}, nil 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 { 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 // GetBlobService returns a BlobStorageClient which can operate on the blob
// service of the storage account. // service of the storage account.
func (c Client) GetBlobService() BlobStorageClient { 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 // GetQueueService returns a QueueServiceClient which can operate on the queue
// service of the storage account. // service of the storage account.
func (c Client) GetQueueService() QueueServiceClient { 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 // GetTableService returns a TableServiceClient which can operate on the table
// service of the storage account. // service of the storage account.
func (c Client) GetTableService() TableServiceClient { 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 // GetFileService returns a FileServiceClient which can operate on the file
// service of the storage account. // service of the storage account.
func (c Client) GetFileService() FileServiceClient { func (c Client) GetFileService() FileServiceClient {
return FileServiceClient{c} f := FileServiceClient{
} client: 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.client.AddToUserAgent(fileServiceName)
canonicalizedString := c.buildCanonicalizedString(verb, headers, canonicalizedResource) f.auth = sharedKey
return c.createAuthorizationHeader(canonicalizedString), nil if c.UseSharedKeyLite {
f.auth = sharedKeyLite
}
return f
} }
func (c Client) getStandardHeaders() map[string]string { func (c Client) getStandardHeaders() map[string]string {
return map[string]string{ return map[string]string{
"x-ms-version": c.apiVersion, userAgentHeader: c.userAgent,
"x-ms-date": currentTimeRfc1123Formatted(), "x-ms-version": c.apiVersion,
"x-ms-date": currentTimeRfc1123Formatted(),
} }
} }
func (c Client) getCanonicalizedAccountName() string { func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) {
// since we may be trying to access a secondary storage account, we need to headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
// 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
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -428,12 +352,13 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
return nil, err return nil, err
} }
requestID := resp.Header.Get("x-ms-request-id")
if len(respBody) == 0 { if len(respBody) == 0 {
// no error in response body // no error in response body, might happen in HEAD requests
err = fmt.Errorf("storage: service returned without a response body (%s)", resp.Status) err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID)
} else { } else {
// response contains storage service error object, unmarshal // 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 if err != nil { // error unmarshaling the error response
err = errIn err = errIn
} }
@ -452,7 +377,12 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
body: resp.Body}, nil 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) req, err := http.NewRequest(verb, url, body)
for k, v := range headers { for k, v := range headers {
req.Header.Add(k, v) 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 { if len(respBody) == 0 {
// no error in response body // no error in response body, might happen in HEAD requests
err = fmt.Errorf("storage: service returned without a response body (%d)", resp.StatusCode) err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, resp.Header.Get("x-ms-request-id"))
return respToRet, err return respToRet, err
} }
// try unmarshal as odata.error json // 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 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) { func readResponseBody(resp *http.Response) ([]byte, error) {
defer resp.Body.Close() defer resp.Body.Close()
out, err := ioutil.ReadAll(resp.Body) out, err := ioutil.ReadAll(resp.Body)
@ -535,6 +443,15 @@ func serviceErrFromXML(body []byte, statusCode int, requestID string) (AzureStor
return storageErr, nil 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 { func (e AzureStorageServiceError) Error() string {
return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestId=%s, QueryParameterName=%s, QueryParameterValue=%s", 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) 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. // Service.
type QueueServiceClient struct { type QueueServiceClient struct {
client Client client Client
auth authentication
} }
func pathForQueue(queue string) string { return fmt.Sprintf("/%s", queue) } 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 // See https://msdn.microsoft.com/en-us/library/azure/dd179348.aspx
func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error { func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}}) uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
metadata = c.client.protectUserAgent(metadata)
headers := c.client.getStandardHeaders() headers := c.client.getStandardHeaders()
for k, v := range metadata { for k, v := range metadata {
headers[userDefinedMetadataHeaderPrefix+k] = v 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 { if err != nil {
return err return err
} }
@ -179,7 +181,7 @@ func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, err
qm.UserDefinedMetadata = make(map[string]string) qm.UserDefinedMetadata = make(map[string]string)
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}}) uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
headers := c.client.getStandardHeaders() 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 { if err != nil {
return qm, err return qm, err
} }
@ -212,7 +214,7 @@ func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, err
func (c QueueServiceClient) CreateQueue(name string) error { func (c QueueServiceClient) CreateQueue(name string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{}) uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{})
headers := c.client.getStandardHeaders() 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 { if err != nil {
return err return err
} }
@ -225,7 +227,7 @@ func (c QueueServiceClient) CreateQueue(name string) error {
// See https://msdn.microsoft.com/en-us/library/azure/dd179436.aspx // See https://msdn.microsoft.com/en-us/library/azure/dd179436.aspx
func (c QueueServiceClient) DeleteQueue(name string) error { func (c QueueServiceClient) DeleteQueue(name string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{}) 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 { if err != nil {
return err return err
} }
@ -236,7 +238,7 @@ func (c QueueServiceClient) DeleteQueue(name string) error {
// QueueExists returns true if a queue with given name exists. // QueueExists returns true if a queue with given name exists.
func (c QueueServiceClient) QueueExists(name string) (bool, error) { func (c QueueServiceClient) QueueExists(name string) (bool, error) {
uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": {"metadata"}}) 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) { if resp != nil && (resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound) {
return resp.statusCode == http.StatusOK, nil 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 := c.client.getStandardHeaders()
headers["Content-Length"] = strconv.Itoa(nn) 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 { if err != nil {
return err 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 // See https://msdn.microsoft.com/en-us/library/azure/dd179454.aspx
func (c QueueServiceClient) ClearMessages(queue string) error { func (c QueueServiceClient) ClearMessages(queue string) error {
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), url.Values{}) 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 { if err != nil {
return err return err
} }
@ -284,7 +286,7 @@ func (c QueueServiceClient) ClearMessages(queue string) error {
func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParameters) (GetMessagesResponse, error) { func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParameters) (GetMessagesResponse, error) {
var r GetMessagesResponse var r GetMessagesResponse
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters()) 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 { if err != nil {
return r, err 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) { func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParameters) (PeekMessagesResponse, error) {
var r PeekMessagesResponse var r PeekMessagesResponse
uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters()) 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 { if err != nil {
return r, err return r, err
} }
@ -315,7 +317,7 @@ func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParame
func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error { func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error {
uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), url.Values{ uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), url.Values{
"popreceipt": {popReceipt}}) "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 { if err != nil {
return err return err
} }
@ -335,7 +337,7 @@ func (c QueueServiceClient) UpdateMessage(queue string, messageID string, messag
} }
headers := c.client.getStandardHeaders() headers := c.client.getStandardHeaders()
headers["Content-Length"] = fmt.Sprintf("%d", nn) 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 { if err != nil {
return err 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" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"net/http" "net/http"
"net/url" "net/url"
"strconv"
"time"
) )
// TableServiceClient contains operations for Microsoft Azure Table Storage // TableServiceClient contains operations for Microsoft Azure Table Storage
// Service. // Service.
type TableServiceClient struct { type TableServiceClient struct {
client Client client Client
auth authentication
} }
// AzureTable is the typedef of the Azure Table name // AzureTable is the typedef of the Azure Table name
@ -25,6 +29,17 @@ type createTableRequest struct {
TableName string `json:"TableName"` 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 pathForTable(table AzureTable) string { return fmt.Sprintf("%s", table) }
func (c *TableServiceClient) getStandardHeaders() map[string]string { func (c *TableServiceClient) getStandardHeaders() map[string]string {
@ -34,6 +49,7 @@ func (c *TableServiceClient) getStandardHeaders() map[string]string {
"Accept": "application/json;odata=nometadata", "Accept": "application/json;odata=nometadata",
"Accept-Charset": "UTF-8", "Accept-Charset": "UTF-8",
"Content-Type": "application/json", "Content-Type": "application/json",
userAgentHeader: c.client.userAgent,
} }
} }
@ -45,7 +61,7 @@ func (c *TableServiceClient) QueryTables() ([]AzureTable, error) {
headers := c.getStandardHeaders() headers := c.getStandardHeaders()
headers["Content-Length"] = "0" 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 { if err != nil {
return nil, err return nil, err
} }
@ -56,7 +72,9 @@ func (c *TableServiceClient) QueryTables() ([]AzureTable, error) {
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(resp.body) if _, err := buf.ReadFrom(resp.body); err != nil {
return nil, err
}
var respArray queryTablesResponse var respArray queryTablesResponse
if err := json.Unmarshal(buf.Bytes(), &respArray); err != nil { 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()) 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 { if err != nil {
return err return err
@ -114,7 +132,7 @@ func (c *TableServiceClient) DeleteTable(table AzureTable) error {
headers["Content-Length"] = "0" 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 { if err != nil {
return err return err
@ -127,3 +145,114 @@ func (c *TableServiceClient) DeleteTable(table AzureTable) error {
} }
return nil 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" 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 { if err != nil {
return nil, nil, err return nil, nil, err
@ -106,12 +106,9 @@ func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousCo
contToken := extractContinuationTokenFromHeaders(resp.headers) contToken := extractContinuationTokenFromHeaders(resp.headers)
if err != nil {
return nil, contToken, err
}
defer resp.body.Close() 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 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 // The function fails if there is an entity with the same
// PartitionKey and RowKey in the table. // PartitionKey and RowKey in the table.
func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error { func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error {
var err error if sc, err := c.execTable(table, entity, false, http.MethodPost); err != nil {
if sc, err := c.execTable(table, entity, false, "POST"); err != nil {
return checkRespCode(sc, []int{http.StatusCreated}) return checkRespCode(sc, []int{http.StatusCreated})
} }
return err return nil
} }
func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, specifyKeysInURL bool, method string) (int, error) { 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()) headers["Content-Length"] = fmt.Sprintf("%d", buf.Len())
var err error resp, err := c.client.execInternalJSON(method, uri, headers, &buf, c.auth)
var resp *odataResponse
resp, err = c.client.execTable(method, uri, headers, &buf)
if err != nil { if err != nil {
return 0, err 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 // one passed as parameter. The function fails if there is no entity
// with the same PartitionKey and RowKey in the table. // with the same PartitionKey and RowKey in the table.
func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error { func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error {
var err error if sc, err := c.execTable(table, entity, true, http.MethodPut); err != nil {
if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent}) return checkRespCode(sc, []int{http.StatusNoContent})
} }
return err return nil
} }
// MergeEntity merges the contents of an entity with the // 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 // The function fails if there is no entity
// with the same PartitionKey and RowKey in the table. // with the same PartitionKey and RowKey in the table.
func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error { func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil { if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent}) return checkRespCode(sc, []int{http.StatusNoContent})
} }
return err return nil
} }
// DeleteEntityWithoutCheck deletes the entity matching by // DeleteEntityWithoutCheck deletes the entity matching by
@ -214,7 +202,7 @@ func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity,
headers["Content-Length"] = "0" headers["Content-Length"] = "0"
headers["If-Match"] = ifMatch 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 { if err != nil {
return err return err
@ -231,23 +219,19 @@ func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity,
// InsertOrReplaceEntity inserts an entity in the specified table // InsertOrReplaceEntity inserts an entity in the specified table
// or replaced the existing one. // or replaced the existing one.
func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error { func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error {
var err error if sc, err := c.execTable(table, entity, true, http.MethodPut); err != nil {
if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent}) return checkRespCode(sc, []int{http.StatusNoContent})
} }
return err return nil
} }
// InsertOrMergeEntity inserts an entity in the specified table // InsertOrMergeEntity inserts an entity in the specified table
// or merges the existing one. // or merges the existing one.
func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error { func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error {
var err error
if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil { if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
return checkRespCode(sc, []int{http.StatusNoContent}) return checkRespCode(sc, []int{http.StatusNoContent})
} }
return err return nil
} }
func injectPartitionAndRowKeys(entity TableEntity, buf *bytes.Buffer) error { 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 // Reset PartitionKey and RowKey
tEntries[i].SetPartitionKey(pKey) if err := tEntries[i].SetPartitionKey(pKey); err != nil {
tEntries[i].SetRowKey(rKey) return nil, err
}
if err := tEntries[i].SetRowKey(rKey); err != nil {
return nil, err
}
} }
return tEntries, nil 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" "revisionTime": "2017-01-18T16:13:56Z"
}, },
{ {
"checksumSHA1": "fZpMwExfyDmWnqpghxa/75Gmj+w=", "checksumSHA1": "6exKGhZobsx+DV/SMy3nDmuBNm0=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/cdn", "path": "github.com/Azure/azure-sdk-for-go/arm/cdn",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "duGYYmAIPryWG256C+VrJgNy1uU=", "checksumSHA1": "+w9njWehvjvkFK4JHAEtTgvmVgE=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/compute", "path": "github.com/Azure/azure-sdk-for-go/arm/compute",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "Xq4tWiHBsbMI3fh50nZtUJ9oMts=", "checksumSHA1": "JbbZWArn6iqSs+neT5X8AxxH6o0=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/containerregistry", "path": "github.com/Azure/azure-sdk-for-go/arm/containerregistry",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "NJGBM6QQwUQEhaCBZlN9sCoaBZE=", "checksumSHA1": "Amd1JuJVsI9wU3+KI4Ba4jBbxps=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/containerservice", "path": "github.com/Azure/azure-sdk-for-go/arm/containerservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "0984e0641ae43b89283223034574d6465be93bf4",
@ -54,206 +54,206 @@
"checksumSHA1": "NJGBM6QQwUQEhaCBZlN9sCoaBZE=", "checksumSHA1": "NJGBM6QQwUQEhaCBZlN9sCoaBZE=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/eventhub", "path": "github.com/Azure/azure-sdk-for-go/arm/eventhub",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "ULyaZ5HqIzSiehaIWGhcoNSBBsw=", "checksumSHA1": "HqDiYte7S7N9SRNpPJE7U/cDw3c=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/keyvault", "path": "github.com/Azure/azure-sdk-for-go/arm/keyvault",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.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", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/network", "path": "github.com/Azure/azure-sdk-for-go/arm/network",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "WDINcEl8pQOdwTDtmrVcZetD4vo=", "checksumSHA1": "kYdY8/+AxEfjHxwxb9Se7+6OR5Q=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/redis", "path": "github.com/Azure/azure-sdk-for-go/arm/redis",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "uC6vwlBtGNsb+aJJG3m9tdEfHQM=", "checksumSHA1": "TLooEKn4oEwbs7pz3gT6tl/Egq8=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/resources/resources", "path": "github.com/Azure/azure-sdk-for-go/arm/resources/resources",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "gDwsxE1+KRfIswYeYjBcNQiLdIM=", "checksumSHA1": "Ax4KqsWkk27VNh5S7SWNOl21+nk=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/scheduler", "path": "github.com/Azure/azure-sdk-for-go/arm/scheduler",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "42r4OTPQkCr3IHb3YaV/PKK9YWE=", "checksumSHA1": "RvV8PZnxICWRAt3oaPfXhhgkYqA=",
"path": "github.com/Azure/azure-sdk-for-go/arm/servicebus", "path": "github.com/Azure/azure-sdk-for-go/arm/servicebus",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "tJdi+m5G/aMsHYihxqPsfszSe5Y=", "checksumSHA1": "WHuO17KjbzQTSnMBkpPz2dP6KXU=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/arm/storage", "path": "github.com/Azure/azure-sdk-for-go/arm/storage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "S5ZZyUgvr7DFHwMyGsLXOUu4hw0=", "checksumSHA1": "vn4Py70SPOS6Moan+1DhdWOLs3w=",
"path": "github.com/Azure/azure-sdk-for-go/arm/trafficmanager", "path": "github.com/Azure/azure-sdk-for-go/arm/trafficmanager",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "2TUrvoJUkp8W98S9f30Ss1J/Bnk=", "checksumSHA1": "JUEQrLvmfuxKwX/s89mFnzg7jc0=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management", "path": "github.com/Azure/azure-sdk-for-go/management",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "TcQ6KXoBkvUhCYeggJ/bwcz+QaQ=", "checksumSHA1": "BiKKFwRpXzrRxa2odOMYAZZ5xU8=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/affinitygroup", "path": "github.com/Azure/azure-sdk-for-go/management/affinitygroup",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "HfjyhRfmKBsVgWLTOfWVcxe8Z88=", "checksumSHA1": "HfjyhRfmKBsVgWLTOfWVcxe8Z88=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/hostedservice", "path": "github.com/Azure/azure-sdk-for-go/management/hostedservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "4otMhU6xZ41HfmiGZFYtV93GdcI=", "checksumSHA1": "4otMhU6xZ41HfmiGZFYtV93GdcI=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/location", "path": "github.com/Azure/azure-sdk-for-go/management/location",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "hxivwm3D13cqFGOlOS3q8HD7DN0=", "checksumSHA1": "hxivwm3D13cqFGOlOS3q8HD7DN0=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/networksecuritygroup", "path": "github.com/Azure/azure-sdk-for-go/management/networksecuritygroup",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "XzrPv8SWFBYdh5oie+NGysqnLIM=", "checksumSHA1": "XzrPv8SWFBYdh5oie+NGysqnLIM=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/osimage", "path": "github.com/Azure/azure-sdk-for-go/management/osimage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "hzwziaU5QlMlFcFPdbEmW18oV3Y=", "checksumSHA1": "aTvFD5aYYXC1bLaVMlHWJImkHDg=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/sql", "path": "github.com/Azure/azure-sdk-for-go/management/sql",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "YoAhDE0X6hSFuPpXbpfqcTC0Zvw=", "checksumSHA1": "YoAhDE0X6hSFuPpXbpfqcTC0Zvw=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/storageservice", "path": "github.com/Azure/azure-sdk-for-go/management/storageservice",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "6xEiZL4a9rr5YbnY0RdzuzhEF1Q=", "checksumSHA1": "6xEiZL4a9rr5YbnY0RdzuzhEF1Q=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachine", "path": "github.com/Azure/azure-sdk-for-go/management/virtualmachine",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "xcBM3zQtfcE3VHNBACJJGEesCBI=", "checksumSHA1": "xcBM3zQtfcE3VHNBACJJGEesCBI=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk", "path": "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "0bfdkDZ2JFV7bol6GQFfC0g+lP4=", "checksumSHA1": "0bfdkDZ2JFV7bol6GQFfC0g+lP4=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage", "path": "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "IhjDqm84VDVSIoHyiGvUzuljG3s=", "checksumSHA1": "IhjDqm84VDVSIoHyiGvUzuljG3s=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/virtualnetwork", "path": "github.com/Azure/azure-sdk-for-go/management/virtualnetwork",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "+ykSkHo40/f6VK6/zXDqzF8Lh14=", "checksumSHA1": "Tb6BY70kI9ZclWIjjMhGzkdJbn0=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/management/vmutils", "path": "github.com/Azure/azure-sdk-for-go/management/vmutils",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "Nbn9LDCCDU8HdiTeiEocwLDGIRo=", "checksumSHA1": "rK3ght7KTtHGdm0V4+U7fv9+tUU=",
"comment": "v2.1.1-beta-8-gca4d906", "comment": "v2.1.1-beta-8-gca4d906",
"path": "github.com/Azure/azure-sdk-for-go/storage", "path": "github.com/Azure/azure-sdk-for-go/storage",
"revision": "0984e0641ae43b89283223034574d6465be93bf4", "revision": "8e625d1702a32d01cef05a9252198d231c4af113",
"revisionTime": "2016-11-30T22:29:01Z", "revisionTime": "2017-02-08T01:01:20Z",
"version": "v7.0.1-beta", "version": "v8.0.1-beta",
"versionExact": "v7.0.1-beta" "versionExact": "v8.0.1-beta"
}, },
{ {
"checksumSHA1": "23FJUX+AInYeEM2hoUMvYZtXZd4=", "checksumSHA1": "23FJUX+AInYeEM2hoUMvYZtXZd4=",