Commit b1b930a3 authored by Pengfei Ni's avatar Pengfei Ni

Upgrade Azure Go SDK to v14.6.0

parent 3dbcd1dd
...@@ -13,13 +13,12 @@ filegroup( ...@@ -13,13 +13,12 @@ filegroup(
"//vendor/bitbucket.org/ww/goautoneg:all-srcs", "//vendor/bitbucket.org/ww/goautoneg:all-srcs",
"//vendor/cloud.google.com/go/compute/metadata:all-srcs", "//vendor/cloud.google.com/go/compute/metadata:all-srcs",
"//vendor/cloud.google.com/go/internal:all-srcs", "//vendor/cloud.google.com/go/internal:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/storage:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/version:all-srcs",
"//vendor/github.com/Azure/go-ansiterm:all-srcs", "//vendor/github.com/Azure/go-ansiterm:all-srcs",
"//vendor/github.com/Azure/go-autorest/autorest:all-srcs", "//vendor/github.com/Azure/go-autorest/autorest:all-srcs",
"//vendor/github.com/JeffAshton/win_pdh:all-srcs", "//vendor/github.com/JeffAshton/win_pdh:all-srcs",
......
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"availabilitysets.go",
"client.go",
"containerservices.go",
"disks.go",
"images.go",
"models.go",
"resourceskus.go",
"snapshots.go",
"usage.go",
"version.go",
"virtualmachineextensionimages.go",
"virtualmachineextensions.go",
"virtualmachineimages.go",
"virtualmachineruncommands.go",
"virtualmachines.go",
"virtualmachinescalesetextensions.go",
"virtualmachinescalesetrollingupgrades.go",
"virtualmachinescalesets.go",
"virtualmachinescalesetvms.go",
"virtualmachinesizes.go",
],
importpath = "github.com/Azure/azure-sdk-for-go/arm/compute",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/validation:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
// Package compute implements the Azure ARM Compute service API version .
//
// Compute Client
//
// Deprecated: Please instead use github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-03-30/compute
package compute
// 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Compute
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Compute.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
package compute
// 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.
// 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"
)
// ResourceSkusClient is the compute Client
type ResourceSkusClient struct {
ManagementClient
}
// NewResourceSkusClient creates an instance of the ResourceSkusClient client.
func NewResourceSkusClient(subscriptionID string) ResourceSkusClient {
return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient client.
func NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient {
return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List gets the list of Microsoft.Compute SKUs available for your Subscription.
func (client ResourceSkusClient) List() (result ResourceSkusResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ResourceSkusClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ResourceSkusClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ResourceSkusClient) ListResponder(resp *http.Response) (result ResourceSkusResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ResourceSkusClient) ListNextResults(lastResults ResourceSkusResult) (result ResourceSkusResult, err error) {
req, err := lastResults.ResourceSkusResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client ResourceSkusClient) ListComplete(cancel <-chan struct{}) (<-chan ResourceSku, <-chan error) {
resultChan := make(chan ResourceSku)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
package compute
// 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// UsageClient is the compute Client
type UsageClient struct {
ManagementClient
}
// NewUsageClient creates an instance of the UsageClient client.
func NewUsageClient(subscriptionID string) UsageClient {
return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageClientWithBaseURI creates an instance of the UsageClient client.
func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List gets, for the specified location, the current compute resource usage information as well as the limits for
// compute resources under the subscription.
//
// location is the location for which resource usage is queried.
func (client UsageClient) List(location string) (result ListUsagesResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.UsageClient", "List")
}
req, err := client.ListPreparer(location)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageClient) ListPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client UsageClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
req, err := lastResults.ListUsagesResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client UsageClient) ListComplete(location string, cancel <-chan struct{}) (<-chan Usage, <-chan error) {
resultChan := make(chan Usage)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(location)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
package compute
// 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// VirtualMachineRunCommandsClient is the compute Client
type VirtualMachineRunCommandsClient struct {
ManagementClient
}
// NewVirtualMachineRunCommandsClient creates an instance of the VirtualMachineRunCommandsClient client.
func NewVirtualMachineRunCommandsClient(subscriptionID string) VirtualMachineRunCommandsClient {
return NewVirtualMachineRunCommandsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewVirtualMachineRunCommandsClientWithBaseURI creates an instance of the VirtualMachineRunCommandsClient client.
func NewVirtualMachineRunCommandsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineRunCommandsClient {
return VirtualMachineRunCommandsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets specific run command for a subscription in a location.
//
// location is the location upon which run commands is queried. commandID is the command id.
func (client VirtualMachineRunCommandsClient) Get(location string, commandID string) (result RunCommandDocument, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineRunCommandsClient", "Get")
}
req, err := client.GetPreparer(location, commandID)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client VirtualMachineRunCommandsClient) GetPreparer(location string, commandID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"commandId": autorest.Encode("path", commandID),
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineRunCommandsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client VirtualMachineRunCommandsClient) GetResponder(resp *http.Response) (result RunCommandDocument, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List lists all available run commands for a subscription in a location.
//
// location is the location upon which run commands is queried.
func (client VirtualMachineRunCommandsClient) List(location string) (result RunCommandListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineRunCommandsClient", "List")
}
req, err := client.ListPreparer(location)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client VirtualMachineRunCommandsClient) ListPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineRunCommandsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client VirtualMachineRunCommandsClient) ListResponder(resp *http.Response) (result RunCommandListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client VirtualMachineRunCommandsClient) ListNextResults(lastResults RunCommandListResult) (result RunCommandListResult, err error) {
req, err := lastResults.RunCommandListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client VirtualMachineRunCommandsClient) ListComplete(location string, cancel <-chan struct{}) (<-chan RunCommandDocumentBase, <-chan error) {
resultChan := make(chan RunCommandDocumentBase)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(location)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
package compute
// 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.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// VirtualMachineSizesClient is the compute Client
type VirtualMachineSizesClient struct {
ManagementClient
}
// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client.
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client.
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all available virtual machine sizes for a subscription in a location.
//
// location is the location upon which virtual-machine-sizes is queried.
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineSizesClient", "List")
}
req, err := client.ListPreparer(location)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Package disk implements the Azure ARM Disk service API version
// 2016-04-30-preview.
//
// The Disk Resource Provider Client.
//
// Deprecated: Please instead use github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2016-04-30-preview/compute
package disk
// 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.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Disk
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Disk.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
package disk
// 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.1.0.0
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v12.4.0-beta arm-disk/2016-04-30-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v12.4.0-beta"
}
...@@ -28,6 +28,7 @@ go_library( ...@@ -28,6 +28,7 @@ go_library(
importpath = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute", importpath = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/azure-sdk-for-go/version:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library",
......
...@@ -43,9 +43,9 @@ func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string ...@@ -43,9 +43,9 @@ func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string
// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and // CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and
// agents. // agents.
// //
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service in // resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
// the specified subscription and resource group. parameters is parameters supplied to the Create or Update a Container // in the specified subscription and resource group. parameters is parameters supplied to the Create or Update a
// Service operation. // Container Service operation.
func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) { func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
...@@ -62,8 +62,7 @@ func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resour ...@@ -62,8 +62,7 @@ func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resour
{Target: "parameters.ContainerServiceProperties.WindowsProfile", Name: validation.Null, Rule: false, {Target: "parameters.ContainerServiceProperties.WindowsProfile", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}},
{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, {Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil},
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Pattern, Rule: `^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$`, Chain: nil}}},
}}, }},
{Target: "parameters.ContainerServiceProperties.LinuxProfile", Name: validation.Null, Rule: true, {Target: "parameters.ContainerServiceProperties.LinuxProfile", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true,
...@@ -76,7 +75,7 @@ func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resour ...@@ -76,7 +75,7 @@ func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resour
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.ContainerServicesClient", "CreateOrUpdate") return result, validation.NewError("compute.ContainerServicesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters)
...@@ -150,8 +149,8 @@ func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Respons ...@@ -150,8 +149,8 @@ func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Respons
// availability sets. All the other resources created with the container service are part of the same resource group // availability sets. All the other resources created with the container service are part of the same resource group
// and can be deleted individually. // and can be deleted individually.
// //
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service in // resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
// the specified subscription and resource group. // in the specified subscription and resource group.
func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) { func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName) req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName)
if err != nil { if err != nil {
...@@ -220,8 +219,8 @@ func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (resu ...@@ -220,8 +219,8 @@ func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (resu
// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters // operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters
// and agents. // and agents.
// //
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service in // resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
// the specified subscription and resource group. // in the specified subscription and resource group.
func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) { func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName) req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName)
if err != nil { if err != nil {
......
...@@ -42,9 +42,10 @@ func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClien ...@@ -42,9 +42,10 @@ func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClien
// CreateOrUpdate creates or updates a disk. // CreateOrUpdate creates or updates a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. disk is disk object supplied in the body of the Put disk operation. // 0-9 and _. The maximum name length is 80 characters. disk is disk object supplied in the body of the Put disk
// operation.
func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) { func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: disk, {TargetValue: disk,
...@@ -64,7 +65,7 @@ func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName ...@@ -64,7 +65,7 @@ func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.DisksClient", "CreateOrUpdate") return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk)
...@@ -135,9 +136,9 @@ func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result D ...@@ -135,9 +136,9 @@ func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result D
// Delete deletes a disk. // Delete deletes a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. // 0-9 and _. The maximum name length is 80 characters.
func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) { func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, diskName) req, err := client.DeletePreparer(ctx, resourceGroupName, diskName)
if err != nil { if err != nil {
...@@ -205,9 +206,9 @@ func (client DisksClient) DeleteResponder(resp *http.Response) (result Operation ...@@ -205,9 +206,9 @@ func (client DisksClient) DeleteResponder(resp *http.Response) (result Operation
// Get gets information about a disk. // Get gets information about a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. // 0-9 and _. The maximum name length is 80 characters.
func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) { func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, diskName) req, err := client.GetPreparer(ctx, resourceGroupName, diskName)
if err != nil { if err != nil {
...@@ -273,15 +274,15 @@ func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err er ...@@ -273,15 +274,15 @@ func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err er
// GrantAccess grants access to a disk. // GrantAccess grants access to a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. grantAccessData is access data object supplied in the body of the get disk // 0-9 and _. The maximum name length is 80 characters. grantAccessData is access data object supplied in the body
// access operation. // of the get disk access operation.
func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) { func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: grantAccessData, {TargetValue: grantAccessData,
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.DisksClient", "GrantAccess") return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error())
} }
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData) req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData)
...@@ -535,9 +536,9 @@ func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resou ...@@ -535,9 +536,9 @@ func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resou
// RevokeAccess revokes access to a disk. // RevokeAccess revokes access to a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. // 0-9 and _. The maximum name length is 80 characters.
func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) { func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) {
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName) req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName)
if err != nil { if err != nil {
...@@ -605,9 +606,10 @@ func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result Ope ...@@ -605,9 +606,10 @@ func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result Ope
// Update updates (patches) a disk. // Update updates (patches) a disk.
// //
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being created. // resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
// The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The // created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
// maximum name length is 80 characters. disk is disk object supplied in the body of the Patch disk operation. // 0-9 and _. The maximum name length is 80 characters. disk is disk object supplied in the body of the Patch disk
// operation.
func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) { func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) {
req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk) req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk)
if err != nil { if err != nil {
......
...@@ -42,8 +42,8 @@ func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesCli ...@@ -42,8 +42,8 @@ func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesCli
// CreateOrUpdate create or update an image. // CreateOrUpdate create or update an image.
// //
// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is parameters // resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is
// supplied to the Create Image operation. // parameters supplied to the Create Image operation.
func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) { func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
...@@ -51,7 +51,7 @@ func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName ...@@ -51,7 +51,7 @@ func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName
Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: true, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate") return result, validation.NewError("compute.ImagesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters)
......
...@@ -43,13 +43,13 @@ func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) Log ...@@ -43,13 +43,13 @@ func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) Log
// ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to // ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to
// show throttling activities. // show throttling activities.
// //
// parameters is parameters supplied to the LogAnalytics getRequestRateByInterval Api. location is the location upon // parameters is parameters supplied to the LogAnalytics getRequestRateByInterval Api. location is the location
// which virtual-machine-sizes is queried. // upon which virtual-machine-sizes is queried.
func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, err error) { func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, 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.LogAnalyticsClient", "ExportRequestRateByInterval") return result, validation.NewError("compute.LogAnalyticsClient", "ExportRequestRateByInterval", err.Error())
} }
req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location) req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location)
...@@ -120,13 +120,13 @@ func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http ...@@ -120,13 +120,13 @@ func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http
// ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time // ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time
// window. // window.
// //
// parameters is parameters supplied to the LogAnalytics getThrottledRequests Api. location is the location upon which // parameters is parameters supplied to the LogAnalytics getThrottledRequests Api. location is the location upon
// virtual-machine-sizes is queried. // which virtual-machine-sizes is queried.
func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, err error) { func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, 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.LogAnalyticsClient", "ExportThrottledRequests") return result, validation.NewError("compute.LogAnalyticsClient", "ExportThrottledRequests", err.Error())
} }
req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location) req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location)
......
...@@ -42,9 +42,10 @@ func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) Snapsh ...@@ -42,9 +42,10 @@ func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) Snapsh
// CreateOrUpdate creates or updates a snapshot. // CreateOrUpdate creates or updates a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. snapshot is snapshot object supplied in the body of the Put disk operation. // A-Z, 0-9 and _. The max name length is 80 characters. snapshot is snapshot object supplied in the body of the
// Put disk operation.
func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) { func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: snapshot, {TargetValue: snapshot,
...@@ -64,7 +65,7 @@ func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupN ...@@ -64,7 +65,7 @@ func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupN
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.SnapshotsClient", "CreateOrUpdate") return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
...@@ -135,9 +136,9 @@ func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (resu ...@@ -135,9 +136,9 @@ func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (resu
// Delete deletes a snapshot. // Delete deletes a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. // A-Z, 0-9 and _. The max name length is 80 characters.
func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName) req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName)
if err != nil { if err != nil {
...@@ -205,9 +206,9 @@ func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result Opera ...@@ -205,9 +206,9 @@ func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result Opera
// Get gets information about a snapshot. // Get gets information about a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. // A-Z, 0-9 and _. The max name length is 80 characters.
func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) { func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName) req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName)
if err != nil { if err != nil {
...@@ -273,15 +274,15 @@ func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot ...@@ -273,15 +274,15 @@ func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot
// GrantAccess grants access to a snapshot. // GrantAccess grants access to a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. grantAccessData is access data object supplied in the body of the get snapshot // A-Z, 0-9 and _. The max name length is 80 characters. grantAccessData is access data object supplied in the body
// access operation. // of the get snapshot access operation.
func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) { func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: grantAccessData, {TargetValue: grantAccessData,
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.SnapshotsClient", "GrantAccess") return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error())
} }
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData) req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData)
...@@ -535,9 +536,9 @@ func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, r ...@@ -535,9 +536,9 @@ func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, r
// RevokeAccess revokes access to a snapshot. // RevokeAccess revokes access to a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. // A-Z, 0-9 and _. The max name length is 80 characters.
func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) { func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) {
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName) req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName)
if err != nil { if err != nil {
...@@ -605,10 +606,10 @@ func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result ...@@ -605,10 +606,10 @@ func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result
// Update updates (patches) a snapshot. // Update updates (patches) a snapshot.
// //
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being created. // resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
// The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. // created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
// The max name length is 80 characters. snapshot is snapshot object supplied in the body of the Patch snapshot // A-Z, 0-9 and _. The max name length is 80 characters. snapshot is snapshot object supplied in the body of the
// operation. // Patch snapshot operation.
func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) { func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) {
req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot) req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
if err != nil { if err != nil {
......
...@@ -48,7 +48,7 @@ func (client UsageClient) List(ctx context.Context, location string) (result Lis ...@@ -48,7 +48,7 @@ func (client UsageClient) List(ctx context.Context, location string) (result Lis
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.UsageClient", "List") return result, validation.NewError("compute.UsageClient", "List", err.Error())
} }
result.fn = client.listNextResults result.fn = client.listNextResults
......
package compute package compute
import "github.com/Azure/azure-sdk-for-go/version"
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -19,10 +21,10 @@ package compute ...@@ -19,10 +21,10 @@ package compute
// 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 "Azure-SDK-For-Go/v12.4.0-beta arm-compute/" return "Azure-SDK-For-Go/" + version.Number + " compute/2017-12-01"
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { func Version() string {
return "v12.4.0-beta" return version.Number
} }
...@@ -41,9 +41,9 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID ...@@ -41,9 +41,9 @@ func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID
// CreateOrUpdate the operation to create or update the extension. // CreateOrUpdate the operation to create or update the extension.
// //
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the extension // resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
// should be create or updated. VMExtensionName is the name of the virtual machine extension. extensionParameters is // extension should be create or updated. VMExtensionName is the name of the virtual machine extension.
// parameters supplied to the Create Virtual Machine Extension operation. // extensionParameters is parameters supplied to the Create Virtual Machine Extension operation.
func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) { func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
if err != nil { if err != nil {
...@@ -114,8 +114,8 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http. ...@@ -114,8 +114,8 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.
// Delete the operation to delete the extension. // Delete the operation to delete the extension.
// //
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the extension // resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
// should be deleted. VMExtensionName is the name of the virtual machine extension. // extension should be deleted. VMExtensionName is the name of the virtual machine extension.
func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) { func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName) req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName)
if err != nil { if err != nil {
...@@ -185,8 +185,8 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response ...@@ -185,8 +185,8 @@ 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 the virtual machine containing the // resourceGroupName is the name of the resource group. VMName is the name of the virtual machine containing the
// extension. VMExtensionName is the name of the virtual machine extension. expand is the expand expression to apply on // extension. VMExtensionName is the name of the virtual machine extension. expand is the expand expression to
// the operation. // apply on the operation.
func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) { func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID str ...@@ -41,8 +41,8 @@ func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID str
// Get gets a virtual machine image. // Get gets a virtual machine image.
// //
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid image // location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
// publisher offer. skus is a valid image SKU. version is a valid image SKU version. // image publisher offer. skus is a valid image SKU. version is a valid image SKU version.
func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) { func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) {
req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version) req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version)
if err != nil { if err != nil {
...@@ -111,8 +111,8 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu ...@@ -111,8 +111,8 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu
// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. // List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
// //
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid image // location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
// publisher offer. skus is a valid image SKU. filter is the filter to apply on the operation. // image publisher offer. skus is a valid image SKU. filter is the filter to apply on the operation.
func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby) req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby)
if err != nil { if err != nil {
...@@ -320,8 +320,8 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp ...@@ -320,8 +320,8 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp
// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer. // ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
// //
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid image // location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
// publisher offer. // image publisher offer.
func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) {
req, err := client.ListSkusPreparer(ctx, location, publisherName, offer) req, err := client.ListSkusPreparer(ctx, location, publisherName, offer)
if err != nil { if err != nil {
......
...@@ -47,7 +47,7 @@ func (client VirtualMachineRunCommandsClient) Get(ctx context.Context, location ...@@ -47,7 +47,7 @@ func (client VirtualMachineRunCommandsClient) Get(ctx context.Context, location
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.VirtualMachineRunCommandsClient", "Get") return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "Get", err.Error())
} }
req, err := client.GetPreparer(ctx, location, commandID) req, err := client.GetPreparer(ctx, location, commandID)
...@@ -119,7 +119,7 @@ func (client VirtualMachineRunCommandsClient) List(ctx context.Context, location ...@@ -119,7 +119,7 @@ func (client VirtualMachineRunCommandsClient) List(ctx context.Context, location
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.VirtualMachineRunCommandsClient", "List") return result, validation.NewError("compute.VirtualMachineRunCommandsClient", "List", err.Error())
} }
result.fn = client.listNextResults result.fn = client.listNextResults
......
...@@ -51,7 +51,7 @@ func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupNa ...@@ -51,7 +51,7 @@ func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupNa
Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil}, Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "Capture") return result, validation.NewError("compute.VirtualMachinesClient", "Capture", err.Error())
} }
req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters) req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters)
...@@ -212,7 +212,7 @@ func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resource ...@@ -212,7 +212,7 @@ func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resource
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate") return result, validation.NewError("compute.VirtualMachinesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters)
...@@ -486,8 +486,8 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re ...@@ -486,8 +486,8 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re
// Get retrieves information about the model view or the instance view of a virtual machine. // Get retrieves information about the model view or the instance view of a virtual machine.
// //
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. expand is the expand // resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. expand is the
// expression to apply on the operation. // expand expression to apply on the operation.
func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand)
if err != nil { if err != nil {
...@@ -1152,7 +1152,7 @@ func (client VirtualMachinesClient) RunCommand(ctx context.Context, resourceGrou ...@@ -1152,7 +1152,7 @@ func (client VirtualMachinesClient) RunCommand(ctx context.Context, resourceGrou
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.CommandID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "parameters.CommandID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "RunCommand") return result, validation.NewError("compute.VirtualMachinesClient", "RunCommand", err.Error())
} }
req, err := client.RunCommandPreparer(ctx, resourceGroupName, VMName, parameters) req, err := client.RunCommandPreparer(ctx, resourceGroupName, VMName, parameters)
......
...@@ -185,9 +185,9 @@ func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http. ...@@ -185,9 +185,9 @@ func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http.
// Get the operation to get the extension. // Get the operation to get the extension.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing the // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing
// extension. vmssExtensionName is the name of the VM scale set extension. expand is the expand expression to apply on // the extension. vmssExtensionName is the name of the VM scale set extension. expand is the expand expression to
// the operation. // apply on the operation.
func (client VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result VirtualMachineScaleSetExtension, err error) { func (client VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (result VirtualMachineScaleSetExtension, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, expand)
if err != nil { if err != nil {
...@@ -257,8 +257,8 @@ func (client VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Res ...@@ -257,8 +257,8 @@ func (client VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Res
// List gets a list of all extensions in a VM scale set. // List gets a list of all extensions in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing the // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set containing
// extension. // the extension.
func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) { func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) {
result.fn = client.listNextResults result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName) req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName)
......
...@@ -65,7 +65,7 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, ...@@ -65,7 +65,7 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context,
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate") return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, parameters)
...@@ -137,8 +137,8 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R ...@@ -137,8 +137,8 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R
// Deallocate deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the // Deallocate deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the
// compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates. // compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) { func (client VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) {
req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -279,13 +279,13 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) ...@@ -279,13 +279,13 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response)
// DeleteInstances deletes virtual machines in a VM scale set. // DeleteInstances deletes virtual machines in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsDeleteInstancesFuture, err error) { func (client VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsDeleteInstancesFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: VMInstanceIDs, {TargetValue: VMInstanceIDs,
Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances") return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "DeleteInstances", err.Error())
} }
req, err := client.DeleteInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.DeleteInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
...@@ -838,8 +838,8 @@ func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context ...@@ -838,8 +838,8 @@ func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context
// PowerOff power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and // PowerOff power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and
// you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. // you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPowerOffFuture, err error) { func (client VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPowerOffFuture, err error) {
req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -912,8 +912,8 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons ...@@ -912,8 +912,8 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons
// Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set. // Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageFuture, err error) { func (client VirtualMachineScaleSetsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageFuture, err error) {
req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -987,8 +987,8 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response ...@@ -987,8 +987,8 @@ func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response
// ReimageAll reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation // ReimageAll reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation
// is only supported for managed disks. // is only supported for managed disks.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageAllFuture, err error) { func (client VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsReimageAllFuture, err error) {
req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -1061,8 +1061,8 @@ func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Respo ...@@ -1061,8 +1061,8 @@ func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Respo
// Restart restarts one or more virtual machines in a VM scale set. // Restart restarts one or more virtual machines in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRestartFuture, err error) { func (client VirtualMachineScaleSetsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRestartFuture, err error) {
req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -1135,8 +1135,8 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response ...@@ -1135,8 +1135,8 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response
// Start starts one or more virtual machines in a VM scale set. // Start starts one or more virtual machines in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsStartFuture, err error) { func (client VirtualMachineScaleSetsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsStartFuture, err error) {
req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
if err != nil { if err != nil {
...@@ -1280,13 +1280,13 @@ func (client VirtualMachineScaleSetsClient) UpdateResponder(resp *http.Response) ...@@ -1280,13 +1280,13 @@ func (client VirtualMachineScaleSetsClient) UpdateResponder(resp *http.Response)
// UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. VMInstanceIDs // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
// is a list of virtual machine instance IDs from the VM scale set. // VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
func (client VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) { func (client VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: VMInstanceIDs, {TargetValue: VMInstanceIDs,
Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances") return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "UpdateInstances", err.Error())
} }
req, err := client.UpdateInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs) req, err := client.UpdateInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
......
...@@ -44,8 +44,8 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI ...@@ -44,8 +44,8 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
// compute resources it uses. You are not billed for the compute resources of this virtual machine once it is // compute resources it uses. You are not billed for the compute resources of this virtual machine once it is
// deallocated. // deallocated.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeallocateFuture, err error) { func (client VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeallocateFuture, err error) {
req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -114,8 +114,8 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res ...@@ -114,8 +114,8 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res
// Delete deletes a virtual machine from a VM scale set. // Delete deletes a virtual machine from a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeleteFuture, err error) { func (client VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -184,8 +184,8 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons ...@@ -184,8 +184,8 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons
// Get gets a virtual machine from a VM scale set. // Get gets a virtual machine from a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { func (client VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -252,8 +252,8 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) ...@@ -252,8 +252,8 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response)
// GetInstanceView gets the status of a virtual machine from a VM scale set. // GetInstanceView gets the status of a virtual machine from a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { func (client VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) {
req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -426,8 +426,8 @@ func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, ...@@ -426,8 +426,8 @@ func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context,
// PowerOff power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are // PowerOff power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are
// getting charged for the resources. Instead, use deallocate to release resources and avoid charges. // getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) { func (client VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) {
req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -496,8 +496,8 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo ...@@ -496,8 +496,8 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo
// Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageFuture, err error) { func (client VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageFuture, err error) {
req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -567,8 +567,8 @@ func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Respon ...@@ -567,8 +567,8 @@ func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Respon
// ReimageAll allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This // ReimageAll allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This
// operation is only supported for managed disks. // operation is only supported for managed disks.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageAllFuture, err error) { func (client VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageAllFuture, err error) {
req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -637,8 +637,8 @@ func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Res ...@@ -637,8 +637,8 @@ func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Res
// Restart restarts a virtual machine in a VM scale set. // Restart restarts a virtual machine in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRestartFuture, err error) { func (client VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRestartFuture, err error) {
req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -707,8 +707,8 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon ...@@ -707,8 +707,8 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon
// Start starts a virtual machine in a VM scale set. // Start starts a virtual machine in a VM scale set.
// //
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID is // resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
// the instance ID of the virtual machine. // is the instance ID of the virtual machine.
func (client VirtualMachineScaleSetVMsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsStartFuture, err error) { func (client VirtualMachineScaleSetVMsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsStartFuture, err error) {
req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID) req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
if err != nil { if err != nil {
...@@ -799,7 +799,7 @@ func (client VirtualMachineScaleSetVMsClient) Update(ctx context.Context, resour ...@@ -799,7 +799,7 @@ func (client VirtualMachineScaleSetVMsClient) Update(ctx context.Context, resour
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetVMsClient", "Update") return result, validation.NewError("compute.VirtualMachineScaleSetVMsClient", "Update", err.Error())
} }
req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) req, err := client.UpdatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters)
......
...@@ -47,7 +47,7 @@ func (client VirtualMachineSizesClient) List(ctx context.Context, location strin ...@@ -47,7 +47,7 @@ func (client VirtualMachineSizesClient) List(ctx context.Context, location strin
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.VirtualMachineSizesClient", "List") return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error())
} }
req, err := client.ListPreparer(ctx, location) req, err := client.ListPreparer(ctx, location)
......
...@@ -11,9 +11,10 @@ go_library( ...@@ -11,9 +11,10 @@ go_library(
"version.go", "version.go",
"webhooks.go", "webhooks.go",
], ],
importpath = "github.com/Azure/azure-sdk-for-go/arm/containerregistry", importpath = "github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/azure-sdk-for-go/version:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library",
......
// Package containerregistry implements the Azure ARM Containerregistry service API version 2017-10-01. // Package containerregistry implements the Azure ARM Containerregistry service API version 2017-10-01.
// //
// Deprecated: Please instead use github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry //
package containerregistry package containerregistry
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
...@@ -29,21 +29,21 @@ const ( ...@@ -29,21 +29,21 @@ const (
DefaultBaseURI = "https://management.azure.com" DefaultBaseURI = "https://management.azure.com"
) )
// ManagementClient is the base client for Containerregistry. // BaseClient is the base client for Containerregistry.
type ManagementClient struct { type BaseClient struct {
autorest.Client autorest.Client
BaseURI string BaseURI string
SubscriptionID string SubscriptionID string
} }
// New creates an instance of the ManagementClient client. // New creates an instance of the BaseClient client.
func New(subscriptionID string) ManagementClient { func New(subscriptionID string) BaseClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID) return NewWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewWithBaseURI creates an instance of the ManagementClient client. // NewWithBaseURI creates an instance of the BaseClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
return ManagementClient{ return BaseClient{
Client: autorest.NewClientWithUserAgent(UserAgent()), Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI, BaseURI: baseURI,
SubscriptionID: subscriptionID, SubscriptionID: subscriptionID,
......
...@@ -18,6 +18,7 @@ package containerregistry ...@@ -18,6 +18,7 @@ package containerregistry
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"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"
"net/http" "net/http"
...@@ -25,7 +26,7 @@ import ( ...@@ -25,7 +26,7 @@ import (
// OperationsClient is the client for the Operations methods of the Containerregistry service. // OperationsClient is the client for the Operations methods of the Containerregistry service.
type OperationsClient struct { type OperationsClient struct {
ManagementClient BaseClient
} }
// NewOperationsClient creates an instance of the OperationsClient client. // NewOperationsClient creates an instance of the OperationsClient client.
...@@ -39,8 +40,9 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera ...@@ -39,8 +40,9 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera
} }
// List lists all of the available Azure Container Registry REST API operations. // List lists all of the available Azure Container Registry REST API operations.
func (client OperationsClient) List() (result OperationListResult, err error) { func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) {
req, err := client.ListPreparer() result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing request")
return return
...@@ -48,12 +50,12 @@ func (client OperationsClient) List() (result OperationListResult, err error) { ...@@ -48,12 +50,12 @@ func (client OperationsClient) List() (result OperationListResult, err error) {
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.olr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.olr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to request")
} }
...@@ -62,7 +64,7 @@ func (client OperationsClient) List() (result OperationListResult, err error) { ...@@ -62,7 +64,7 @@ func (client OperationsClient) List() (result OperationListResult, err error) {
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) { func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
const APIVersion = "2017-10-01" const APIVersion = "2017-10-01"
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
"api-version": APIVersion, "api-version": APIVersion,
...@@ -73,14 +75,13 @@ func (client OperationsClient) ListPreparer() (*http.Request, error) { ...@@ -73,14 +75,13 @@ func (client OperationsClient) ListPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.ContainerRegistry/operations"), autorest.WithPath("/providers/Microsoft.ContainerRegistry/operations"),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// 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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
} }
...@@ -97,71 +98,29 @@ func (client OperationsClient) ListResponder(resp *http.Response) (result Operat ...@@ -97,71 +98,29 @@ func (client OperationsClient) ListResponder(resp *http.Response) (result Operat
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { func (client OperationsClient) listNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.OperationListResultPreparer() req, err := lastResults.operationListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
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, "containerregistry.OperationsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "listNextResults", 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, "containerregistry.OperationsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan OperationDefinition, <-chan error) { func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) {
resultChan := make(chan OperationDefinition) result.page, err = client.List(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
package containerregistry package containerregistry
import "github.com/Azure/azure-sdk-for-go/version"
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -19,10 +21,10 @@ package containerregistry ...@@ -19,10 +21,10 @@ package containerregistry
// 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 "Azure-SDK-For-Go/v12.4.0-beta arm-containerregistry/2017-10-01" return "Azure-SDK-For-Go/" + version.Number + " containerregistry/2017-10-01"
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { func Version() string {
return "v12.4.0-beta" return version.Number
} }
...@@ -46,6 +46,7 @@ go_library( ...@@ -46,6 +46,7 @@ go_library(
importpath = "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network", importpath = "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/azure-sdk-for-go/version:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library",
......
...@@ -42,8 +42,8 @@ func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID stri ...@@ -42,8 +42,8 @@ func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID stri
// BackendHealth gets the backend health of the specified application gateway in a resource group. // BackendHealth gets the backend health of the specified application gateway in a resource group.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// expand is expands BackendAddressPool and BackendHttpSettings referenced in backend health. // gateway. expand is expands BackendAddressPool and BackendHttpSettings referenced in backend health.
func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) { func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) {
req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand) req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand)
if err != nil { if err != nil {
...@@ -114,8 +114,8 @@ func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Respon ...@@ -114,8 +114,8 @@ func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Respon
// CreateOrUpdate creates or updates the specified application gateway. // CreateOrUpdate creates or updates the specified application gateway.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// parameters is parameters supplied to the create or update application gateway operation. // gateway. parameters is parameters supplied to the create or update application gateway operation.
func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) { func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
...@@ -126,7 +126,7 @@ func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, reso ...@@ -126,7 +126,7 @@ func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, reso
{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate") return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
...@@ -197,7 +197,8 @@ func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Respo ...@@ -197,7 +197,8 @@ func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Respo
// Delete deletes the specified application gateway. // Delete deletes the specified application gateway.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// gateway.
func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) { func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName) req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName)
if err != nil { if err != nil {
...@@ -264,7 +265,8 @@ func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (re ...@@ -264,7 +265,8 @@ func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (re
// Get gets the specified application gateway. // Get gets the specified application gateway.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// gateway.
func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName) req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName)
if err != nil { if err != nil {
...@@ -792,7 +794,8 @@ func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp * ...@@ -792,7 +794,8 @@ func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *
// Start starts the specified application gateway. // Start starts the specified application gateway.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// gateway.
func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) { func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) {
req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName) req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName)
if err != nil { if err != nil {
...@@ -859,7 +862,8 @@ func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (res ...@@ -859,7 +862,8 @@ func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (res
// Stop stops the specified application gateway in a resource group. // Stop stops the specified application gateway in a resource group.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// gateway.
func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) { func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) {
req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName) req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName)
if err != nil { if err != nil {
...@@ -926,8 +930,8 @@ func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (resu ...@@ -926,8 +930,8 @@ func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (resu
// UpdateTags updates the specified application gateway tags. // UpdateTags updates the specified application gateway tags.
// //
// resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application gateway. // resourceGroupName is the name of the resource group. applicationGatewayName is the name of the application
// parameters is parameters supplied to update application gateway tags. // gateway. parameters is parameters supplied to update application gateway tags.
func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGatewaysUpdateTagsFuture, err error) { func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGatewaysUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters)
if err != nil { if err != nil {
......
...@@ -55,8 +55,8 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { ...@@ -55,8 +55,8 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
// CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use. // CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use.
// //
// location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform to // location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform
// the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. // to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {
req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID str ...@@ -41,8 +41,8 @@ func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID str
// Get get the specified default network security rule. // Get get the specified default network security rule.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. defaultSecurityRuleName is the name of the default security rule. // security group. defaultSecurityRuleName is the name of the default security rule.
func (client DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) { func (client DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName)
if err != nil { if err != nil {
...@@ -109,8 +109,8 @@ func (client DefaultSecurityRulesClient) GetResponder(resp *http.Response) (resu ...@@ -109,8 +109,8 @@ func (client DefaultSecurityRulesClient) GetResponder(resp *http.Response) (resu
// List gets all default security rules in a network security group. // List gets all default security rules in a network security group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. // security group.
func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) {
result.fn = client.listNextResults result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName)
......
...@@ -44,8 +44,8 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc ...@@ -44,8 +44,8 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc
// CreateOrUpdate creates or updates an authorization in the specified express route circuit. // CreateOrUpdate creates or updates an authorization in the specified express route circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create or // authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create
// update express route circuit authorization operation. // or update express route circuit authorization operation.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters)
if err != nil { if err != nil {
......
...@@ -62,7 +62,7 @@ func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resource ...@@ -62,7 +62,7 @@ func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resource
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.InboundNatRulesClient", "CreateOrUpdate") return result, validation.NewError("network.InboundNatRulesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters)
......
...@@ -318,9 +318,10 @@ func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Respon ...@@ -318,9 +318,10 @@ func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Respon
// GetVirtualMachineScaleSetIPConfiguration get the specified network interface ip configuration in a virtual machine // GetVirtualMachineScaleSetIPConfiguration get the specified network interface ip configuration in a virtual machine
// scale set. // scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network // machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the
// interface. IPConfigurationName is the name of the ip configuration. expand is expands referenced resources. // network interface. IPConfigurationName is the name of the ip configuration. expand is expands referenced
// resources.
func (client InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result InterfaceIPConfiguration, err error) { func (client InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result InterfaceIPConfiguration, err error) {
req, err := client.GetVirtualMachineScaleSetIPConfigurationPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, expand) req, err := client.GetVirtualMachineScaleSetIPConfigurationPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, expand)
if err != nil { if err != nil {
...@@ -392,9 +393,9 @@ func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationResponder ...@@ -392,9 +393,9 @@ func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationResponder
// GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set. // GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network // machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the
// interface. expand is expands referenced resources. // network interface. expand is expands referenced resources.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
if err != nil { if err != nil {
...@@ -717,9 +718,9 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp ...@@ -717,9 +718,9 @@ func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp
// ListVirtualMachineScaleSetIPConfigurations get the specified network interface ip configuration in a virtual machine // ListVirtualMachineScaleSetIPConfigurations get the specified network interface ip configuration in a virtual machine
// scale set. // scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network // machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the
// interface. expand is expands referenced resources. // network interface. expand is expands referenced resources.
func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultPage, err error) { func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultPage, err error) {
result.fn = client.listVirtualMachineScaleSetIPConfigurationsNextResults result.fn = client.listVirtualMachineScaleSetIPConfigurationsNextResults
req, err := client.ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) req, err := client.ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
...@@ -818,8 +819,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsComplet ...@@ -818,8 +819,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsComplet
// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set. // ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. // machine scale set.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultPage, err error) { func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultPage, err error) {
result.fn = client.listVirtualMachineScaleSetNetworkInterfacesNextResults result.fn = client.listVirtualMachineScaleSetNetworkInterfacesNextResults
req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName)
...@@ -914,8 +915,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComple ...@@ -914,8 +915,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComple
// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in // ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in
// a virtual machine scale set. // a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. // machine scale set. virtualmachineIndex is the virtual machine index.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultPage, err error) { func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultPage, err error) {
result.fn = client.listVirtualMachineScaleSetVMNetworkInterfacesNextResults result.fn = client.listVirtualMachineScaleSetVMNetworkInterfacesNextResults
req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
......
...@@ -41,8 +41,8 @@ func NewLoadBalancerProbesClientWithBaseURI(baseURI string, subscriptionID strin ...@@ -41,8 +41,8 @@ func NewLoadBalancerProbesClientWithBaseURI(baseURI string, subscriptionID strin
// Get gets load balancer probe. // Get gets load balancer probe.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. probeName is // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// the name of the probe. // probeName is the name of the probe.
func (client LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) { func (client LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, probeName) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, probeName)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo ...@@ -41,8 +41,8 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo
// CreateOrUpdate creates or updates a load balancer. // CreateOrUpdate creates or updates a load balancer.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. parameters // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// is parameters supplied to the create or update load balancer operation. // parameters is parameters supplied to the create or update load balancer operation.
func (client LoadBalancersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancersCreateOrUpdateFuture, err error) { func (client LoadBalancersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancersCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, parameters)
if err != nil { if err != nil {
...@@ -179,8 +179,8 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a ...@@ -179,8 +179,8 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a
// Get gets the specified load balancer. // Get gets the specified load balancer.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. expand is // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. expand
// expands referenced resources. // is expands referenced resources.
func (client LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { func (client LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, expand)
if err != nil { if err != nil {
...@@ -432,8 +432,8 @@ func (client LoadBalancersClient) ListAllComplete(ctx context.Context) (result L ...@@ -432,8 +432,8 @@ func (client LoadBalancersClient) ListAllComplete(ctx context.Context) (result L
// UpdateTags updates a load balancer tags. // UpdateTags updates a load balancer tags.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. parameters // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// is parameters supplied to update load balancer tags. // parameters is parameters supplied to update load balancer tags.
func (client LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (result LoadBalancersUpdateTagsFuture, err error) { func (client LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (result LoadBalancersUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, loadBalancerName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, loadBalancerName, parameters)
if err != nil { if err != nil {
......
...@@ -50,7 +50,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, res ...@@ -50,7 +50,7 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, res
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate") return result, validation.NewError("network.LocalNetworkGatewaysClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
...@@ -127,7 +127,7 @@ func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGro ...@@ -127,7 +127,7 @@ func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGro
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Delete") return result, validation.NewError("network.LocalNetworkGatewaysClient", "Delete", err.Error())
} }
req, err := client.DeletePreparer(ctx, resourceGroupName, localNetworkGatewayName) req, err := client.DeletePreparer(ctx, resourceGroupName, localNetworkGatewayName)
...@@ -201,7 +201,7 @@ func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupN ...@@ -201,7 +201,7 @@ func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupN
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Get") return result, validation.NewError("network.LocalNetworkGatewaysClient", "Get", err.Error())
} }
req, err := client.GetPreparer(ctx, resourceGroupName, localNetworkGatewayName) req, err := client.GetPreparer(ctx, resourceGroupName, localNetworkGatewayName)
...@@ -367,7 +367,7 @@ func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourc ...@@ -367,7 +367,7 @@ func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourc
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "UpdateTags") return result, validation.NewError("network.LocalNetworkGatewaysClient", "UpdateTags", err.Error())
} }
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
......
...@@ -43,8 +43,8 @@ func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) P ...@@ -43,8 +43,8 @@ func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) P
// Create create and start a packet capture on the specified VM. // Create create and start a packet capture on the specified VM.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher.
// packetCaptureName is the name of the packet capture session. parameters is parameters that define the create packet // packetCaptureName is the name of the packet capture session. parameters is parameters that define the create
// capture operation. // packet capture operation.
func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (result PacketCapturesCreateFuture, err error) { func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (result PacketCapturesCreateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
...@@ -52,7 +52,7 @@ func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName ...@@ -52,7 +52,7 @@ func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName
Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.PacketCapturesClient", "Create") return result, validation.NewError("network.PacketCapturesClient", "Create", err.Error())
} }
req, err := client.CreatePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters) req, err := client.CreatePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters)
...@@ -261,8 +261,8 @@ func (client PacketCapturesClient) GetResponder(resp *http.Response) (result Pac ...@@ -261,8 +261,8 @@ func (client PacketCapturesClient) GetResponder(resp *http.Response) (result Pac
// GetStatus query the status of a running packet capture session. // GetStatus query the status of a running packet capture session.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher
// packetCaptureName is the name given to the packet capture session. // resource. packetCaptureName is the name given to the packet capture session.
func (client PacketCapturesClient) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesGetStatusFuture, err error) { func (client PacketCapturesClient) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesGetStatusFuture, err error) {
req, err := client.GetStatusPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) req, err := client.GetStatusPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName)
if err != nil { if err != nil {
...@@ -331,7 +331,8 @@ func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (resu ...@@ -331,7 +331,8 @@ func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (resu
// List lists all packet capture sessions within the specified resource group. // List lists all packet capture sessions within the specified resource group.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher
// resource.
func (client PacketCapturesClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { func (client PacketCapturesClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) {
req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName)
if err != nil { if err != nil {
......
...@@ -53,7 +53,7 @@ func (client PublicIPAddressesClient) CreateOrUpdate(ctx context.Context, resour ...@@ -53,7 +53,7 @@ func (client PublicIPAddressesClient) CreateOrUpdate(ctx context.Context, resour
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate") return result, validation.NewError("network.PublicIPAddressesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, publicIPAddressName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, publicIPAddressName, parameters)
...@@ -261,10 +261,10 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result ...@@ -261,10 +261,10 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result
// GetVirtualMachineScaleSetPublicIPAddress get the specified public IP address in a virtual machine scale set. // GetVirtualMachineScaleSetPublicIPAddress get the specified public IP address in a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network // machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the
// interface. IPConfigurationName is the name of the IP configuration. publicIPAddressName is the name of the public IP // network interface. IPConfigurationName is the name of the IP configuration. publicIPAddressName is the name of
// Address. expand is expands referenced resources. // the public IP Address. expand is expands referenced resources.
func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand)
if err != nil { if err != nil {
...@@ -521,8 +521,8 @@ func (client PublicIPAddressesClient) ListAllComplete(ctx context.Context) (resu ...@@ -521,8 +521,8 @@ func (client PublicIPAddressesClient) ListAllComplete(ctx context.Context) (resu
// ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine // ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine
// scale set level. // scale set level.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. // machine scale set.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultPage, err error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultPage, err error) {
result.fn = client.listVirtualMachineScaleSetPublicIPAddressesNextResults result.fn = client.listVirtualMachineScaleSetPublicIPAddressesNextResults
req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName)
...@@ -617,9 +617,9 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse ...@@ -617,9 +617,9 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
// ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP // ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP
// configuration in a virtual machine scale set. // configuration in a virtual machine scale set.
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the network interface name. // machine scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the network
// IPConfigurationName is the IP configuration name. // interface name. IPConfigurationName is the IP configuration name.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) {
result.fn = client.listVirtualMachineScaleSetVMPublicIPAddressesNextResults result.fn = client.listVirtualMachineScaleSetVMPublicIPAddressesNextResults
req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName)
......
...@@ -42,9 +42,9 @@ func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string) ...@@ -42,9 +42,9 @@ func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string)
// CreateOrUpdate creates or updates a route in the specified route filter. // CreateOrUpdate creates or updates a route in the specified route filter.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName
// the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the create or update route // is the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the create or update
// filter rule operation. // route filter rule operation.
func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (result RouteFilterRulesCreateOrUpdateFuture, err error) { func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (result RouteFilterRulesCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: routeFilterRuleParameters, {TargetValue: routeFilterRuleParameters,
...@@ -52,7 +52,7 @@ func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourc ...@@ -52,7 +52,7 @@ func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourc
Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil},
{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil}, {Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.RouteFilterRulesClient", "CreateOrUpdate") return result, validation.NewError("network.RouteFilterRulesClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters)
...@@ -124,8 +124,8 @@ func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response ...@@ -124,8 +124,8 @@ func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response
// Delete deletes the specified rule from a route filter. // Delete deletes the specified rule from a route filter.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName
// the name of the rule. // is the name of the rule.
func (client RouteFilterRulesClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRulesDeleteFuture, err error) { func (client RouteFilterRulesClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRulesDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName, ruleName) req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName, ruleName)
if err != nil { if err != nil {
...@@ -193,8 +193,8 @@ func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (resul ...@@ -193,8 +193,8 @@ func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (resul
// Get gets the specified rule from a route filter. // Get gets the specified rule from a route filter.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName
// the name of the rule. // is the name of the rule.
func (client RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { func (client RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, ruleName) req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, ruleName)
if err != nil { if err != nil {
...@@ -355,9 +355,9 @@ func (client RouteFilterRulesClient) ListByRouteFilterComplete(ctx context.Conte ...@@ -355,9 +355,9 @@ func (client RouteFilterRulesClient) ListByRouteFilterComplete(ctx context.Conte
// Update updates a route in the specified route filter. // Update updates a route in the specified route filter.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName
// the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the update route filter rule // is the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the update route
// operation. // filter rule operation.
func (client RouteFilterRulesClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule) (result RouteFilterRulesUpdateFuture, err error) { func (client RouteFilterRulesClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule) (result RouteFilterRulesUpdateFuture, err error) {
req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters) req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli ...@@ -41,8 +41,8 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli
// CreateOrUpdate creates or updates a route in the specified route table. // CreateOrUpdate creates or updates a route in the specified route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is
// name of the route. routeParameters is parameters supplied to the create or update route operation. // the name of the route. routeParameters is parameters supplied to the create or update route operation.
func (client RoutesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result RoutesCreateOrUpdateFuture, err error) { func (client RoutesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result RoutesCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, routeName, routeParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, routeName, routeParameters)
if err != nil { if err != nil {
...@@ -113,8 +113,8 @@ func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result ...@@ -113,8 +113,8 @@ func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result
// Delete deletes the specified route from a route table. // Delete deletes the specified route from a route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is
// name of the route. // the name of the route.
func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result RoutesDeleteFuture, err error) { func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result RoutesDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName, routeName) req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName, routeName)
if err != nil { if err != nil {
...@@ -182,8 +182,8 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest ...@@ -182,8 +182,8 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest
// Get gets the specified route from a route table. // Get gets the specified route from a route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is
// name of the route. // the name of the route.
func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result Route, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, routeName) req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, routeName)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout ...@@ -41,8 +41,8 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
// CreateOrUpdate create or updates a route table in a specified resource group. // CreateOrUpdate create or updates a route table in a specified resource group.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters is // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters
// parameters supplied to the create or update route table operation. // is parameters supplied to the create or update route table operation.
func (client RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTablesCreateOrUpdateFuture, err error) { func (client RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTablesCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, parameters)
if err != nil { if err != nil {
...@@ -432,8 +432,8 @@ func (client RouteTablesClient) ListAllComplete(ctx context.Context) (result Rou ...@@ -432,8 +432,8 @@ func (client RouteTablesClient) ListAllComplete(ctx context.Context) (result Rou
// UpdateTags updates a route table tags. // UpdateTags updates a route table tags.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters is // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters
// parameters supplied to update route table tags. // is parameters supplied to update route table tags.
func (client RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (result RouteTablesUpdateTagsFuture, err error) { func (client RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (result RouteTablesUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeTableName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeTableName, parameters)
if err != nil { if err != nil {
......
...@@ -41,8 +41,8 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S ...@@ -41,8 +41,8 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
// CreateOrUpdate creates or updates a network security group in the specified resource group. // CreateOrUpdate creates or updates a network security group in the specified resource group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. parameters is parameters supplied to the create or update network security group operation. // security group. parameters is parameters supplied to the create or update network security group operation.
func (client SecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroupsCreateOrUpdateFuture, err error) { func (client SecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroupsCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters)
if err != nil { if err != nil {
...@@ -112,8 +112,8 @@ func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) ...@@ -112,8 +112,8 @@ func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response)
// Delete deletes the specified network security group. // Delete deletes the specified network security group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. // security group.
func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) { func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName) req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName)
if err != nil { if err != nil {
...@@ -180,8 +180,8 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result ...@@ -180,8 +180,8 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result
// Get gets the specified network security group. // Get gets the specified network security group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. expand is expands referenced resources. // security group. expand is expands referenced resources.
func (client SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { func (client SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, expand)
if err != nil { if err != nil {
...@@ -433,8 +433,8 @@ func (client SecurityGroupsClient) ListAllComplete(ctx context.Context) (result ...@@ -433,8 +433,8 @@ func (client SecurityGroupsClient) ListAllComplete(ctx context.Context) (result
// UpdateTags updates a network security group tags. // UpdateTags updates a network security group tags.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. parameters is parameters supplied to update network security group tags. // security group. parameters is parameters supplied to update network security group tags.
func (client SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (result SecurityGroupsUpdateTagsFuture, err error) { func (client SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (result SecurityGroupsUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters)
if err != nil { if err != nil {
......
...@@ -41,9 +41,9 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se ...@@ -41,9 +41,9 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se
// CreateOrUpdate creates or updates a security rule in the specified network security group. // CreateOrUpdate creates or updates a security rule in the specified network security group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. securityRuleName is the name of the security rule. securityRuleParameters is parameters supplied to the // security group. securityRuleName is the name of the security rule. securityRuleParameters is parameters supplied
// create or update network security rule operation. // to the create or update network security rule operation.
func (client SecurityRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRulesCreateOrUpdateFuture, err error) { func (client SecurityRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRulesCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters)
if err != nil { if err != nil {
...@@ -114,8 +114,8 @@ func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) ( ...@@ -114,8 +114,8 @@ func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (
// Delete deletes the specified network security rule. // Delete deletes the specified network security rule.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. securityRuleName is the name of the security rule. // security group. securityRuleName is the name of the security rule.
func (client SecurityRulesClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRulesDeleteFuture, err error) { func (client SecurityRulesClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRulesDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName)
if err != nil { if err != nil {
...@@ -183,8 +183,8 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a ...@@ -183,8 +183,8 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a
// Get get the specified network security rule. // Get get the specified network security rule.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. securityRuleName is the name of the security rule. // security group. securityRuleName is the name of the security rule.
func (client SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { func (client SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName)
if err != nil { if err != nil {
...@@ -251,8 +251,8 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu ...@@ -251,8 +251,8 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu
// List gets all security rules in a network security group. // List gets all security rules in a network security group.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
// group. // security group.
func (client SecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { func (client SecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) {
result.fn = client.listNextResults result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName)
......
...@@ -47,7 +47,7 @@ func (client UsagesClient) List(ctx context.Context, location string) (result Us ...@@ -47,7 +47,7 @@ func (client UsagesClient) List(ctx context.Context, location string) (result Us
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, "network.UsagesClient", "List") return result, validation.NewError("network.UsagesClient", "List", err.Error())
} }
result.fn = client.listNextResults result.fn = client.listNextResults
......
package network package network
import "github.com/Azure/azure-sdk-for-go/version"
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -19,10 +21,10 @@ package network ...@@ -19,10 +21,10 @@ package network
// 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 "Azure-SDK-For-Go/v12.4.0-beta services" return "Azure-SDK-For-Go/" + version.Number + " network/2017-09-01"
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { func Version() string {
return "v12.4.0-beta" return version.Number
} }
...@@ -43,9 +43,9 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr ...@@ -43,9 +43,9 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr
// CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group. // CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the
// network gateway connection. parameters is parameters supplied to the create or update virtual network gateway // virtual network gateway connection. parameters is parameters supplied to the create or update virtual network
// connection operation. // gateway connection operation.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
...@@ -57,7 +57,7 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context. ...@@ -57,7 +57,7 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.
{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: nil}}}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate") return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", err.Error())
} }
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
...@@ -128,8 +128,8 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(res ...@@ -128,8 +128,8 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(res
// Delete deletes the specified virtual network Gateway connection. // Delete deletes the specified virtual network Gateway connection.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the
// network gateway connection. // virtual network gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) { func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) {
req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil { if err != nil {
...@@ -196,8 +196,8 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http. ...@@ -196,8 +196,8 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.
// Get gets the specified virtual network gateway connection by resource group. // Get gets the specified virtual network gateway connection by resource group.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the
// network gateway connection. // virtual network gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil { if err != nil {
...@@ -437,7 +437,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context. ...@@ -437,7 +437,7 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context.
Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil},
{Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey") return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", err.Error())
} }
req, err := client.ResetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) req, err := client.ResetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
...@@ -517,7 +517,7 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Co ...@@ -517,7 +517,7 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Co
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey") return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", err.Error())
} }
req, err := client.SetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) req, err := client.SetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
...@@ -588,8 +588,9 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp ...@@ -588,8 +588,9 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp
// UpdateTags updates a virtual network gateway connection tags. // UpdateTags updates a virtual network gateway connection tags.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the
// network gateway connection. parameters is parameters supplied to update virtual network gateway connection tags. // virtual network gateway connection. parameters is parameters supplied to update virtual network gateway
// connection tags.
func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
if err != nil { if err != nil {
......
...@@ -42,8 +42,8 @@ func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID s ...@@ -42,8 +42,8 @@ func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID s
// CreateOrUpdate creates or updates a peering in the specified virtual network. // CreateOrUpdate creates or updates a peering in the specified virtual network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// virtualNetworkPeeringName is the name of the peering. virtualNetworkPeeringParameters is parameters supplied to the // virtualNetworkPeeringName is the name of the peering. virtualNetworkPeeringParameters is parameters supplied to
// create or update virtual network peering operation. // the create or update virtual network peering operation.
func (client VirtualNetworkPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering) (result VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { func (client VirtualNetworkPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering) (result VirtualNetworkPeeringsCreateOrUpdateFuture, err error) {
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters)
if err != nil { if err != nil {
......
...@@ -249,8 +249,8 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result ...@@ -249,8 +249,8 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result
// Get gets the specified virtual network by resource group. // Get gets the specified virtual network by resource group.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. expand // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// is expands referenced resources. // expand is expands referenced resources.
func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) {
req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand)
if err != nil { if err != nil {
......
...@@ -11,9 +11,10 @@ go_library( ...@@ -11,9 +11,10 @@ go_library(
"usage.go", "usage.go",
"version.go", "version.go",
], ],
importpath = "github.com/Azure/azure-sdk-for-go/arm/storage", importpath = "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/azure-sdk-for-go/version:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/date:go_default_library",
......
// Package storage implements the Azure ARM Storage service API version 2017-06-01. // Package storage implements the Azure ARM Storage service API version 2017-10-01.
// //
// The Azure Storage Management API. // The Azure Storage Management API.
//
// Deprecated: Please instead use github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-06-01/storage
package storage package storage
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
...@@ -31,21 +29,21 @@ const ( ...@@ -31,21 +29,21 @@ const (
DefaultBaseURI = "https://management.azure.com" DefaultBaseURI = "https://management.azure.com"
) )
// ManagementClient is the base client for Storage. // BaseClient is the base client for Storage.
type ManagementClient struct { type BaseClient struct {
autorest.Client autorest.Client
BaseURI string BaseURI string
SubscriptionID string SubscriptionID string
} }
// New creates an instance of the ManagementClient client. // New creates an instance of the BaseClient client.
func New(subscriptionID string) ManagementClient { func New(subscriptionID string) BaseClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID) return NewWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewWithBaseURI creates an instance of the ManagementClient client. // NewWithBaseURI creates an instance of the BaseClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
return ManagementClient{ return BaseClient{
Client: autorest.NewClientWithUserAgent(UserAgent()), Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI, BaseURI: baseURI,
SubscriptionID: subscriptionID, SubscriptionID: subscriptionID,
......
...@@ -18,6 +18,7 @@ package storage ...@@ -18,6 +18,7 @@ package storage
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"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"
"net/http" "net/http"
...@@ -25,7 +26,7 @@ import ( ...@@ -25,7 +26,7 @@ import (
// OperationsClient is the the Azure Storage Management API. // OperationsClient is the the Azure Storage Management API.
type OperationsClient struct { type OperationsClient struct {
ManagementClient BaseClient
} }
// NewOperationsClient creates an instance of the OperationsClient client. // NewOperationsClient creates an instance of the OperationsClient client.
...@@ -39,8 +40,8 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera ...@@ -39,8 +40,8 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera
} }
// List lists all of the available Storage Rest API operations. // List lists all of the available Storage Rest API operations.
func (client OperationsClient) List() (result OperationListResult, err error) { func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) {
req, err := client.ListPreparer() req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", nil, "Failure preparing request")
return return
...@@ -62,8 +63,8 @@ func (client OperationsClient) List() (result OperationListResult, err error) { ...@@ -62,8 +63,8 @@ func (client OperationsClient) List() (result OperationListResult, err error) {
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) { func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
const APIVersion = "2017-06-01" const APIVersion = "2017-10-01"
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
"api-version": APIVersion, "api-version": APIVersion,
} }
...@@ -73,14 +74,13 @@ func (client OperationsClient) ListPreparer() (*http.Request, error) { ...@@ -73,14 +74,13 @@ func (client OperationsClient) ListPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.Storage/operations"), autorest.WithPath("/providers/Microsoft.Storage/operations"),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// 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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
} }
......
...@@ -18,6 +18,7 @@ package storage ...@@ -18,6 +18,7 @@ package storage
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"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"
"net/http" "net/http"
...@@ -25,7 +26,7 @@ import ( ...@@ -25,7 +26,7 @@ import (
// SkusClient is the the Azure Storage Management API. // SkusClient is the the Azure Storage Management API.
type SkusClient struct { type SkusClient struct {
ManagementClient BaseClient
} }
// NewSkusClient creates an instance of the SkusClient client. // NewSkusClient creates an instance of the SkusClient client.
...@@ -39,8 +40,8 @@ func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient ...@@ -39,8 +40,8 @@ func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient
} }
// List lists the available SKUs supported by Microsoft.Storage for given subscription. // List lists the available SKUs supported by Microsoft.Storage for given subscription.
func (client SkusClient) List() (result SkuListResult, err error) { func (client SkusClient) List(ctx context.Context) (result SkuListResult, err error) {
req, err := client.ListPreparer() req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", nil, "Failure preparing request")
return return
...@@ -62,12 +63,12 @@ func (client SkusClient) List() (result SkuListResult, err error) { ...@@ -62,12 +63,12 @@ func (client SkusClient) List() (result SkuListResult, err error) {
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client SkusClient) ListPreparer() (*http.Request, error) { func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
const APIVersion = "2017-06-01" const APIVersion = "2017-10-01"
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
"api-version": APIVersion, "api-version": APIVersion,
} }
...@@ -77,14 +78,13 @@ func (client SkusClient) ListPreparer() (*http.Request, error) { ...@@ -77,14 +78,13 @@ func (client SkusClient) ListPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// 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 SkusClient) ListSender(req *http.Request) (*http.Response, error) { func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
......
...@@ -18,6 +18,7 @@ package storage ...@@ -18,6 +18,7 @@ package storage
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"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"
"net/http" "net/http"
...@@ -25,7 +26,7 @@ import ( ...@@ -25,7 +26,7 @@ import (
// UsageClient is the the Azure Storage Management API. // UsageClient is the the Azure Storage Management API.
type UsageClient struct { type UsageClient struct {
ManagementClient BaseClient
} }
// NewUsageClient creates an instance of the UsageClient client. // NewUsageClient creates an instance of the UsageClient client.
...@@ -39,8 +40,8 @@ func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClien ...@@ -39,8 +40,8 @@ func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClien
} }
// List gets the current usage count and the limit for the resources under the subscription. // List gets the current usage count and the limit for the resources under the subscription.
func (client UsageClient) List() (result UsageListResult, err error) { func (client UsageClient) List(ctx context.Context) (result UsageListResult, err error) {
req, err := client.ListPreparer() req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", nil, "Failure preparing request")
return return
...@@ -62,12 +63,12 @@ func (client UsageClient) List() (result UsageListResult, err error) { ...@@ -62,12 +63,12 @@ func (client UsageClient) List() (result UsageListResult, err error) {
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client UsageClient) ListPreparer() (*http.Request, error) { func (client UsageClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
const APIVersion = "2017-06-01" const APIVersion = "2017-10-01"
queryParameters := map[string]interface{}{ queryParameters := map[string]interface{}{
"api-version": APIVersion, "api-version": APIVersion,
} }
...@@ -77,14 +78,13 @@ func (client UsageClient) ListPreparer() (*http.Request, error) { ...@@ -77,14 +78,13 @@ func (client UsageClient) ListPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// 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 UsageClient) ListSender(req *http.Request) (*http.Response, error) { func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
......
package storage package storage
import "github.com/Azure/azure-sdk-for-go/version"
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
...@@ -19,10 +21,10 @@ package storage ...@@ -19,10 +21,10 @@ package storage
// 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 "Azure-SDK-For-Go/v12.4.0-beta arm-storage/2017-06-01" return "Azure-SDK-For-Go/" + version.Number + " storage/2017-10-01"
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.
func Version() string { func Version() string {
return "v12.4.0-beta" return version.Number
} }
...@@ -31,11 +31,11 @@ go_library( ...@@ -31,11 +31,11 @@ go_library(
"table_batch.go", "table_batch.go",
"tableserviceclient.go", "tableserviceclient.go",
"util.go", "util.go",
"version.go",
], ],
importpath = "github.com/Azure/azure-sdk-for-go/storage", importpath = "github.com/Azure/azure-sdk-for-go/storage",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/azure-sdk-for-go/version:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/marstr/guid:go_default_library", "//vendor/github.com/marstr/guid:go_default_library",
......
# Azure Storage SDK for Go # Azure Storage SDK for Go (Preview)
The `github.com/Azure/azure-sdk-for-go/storage` package is used to perform REST operations against the [Azure Storage Service](https://docs.microsoft.com/en-us/azure/storage/). To manage your storage accounts (Azure Resource Manager / ARM), use the [github.com/Azure/azure-sdk-for-go/arm/storage](https://github.com/Azure/azure-sdk-for-go/tree/master/arm/storage) package. For your classic storage accounts (Azure Service Management / ASM), use [github.com/Azure/azure-sdk-for-go/management/storageservice](https://github.com/Azure/azure-sdk-for-go/tree/master/management/storageservice) package. :exclamation: IMPORTANT: This package is in maintenance only and will be deprecated in the
future. Consider using the new package for blobs currently in preview at
[github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go).
New Table, Queue and File packages are also in development.
This package includes support for [Azure Storage Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/). The `github.com/Azure/azure-sdk-for-go/storage` package is used to manage
[Azure Storage](https://docs.microsoft.com/en-us/azure/storage/) data plane
resources: containers, blobs, tables, and queues.
# Getting Started To manage storage *accounts* use Azure Resource Manager (ARM) via the packages
at [github.com/Azure/azure-sdk-for-go/services/storage](https://github.com/Azure/azure-sdk-for-go/tree/master/services/storage).
1. Go get the SDK `go get -u github.com/Azure/azure-sdk-for-go/storage` This package also supports the [Azure Storage
1. If you don't already have one, [create a Storage Account](https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account). Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/)
- Take note of your Azure Storage Account Name and Azure Storage Account Key. They'll both be necessary for using this library. (Windows only).
- This option is production ready, but can also be used for development.
1. (Optional, Windows only) Download and start the [Azure Storage Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/).
1. Checkout our existing [samples](https://github.com/Azure-Samples?q=Storage&language=go).
# Contributing
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
When contributing, please conform to the following practices:
- Run [gofmt](https://golang.org/cmd/gofmt/) to use standard go formatting.
- Run [golint](https://github.com/golang/lint) to conform to standard naming conventions.
- Run [go vet](https://golang.org/cmd/vet/) to catch common Go mistakes.
- Use [GoASTScanner/gas](https://github.com/GoASTScanner/gas) to ensure there are no common security violations in your contribution.
- Run [go test](https://golang.org/cmd/go/#hdr-Test_packages) to catch possible bugs in the code: `go test ./storage/...`.
- This project uses HTTP recordings for testing.
- The recorder should be attached to the client before calling the functions to test and later stopped.
- If you updated an existing test, its recording might need to be updated. Run `go test ./storage/... -ow -check.f TestName` to rerecord the test.
- Important note: all HTTP requests in the recording must be unique: different bodies, headers (`User-Agent`, `Authorization` and `Date` or `x-ms-date` headers are ignored), URLs and methods. As opposed to the example above, the following test is not suitable for recording:
``` go
func (s *StorageQueueSuite) TestQueueExists(c *chk.C) {
cli := getQueueClient(c)
rec := cli.client.appendRecorder(c)
defer rec.Stop()
queue := cli.GetQueueReference(queueName(c))
ok, err := queue.Exists()
c.Assert(err, chk.IsNil)
c.Assert(ok, chk.Equals, false)
c.Assert(queue.Create(nil), chk.IsNil)
defer queue.Delete(nil)
ok, err = queue.Exists() // This is the very same request as the one 5 lines above
// The test replayer gets confused and the test fails in the last line
c.Assert(err, chk.IsNil)
c.Assert(ok, chk.Equals, true)
}
```
- On the other side, this test does not repeat requests: the URLs are different.
``` go
func (s *StorageQueueSuite) TestQueueExists(c *chk.C) {
cli := getQueueClient(c)
rec := cli.client.appendRecorder(c)
defer rec.Stop()
queue1 := cli.GetQueueReference(queueName(c, "nonexistent"))
ok, err := queue1.Exists()
c.Assert(err, chk.IsNil)
c.Assert(ok, chk.Equals, false)
queue2 := cli.GetQueueReference(queueName(c, "exisiting"))
c.Assert(queue2.Create(nil), chk.IsNil)
defer queue2.Delete(nil)
ok, err = queue2.Exists()
c.Assert(err, chk.IsNil)
c.Assert(ok, chk.Equals, true)
}
```
...@@ -140,9 +140,9 @@ func (b *Blob) Exists() (bool, error) { ...@@ -140,9 +140,9 @@ func (b *Blob) Exists() (bool, error) {
headers := b.Container.bsc.client.getStandardHeaders() headers := b.Container.bsc.client.getStandardHeaders()
resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusOK, nil return resp.StatusCode == http.StatusOK, nil
} }
} }
return false, err return false, err
...@@ -208,13 +208,13 @@ func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error) { ...@@ -208,13 +208,13 @@ func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error) {
return nil, err return nil, err
} }
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
return nil, err return nil, err
} }
if err := b.writeProperties(resp.headers, true); err != nil { if err := b.writeProperties(resp.Header, true); err != nil {
return resp.body, err return resp.Body, err
} }
return resp.body, nil return resp.Body, nil
} }
// GetRange reads the specified range of a blob to a stream. The bytesRange // GetRange reads the specified range of a blob to a stream. The bytesRange
...@@ -228,18 +228,18 @@ func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error) { ...@@ -228,18 +228,18 @@ func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error) {
return nil, err return nil, err
} }
if err := checkRespCode(resp.statusCode, []int{http.StatusPartialContent}); err != nil { if err := checkRespCode(resp, []int{http.StatusPartialContent}); err != nil {
return nil, err return nil, err
} }
// Content-Length header should not be updated, as the service returns the range length // Content-Length header should not be updated, as the service returns the range length
// (which is not alwys the full blob length) // (which is not alwys the full blob length)
if err := b.writeProperties(resp.headers, false); err != nil { if err := b.writeProperties(resp.Header, false); err != nil {
return resp.body, err return resp.Body, err
} }
return resp.body, nil return resp.Body, nil
} }
func (b *Blob) getRange(options *GetBlobRangeOptions) (*storageResponse, error) { func (b *Blob) getRange(options *GetBlobRangeOptions) (*http.Response, error) {
params := url.Values{} params := url.Values{}
headers := b.Container.bsc.client.getStandardHeaders() headers := b.Container.bsc.client.getStandardHeaders()
...@@ -293,13 +293,13 @@ func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time ...@@ -293,13 +293,13 @@ func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time
if err != nil || resp == nil { if err != nil || resp == nil {
return nil, err return nil, err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { if err := checkRespCode(resp, []int{http.StatusCreated}); err != nil {
return nil, err return nil, err
} }
snapshotResponse := resp.headers.Get(http.CanonicalHeaderKey("x-ms-snapshot")) snapshotResponse := resp.Header.Get(http.CanonicalHeaderKey("x-ms-snapshot"))
if snapshotResponse != "" { if snapshotResponse != "" {
snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse) snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse)
if err != nil { if err != nil {
...@@ -340,12 +340,12 @@ func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error { ...@@ -340,12 +340,12 @@ func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error {
if err != nil { if err != nil {
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err return err
} }
return b.writeProperties(resp.headers, true) return b.writeProperties(resp.Header, true)
} }
func (b *Blob) writeProperties(h http.Header, includeContentLen bool) error { func (b *Blob) writeProperties(h http.Header, includeContentLen bool) error {
...@@ -463,8 +463,8 @@ func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error { ...@@ -463,8 +463,8 @@ func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusOK}) return checkRespCode(resp, []int{http.StatusOK})
} }
// SetBlobMetadataOptions includes the options for a set blob metadata operation // SetBlobMetadataOptions includes the options for a set blob metadata operation
...@@ -501,8 +501,8 @@ func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error { ...@@ -501,8 +501,8 @@ func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusOK}) return checkRespCode(resp, []int{http.StatusOK})
} }
// GetBlobMetadataOptions includes the options for a get blob metadata operation // GetBlobMetadataOptions includes the options for a get blob metadata operation
...@@ -538,13 +538,13 @@ func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error { ...@@ -538,13 +538,13 @@ func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error {
if err != nil { if err != nil {
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err return err
} }
b.writeMetadata(resp.headers) b.writeMetadata(resp.Header)
return nil return nil
} }
...@@ -574,8 +574,8 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error { ...@@ -574,8 +574,8 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) return checkRespCode(resp, []int{http.StatusAccepted})
} }
// DeleteIfExists deletes the given blob from the specified container If the // DeleteIfExists deletes the given blob from the specified container If the
...@@ -585,15 +585,15 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error { ...@@ -585,15 +585,15 @@ func (b *Blob) Delete(options *DeleteBlobOptions) error {
func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) { func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) {
resp, err := b.delete(options) resp, err := b.delete(options)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil return resp.StatusCode == http.StatusAccepted, nil
} }
} }
return false, err return false, err
} }
func (b *Blob) delete(options *DeleteBlobOptions) (*storageResponse, error) { func (b *Blob) delete(options *DeleteBlobOptions) (*http.Response, error) {
params := url.Values{} params := url.Values{}
headers := b.Container.bsc.client.getStandardHeaders() headers := b.Container.bsc.client.getStandardHeaders()
...@@ -621,9 +621,9 @@ func pathForResource(container, name string) string { ...@@ -621,9 +621,9 @@ func pathForResource(container, name string) string {
return fmt.Sprintf("/%s", container) return fmt.Sprintf("/%s", container)
} }
func (b *Blob) respondCreation(resp *storageResponse, bt BlobType) error { func (b *Blob) respondCreation(resp *http.Response, bt BlobType) error {
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
err := checkRespCode(resp.statusCode, []int{http.StatusCreated}) err := checkRespCode(resp, []int{http.StatusCreated})
if err != nil { if err != nil {
return err return err
} }
......
...@@ -121,6 +121,10 @@ func (c *Client) blobAndFileSASURI(options SASOptions, uri, permissions, canonic ...@@ -121,6 +121,10 @@ func (c *Client) blobAndFileSASURI(options SASOptions, uri, permissions, canonic
"sig": {sig}, "sig": {sig},
} }
if start != "" {
sasParams.Add("st", start)
}
if c.apiVersion >= "2015-04-05" { if c.apiVersion >= "2015-04-05" {
if protocols != "" { if protocols != "" {
sasParams.Add("spr", protocols) sasParams.Add("spr", protocols)
......
...@@ -108,8 +108,8 @@ func (b BlobStorageClient) ListContainers(params ListContainersParameters) (*Con ...@@ -108,8 +108,8 @@ func (b BlobStorageClient) ListContainers(params ListContainersParameters) (*Con
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.body.Close() defer resp.Body.Close()
err = xmlUnmarshal(resp.body, &outAlias) err = xmlUnmarshal(resp.Body, &outAlias)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -229,8 +229,8 @@ func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error ...@@ -229,8 +229,8 @@ func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusCreated}) return checkRespCode(resp, []int{http.StatusCreated})
} }
// GetBlockListOptions includes the options for a get block list operation // GetBlockListOptions includes the options for a get block list operation
...@@ -263,8 +263,8 @@ func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOption ...@@ -263,8 +263,8 @@ func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOption
if err != nil { if err != nil {
return out, err return out, err
} }
defer resp.body.Close() defer resp.Body.Close()
err = xmlUnmarshal(resp.body, &out) err = xmlUnmarshal(resp.Body, &out)
return out, err return out, err
} }
...@@ -17,7 +17,6 @@ package storage ...@@ -17,7 +17,6 @@ package storage
import ( import (
"bufio" "bufio"
"bytes"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"encoding/xml" "encoding/xml"
...@@ -35,6 +34,7 @@ import ( ...@@ -35,6 +34,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Azure/azure-sdk-for-go/version"
"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"
) )
...@@ -151,14 +151,8 @@ type Client struct { ...@@ -151,14 +151,8 @@ type Client struct {
accountSASToken url.Values accountSASToken url.Values
} }
type storageResponse struct {
statusCode int
headers http.Header
body io.ReadCloser
}
type odataResponse struct { type odataResponse struct {
storageResponse resp *http.Response
odata odataErrorWrapper odata odataErrorWrapper
} }
...@@ -198,6 +192,7 @@ type odataErrorWrapper struct { ...@@ -198,6 +192,7 @@ type odataErrorWrapper struct {
type UnexpectedStatusCodeError struct { type UnexpectedStatusCodeError struct {
allowed []int allowed []int
got int got int
inner error
} }
func (e UnexpectedStatusCodeError) Error() string { func (e UnexpectedStatusCodeError) Error() string {
...@@ -208,7 +203,7 @@ func (e UnexpectedStatusCodeError) Error() string { ...@@ -208,7 +203,7 @@ func (e UnexpectedStatusCodeError) Error() string {
for _, v := range e.allowed { for _, v := range e.allowed {
expected = append(expected, s(v)) expected = append(expected, s(v))
} }
return fmt.Sprintf("storage: status code from service response is %s; was expecting %s", got, strings.Join(expected, " or ")) return fmt.Sprintf("storage: status code from service response is %s; was expecting %s. Inner error: %+v", got, strings.Join(expected, " or "), e.inner)
} }
// Got is the actual status code returned by Azure. // Got is the actual status code returned by Azure.
...@@ -216,6 +211,11 @@ func (e UnexpectedStatusCodeError) Got() int { ...@@ -216,6 +211,11 @@ func (e UnexpectedStatusCodeError) Got() int {
return e.got return e.got
} }
// Inner returns any inner error info.
func (e UnexpectedStatusCodeError) Inner() error {
return e.inner
}
// NewClientFromConnectionString creates a Client from the connection string. // NewClientFromConnectionString creates a Client from the connection string.
func NewClientFromConnectionString(input string) (Client, error) { func NewClientFromConnectionString(input string) (Client, error) {
// build a map of connection string key/value pairs // build a map of connection string key/value pairs
...@@ -415,7 +415,7 @@ func (c Client) getDefaultUserAgent() string { ...@@ -415,7 +415,7 @@ func (c Client) getDefaultUserAgent() string {
runtime.Version(), runtime.Version(),
runtime.GOARCH, runtime.GOARCH,
runtime.GOOS, runtime.GOOS,
sdkVersion, version.Number,
c.apiVersion, c.apiVersion,
) )
} }
...@@ -704,7 +704,7 @@ func (c Client) getStandardHeaders() map[string]string { ...@@ -704,7 +704,7 @@ func (c Client) getStandardHeaders() map[string]string {
} }
} }
func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) { func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*http.Response, error) {
headers, err := c.addAuthorizationHeader(verb, url, headers, auth) headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -742,48 +742,10 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader ...@@ -742,48 +742,10 @@ func (c Client) exec(verb, url string, headers map[string]string, body io.Reader
} }
if resp.StatusCode >= 400 && resp.StatusCode <= 505 { if resp.StatusCode >= 400 && resp.StatusCode <= 505 {
var respBody []byte return resp, getErrorFromResponse(resp)
respBody, err = readAndCloseBody(resp.Body)
if err != nil {
return nil, err
}
requestID, date, version := getDebugHeaders(resp.Header)
if len(respBody) == 0 {
// no error in response body, might happen in HEAD requests
err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version)
} else {
storageErr := AzureStorageServiceError{
StatusCode: resp.StatusCode,
RequestID: requestID,
Date: date,
APIVersion: version,
}
// response contains storage service error object, unmarshal
if resp.Header.Get("Content-Type") == "application/xml" {
errIn := serviceErrFromXML(respBody, &storageErr)
if err != nil { // error unmarshaling the error response
err = errIn
}
} else {
errIn := serviceErrFromJSON(respBody, &storageErr)
if err != nil { // error unmarshaling the error response
err = errIn
}
}
err = storageErr
}
return &storageResponse{
statusCode: resp.StatusCode,
headers: resp.Header,
body: ioutil.NopCloser(bytes.NewReader(respBody)), /* restore the body */
}, err
} }
return &storageResponse{ return resp, nil
statusCode: resp.StatusCode,
headers: resp.Header,
body: resp.Body}, nil
} }
func (c Client) execInternalJSONCommon(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, *http.Request, *http.Response, error) { func (c Client) execInternalJSONCommon(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, *http.Request, *http.Response, error) {
...@@ -802,10 +764,7 @@ func (c Client) execInternalJSONCommon(verb, url string, headers map[string]stri ...@@ -802,10 +764,7 @@ func (c Client) execInternalJSONCommon(verb, url string, headers map[string]stri
return nil, nil, nil, err return nil, nil, nil, err
} }
respToRet := &odataResponse{} respToRet := &odataResponse{resp: resp}
respToRet.body = resp.Body
respToRet.statusCode = resp.StatusCode
respToRet.headers = resp.Header
statusCode := resp.StatusCode statusCode := resp.StatusCode
if statusCode >= 400 && statusCode <= 505 { if statusCode >= 400 && statusCode <= 505 {
...@@ -890,7 +849,7 @@ func genChangesetReader(req *http.Request, respToRet *odataResponse, batchPartBu ...@@ -890,7 +849,7 @@ func genChangesetReader(req *http.Request, respToRet *odataResponse, batchPartBu
if err != nil { if err != nil {
return err return err
} }
respToRet.statusCode = changesetResp.StatusCode respToRet.resp = changesetResp
} }
return nil return nil
...@@ -963,13 +922,18 @@ func (e AzureStorageServiceError) Error() string { ...@@ -963,13 +922,18 @@ func (e AzureStorageServiceError) Error() string {
// checkRespCode returns UnexpectedStatusError if the given response code is not // checkRespCode returns UnexpectedStatusError if the given response code is not
// one of the allowed status codes; otherwise nil. // one of the allowed status codes; otherwise nil.
func checkRespCode(respCode int, allowed []int) error { func checkRespCode(resp *http.Response, allowed []int) error {
for _, v := range allowed { for _, v := range allowed {
if respCode == v { if resp.StatusCode == v {
return nil return nil
} }
} }
return UnexpectedStatusCodeError{allowed, respCode} err := getErrorFromResponse(resp)
return UnexpectedStatusCodeError{
allowed: allowed,
got: resp.StatusCode,
inner: err,
}
} }
func (c Client) addMetadataToHeaders(h map[string]string, metadata map[string]string) map[string]string { func (c Client) addMetadataToHeaders(h map[string]string, metadata map[string]string) map[string]string {
...@@ -986,3 +950,37 @@ func getDebugHeaders(h http.Header) (requestID, date, version string) { ...@@ -986,3 +950,37 @@ func getDebugHeaders(h http.Header) (requestID, date, version string) {
date = h.Get("Date") date = h.Get("Date")
return return
} }
func getErrorFromResponse(resp *http.Response) error {
respBody, err := readAndCloseBody(resp.Body)
if err != nil {
return err
}
requestID, date, version := getDebugHeaders(resp.Header)
if len(respBody) == 0 {
// no error in response body, might happen in HEAD requests
err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version)
} else {
storageErr := AzureStorageServiceError{
StatusCode: resp.StatusCode,
RequestID: requestID,
Date: date,
APIVersion: version,
}
// response contains storage service error object, unmarshal
if resp.Header.Get("Content-Type") == "application/xml" {
errIn := serviceErrFromXML(respBody, &storageErr)
if err != nil { // error unmarshaling the error response
err = errIn
}
} else {
errIn := serviceErrFromJSON(respBody, &storageErr)
if err != nil { // error unmarshaling the error response
err = errIn
}
}
err = storageErr
}
return err
}
...@@ -16,7 +16,6 @@ package storage ...@@ -16,7 +16,6 @@ package storage
import ( import (
"encoding/xml" "encoding/xml"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
...@@ -95,11 +94,12 @@ func (c *Container) GetSASURI(options ContainerSASOptions) (string, error) { ...@@ -95,11 +94,12 @@ func (c *Container) GetSASURI(options ContainerSASOptions) (string, error) {
// ContainerProperties contains various properties of a container returned from // ContainerProperties contains various properties of a container returned from
// various endpoints like ListContainers. // various endpoints like ListContainers.
type ContainerProperties struct { type ContainerProperties struct {
LastModified string `xml:"Last-Modified"` LastModified string `xml:"Last-Modified"`
Etag string `xml:"Etag"` Etag string `xml:"Etag"`
LeaseStatus string `xml:"LeaseStatus"` LeaseStatus string `xml:"LeaseStatus"`
LeaseState string `xml:"LeaseState"` LeaseState string `xml:"LeaseState"`
LeaseDuration string `xml:"LeaseDuration"` LeaseDuration string `xml:"LeaseDuration"`
PublicAccess ContainerAccessType `xml:"PublicAccess"`
} }
// ContainerListResponse contains the response fields from // ContainerListResponse contains the response fields from
...@@ -258,8 +258,8 @@ func (c *Container) Create(options *CreateContainerOptions) error { ...@@ -258,8 +258,8 @@ func (c *Container) Create(options *CreateContainerOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusCreated}) return checkRespCode(resp, []int{http.StatusCreated})
} }
// CreateIfNotExists creates a blob container if it does not exist. Returns // CreateIfNotExists creates a blob container if it does not exist. Returns
...@@ -267,15 +267,15 @@ func (c *Container) Create(options *CreateContainerOptions) error { ...@@ -267,15 +267,15 @@ func (c *Container) Create(options *CreateContainerOptions) error {
func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) { func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) {
resp, err := c.create(options) resp, err := c.create(options)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict {
return resp.statusCode == http.StatusCreated, nil return resp.StatusCode == http.StatusCreated, nil
} }
} }
return false, err return false, err
} }
func (c *Container) create(options *CreateContainerOptions) (*storageResponse, error) { func (c *Container) create(options *CreateContainerOptions) (*http.Response, error) {
query := url.Values{"restype": {"container"}} query := url.Values{"restype": {"container"}}
headers := c.bsc.client.getStandardHeaders() headers := c.bsc.client.getStandardHeaders()
headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata) headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata)
...@@ -307,9 +307,9 @@ func (c *Container) Exists() (bool, error) { ...@@ -307,9 +307,9 @@ func (c *Container) Exists() (bool, error) {
resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth) resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusOK, nil return resp.StatusCode == http.StatusOK, nil
} }
} }
return false, err return false, err
...@@ -349,13 +349,8 @@ func (c *Container) SetPermissions(permissions ContainerPermissions, options *Se ...@@ -349,13 +349,8 @@ func (c *Container) SetPermissions(permissions ContainerPermissions, options *Se
if err != nil { if err != nil {
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp, []int{http.StatusOK})
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
return errors.New("Unable to set permissions")
}
return nil
} }
// GetContainerPermissionOptions includes options for a get container permissions operation // GetContainerPermissionOptions includes options for a get container permissions operation
...@@ -385,14 +380,14 @@ func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*Con ...@@ -385,14 +380,14 @@ func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*Con
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer resp.body.Close() defer resp.Body.Close()
var ap AccessPolicy var ap AccessPolicy
err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) err = xmlUnmarshal(resp.Body, &ap.SignedIdentifiersList)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return buildAccessPolicy(ap, &resp.headers), nil return buildAccessPolicy(ap, &resp.Header), nil
} }
func buildAccessPolicy(ap AccessPolicy, headers *http.Header) *ContainerPermissions { func buildAccessPolicy(ap AccessPolicy, headers *http.Header) *ContainerPermissions {
...@@ -436,8 +431,8 @@ func (c *Container) Delete(options *DeleteContainerOptions) error { ...@@ -436,8 +431,8 @@ func (c *Container) Delete(options *DeleteContainerOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) return checkRespCode(resp, []int{http.StatusAccepted})
} }
// DeleteIfExists deletes the container with given name on the storage // DeleteIfExists deletes the container with given name on the storage
...@@ -449,15 +444,15 @@ func (c *Container) Delete(options *DeleteContainerOptions) error { ...@@ -449,15 +444,15 @@ func (c *Container) Delete(options *DeleteContainerOptions) error {
func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) { func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) {
resp, err := c.delete(options) resp, err := c.delete(options)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil return resp.StatusCode == http.StatusAccepted, nil
} }
} }
return false, err return false, err
} }
func (c *Container) delete(options *DeleteContainerOptions) (*storageResponse, error) { func (c *Container) delete(options *DeleteContainerOptions) (*http.Response, error) {
query := url.Values{"restype": {"container"}} query := url.Values{"restype": {"container"}}
headers := c.bsc.client.getStandardHeaders() headers := c.bsc.client.getStandardHeaders()
...@@ -497,9 +492,9 @@ func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, err ...@@ -497,9 +492,9 @@ func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, err
if err != nil { if err != nil {
return out, err return out, err
} }
defer resp.body.Close() defer resp.Body.Close()
err = xmlUnmarshal(resp.body, &out) err = xmlUnmarshal(resp.Body, &out)
for i := range out.Blobs { for i := range out.Blobs {
out.Blobs[i].Container = c out.Blobs[i].Container = c
} }
...@@ -540,8 +535,8 @@ func (c *Container) SetMetadata(options *ContainerMetadataOptions) error { ...@@ -540,8 +535,8 @@ func (c *Container) SetMetadata(options *ContainerMetadataOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusOK}) return checkRespCode(resp, []int{http.StatusOK})
} }
// GetMetadata returns all user-defined metadata for the specified container. // GetMetadata returns all user-defined metadata for the specified container.
...@@ -568,12 +563,12 @@ func (c *Container) GetMetadata(options *ContainerMetadataOptions) error { ...@@ -568,12 +563,12 @@ func (c *Container) GetMetadata(options *ContainerMetadataOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err return err
} }
c.writeMetadata(resp.headers) c.writeMetadata(resp.Header)
return nil return nil
} }
...@@ -612,3 +607,34 @@ func (capd *ContainerAccessPolicy) generateContainerPermissions() (permissions s ...@@ -612,3 +607,34 @@ func (capd *ContainerAccessPolicy) generateContainerPermissions() (permissions s
return permissions return permissions
} }
// GetProperties updated the properties of the container.
//
// See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties
func (c *Container) GetProperties() error {
params := url.Values{
"restype": {"container"},
}
headers := c.bsc.client.getStandardHeaders()
uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth)
if err != nil {
return err
}
defer resp.Body.Close()
if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err
}
// update properties
c.Properties.Etag = resp.Header.Get(headerEtag)
c.Properties.LeaseStatus = resp.Header.Get("x-ms-lease-status")
c.Properties.LeaseState = resp.Header.Get("x-ms-lease-state")
c.Properties.LeaseDuration = resp.Header.Get("x-ms-lease-duration")
c.Properties.LastModified = resp.Header.Get("Last-Modified")
c.Properties.PublicAccess = ContainerAccessType(resp.Header.Get(ContainerAccessHeader))
return nil
}
...@@ -110,13 +110,13 @@ func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error ...@@ -110,13 +110,13 @@ func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error
if err != nil { if err != nil {
return "", err return "", err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted, http.StatusCreated}); err != nil { if err := checkRespCode(resp, []int{http.StatusAccepted, http.StatusCreated}); err != nil {
return "", err return "", err
} }
copyID := resp.headers.Get("x-ms-copy-id") copyID := resp.Header.Get("x-ms-copy-id")
if copyID == "" { if copyID == "" {
return "", errors.New("Got empty copy id header") return "", errors.New("Got empty copy id header")
} }
...@@ -152,8 +152,8 @@ func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error { ...@@ -152,8 +152,8 @@ func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error {
if err != nil { if err != nil {
return err return err
} }
readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) return checkRespCode(resp, []int{http.StatusNoContent})
} }
// WaitForCopy loops until a BlobCopy operation is completed (or fails with error) // WaitForCopy loops until a BlobCopy operation is completed (or fails with error)
...@@ -223,13 +223,13 @@ func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, ...@@ -223,13 +223,13 @@ func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time,
if err != nil { if err != nil {
return "", err return "", err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted}); err != nil { if err := checkRespCode(resp, []int{http.StatusAccepted}); err != nil {
return "", err return "", err
} }
copyID := resp.headers.Get("x-ms-copy-id") copyID := resp.Header.Get("x-ms-copy-id")
if copyID == "" { if copyID == "" {
return "", errors.New("Got empty copy id header") return "", errors.New("Got empty copy id header")
} }
......
...@@ -107,10 +107,10 @@ func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error) ...@@ -107,10 +107,10 @@ func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error)
params := prepareOptions(options) params := prepareOptions(options)
resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil) resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict {
if resp.statusCode == http.StatusCreated { if resp.StatusCode == http.StatusCreated {
d.updateEtagAndLastModified(resp.headers) d.updateEtagAndLastModified(resp.Header)
return true, nil return true, nil
} }
...@@ -135,9 +135,9 @@ func (d *Directory) Delete(options *FileRequestOptions) error { ...@@ -135,9 +135,9 @@ func (d *Directory) Delete(options *FileRequestOptions) error {
func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) { func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) {
resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options) resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil return resp.StatusCode == http.StatusAccepted, nil
} }
} }
return false, err return false, err
...@@ -200,9 +200,9 @@ func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAn ...@@ -200,9 +200,9 @@ func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAn
return nil, err return nil, err
} }
defer resp.body.Close() defer resp.Body.Close()
var out DirsAndFilesListResponse var out DirsAndFilesListResponse
err = xmlUnmarshal(resp.body, &out) err = xmlUnmarshal(resp.Body, &out)
return &out, err return &out, err
} }
......
...@@ -16,6 +16,7 @@ package storage ...@@ -16,6 +16,7 @@ package storage
import ( import (
"bytes" "bytes"
"encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
...@@ -111,13 +112,13 @@ func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) ...@@ -111,13 +112,13 @@ func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions)
if err != nil { if err != nil {
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err return err
} }
respBody, err := ioutil.ReadAll(resp.body) respBody, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
...@@ -153,22 +154,21 @@ func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error { ...@@ -153,22 +154,21 @@ func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error {
if err != nil { if err != nil {
return err return err
} }
defer resp.body.Close() defer readAndCloseBody(resp.Body)
data, err := ioutil.ReadAll(resp.body)
if err != nil {
return err
}
if ml != EmptyPayload { if ml != EmptyPayload {
if err = checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { if err = checkRespCode(resp, []int{http.StatusCreated}); err != nil {
return err
}
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err return err
} }
if err = e.UnmarshalJSON(data); err != nil { if err = e.UnmarshalJSON(data); err != nil {
return err return err
} }
} else { } else {
if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
return err return err
} }
} }
...@@ -207,18 +207,18 @@ func (e *Entity) Delete(force bool, options *EntityOptions) error { ...@@ -207,18 +207,18 @@ func (e *Entity) Delete(force bool, options *EntityOptions) error {
uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
resp, err := e.Table.tsc.client.exec(http.MethodDelete, uri, headers, nil, e.Table.tsc.auth) resp, err := e.Table.tsc.client.exec(http.MethodDelete, uri, headers, nil, e.Table.tsc.auth)
if err != nil { if err != nil {
if resp.statusCode == http.StatusPreconditionFailed { if resp.StatusCode == http.StatusPreconditionFailed {
return fmt.Errorf(etagErrorTemplate, err) return fmt.Errorf(etagErrorTemplate, err)
} }
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
return err return err
} }
return e.updateTimestamp(resp.headers) return e.updateTimestamp(resp.Header)
} }
// InsertOrReplace inserts an entity or replaces the existing one. // InsertOrReplace inserts an entity or replaces the existing one.
...@@ -247,7 +247,7 @@ func (e *Entity) MarshalJSON() ([]byte, error) { ...@@ -247,7 +247,7 @@ func (e *Entity) MarshalJSON() ([]byte, error) {
switch t := v.(type) { switch t := v.(type) {
case []byte: case []byte:
completeMap[typeKey] = OdataBinary completeMap[typeKey] = OdataBinary
completeMap[k] = string(t) completeMap[k] = t
case time.Time: case time.Time:
completeMap[typeKey] = OdataDateTime completeMap[typeKey] = OdataDateTime
completeMap[k] = t.Format(time.RFC3339Nano) completeMap[k] = t.Format(time.RFC3339Nano)
...@@ -321,7 +321,10 @@ func (e *Entity) UnmarshalJSON(data []byte) error { ...@@ -321,7 +321,10 @@ func (e *Entity) UnmarshalJSON(data []byte) error {
} }
switch v { switch v {
case OdataBinary: case OdataBinary:
props[valueKey] = []byte(str) props[valueKey], err = base64.StdEncoding.DecodeString(str)
if err != nil {
return fmt.Errorf(errorTemplate, err)
}
case OdataDateTime: case OdataDateTime:
t, err := time.Parse("2006-01-02T15:04:05Z", str) t, err := time.Parse("2006-01-02T15:04:05Z", str)
if err != nil { if err != nil {
...@@ -396,13 +399,13 @@ func (e *Entity) insertOr(verb string, options *EntityOptions) error { ...@@ -396,13 +399,13 @@ func (e *Entity) insertOr(verb string, options *EntityOptions) error {
if err != nil { if err != nil {
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
return err return err
} }
return e.updateEtagAndTimestamp(resp.headers) return e.updateEtagAndTimestamp(resp.Header)
} }
func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) error { func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) error {
...@@ -420,18 +423,18 @@ func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) er ...@@ -420,18 +423,18 @@ func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) er
uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth)
if err != nil { if err != nil {
if resp.statusCode == http.StatusPreconditionFailed { if resp.StatusCode == http.StatusPreconditionFailed {
return fmt.Errorf(etagErrorTemplate, err) return fmt.Errorf(etagErrorTemplate, err)
} }
return err return err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
return err return err
} }
return e.updateEtagAndTimestamp(resp.headers) return e.updateEtagAndTimestamp(resp.Header)
} }
func stringFromMap(props map[string]interface{}, key string) string { func stringFromMap(props map[string]interface{}, key string) string {
......
...@@ -28,6 +28,10 @@ import ( ...@@ -28,6 +28,10 @@ import (
const fourMB = uint64(4194304) const fourMB = uint64(4194304)
const oneTB = uint64(1099511627776) const oneTB = uint64(1099511627776)
// Export maximum range and file sizes
const MaxRangeSize = fourMB
const MaxFileSize = oneTB
// File represents a file on a share. // File represents a file on a share.
type File struct { type File struct {
fsc *FileServiceClient fsc *FileServiceClient
...@@ -183,9 +187,9 @@ func (f *File) Delete(options *FileRequestOptions) error { ...@@ -183,9 +187,9 @@ func (f *File) Delete(options *FileRequestOptions) error {
func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) { func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) {
resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options) resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options)
if resp != nil { if resp != nil {
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
return resp.statusCode == http.StatusAccepted, nil return resp.StatusCode == http.StatusAccepted, nil
} }
} }
return false, err return false, err
...@@ -207,11 +211,11 @@ func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, err ...@@ -207,11 +211,11 @@ func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, err
return nil, err return nil, err
} }
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
readAndCloseBody(resp.body) readAndCloseBody(resp.Body)
return nil, err return nil, err
} }
return resp.body, nil return resp.Body, nil
} }
// DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash. // DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash.
...@@ -237,14 +241,14 @@ func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOption ...@@ -237,14 +241,14 @@ func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOption
return fs, err return fs, err
} }
if err = checkRespCode(resp.statusCode, []int{http.StatusOK, http.StatusPartialContent}); err != nil { if err = checkRespCode(resp, []int{http.StatusOK, http.StatusPartialContent}); err != nil {
readAndCloseBody(resp.body) readAndCloseBody(resp.Body)
return fs, err return fs, err
} }
fs.Body = resp.body fs.Body = resp.Body
if options != nil && options.GetContentMD5 { if options != nil && options.GetContentMD5 {
fs.ContentMD5 = resp.headers.Get("Content-MD5") fs.ContentMD5 = resp.Header.Get("Content-MD5")
} }
return fs, nil return fs, nil
} }
...@@ -310,20 +314,20 @@ func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error) { ...@@ -310,20 +314,20 @@ func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error) {
return nil, err return nil, err
} }
defer resp.body.Close() defer resp.Body.Close()
var cl uint64 var cl uint64
cl, err = strconv.ParseUint(resp.headers.Get("x-ms-content-length"), 10, 64) cl, err = strconv.ParseUint(resp.Header.Get("x-ms-content-length"), 10, 64)
if err != nil { if err != nil {
ioutil.ReadAll(resp.body) ioutil.ReadAll(resp.Body)
return nil, err return nil, err
} }
var out FileRanges var out FileRanges
out.ContentLength = cl out.ContentLength = cl
out.ETag = resp.headers.Get("ETag") out.ETag = resp.Header.Get("ETag")
out.LastModified = resp.headers.Get("Last-Modified") out.LastModified = resp.Header.Get("Last-Modified")
err = xmlUnmarshal(resp.body, &out) err = xmlUnmarshal(resp.Body, &out)
return &out, err return &out, err
} }
...@@ -371,8 +375,8 @@ func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint, ...@@ -371,8 +375,8 @@ func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint,
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer readAndCloseBody(resp.body) defer readAndCloseBody(resp.Body)
return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusCreated}) return resp.Header, checkRespCode(resp, []int{http.StatusCreated})
} }
// SetMetadata replaces the metadata for this file. // SetMetadata replaces the metadata for this file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment